Homemade Stock Ticker tutorial

  • I am interested in trying to work with Python on the Onion, so I tried to walk through the "homemade stock ticker" tutorial in the projects section. I followed the instructions thoroughly but in the end could not reproduce the results of the project. Upon running a single instance of the code I received the following error:

    root@Omega-2166:/# ./stock.sh AAPL

    Clearing display
    Traceback (most recent call last):
    File "./stock_script.py", line 5, in <module>
    import json
    File "/usr/lib/python2.7/json/init.py", line 108, in <module>
    from .decoder import JSONDecoder
    File "/usr/lib/python2.7/json/decoder.py", line 24, in <module>
    NaN, PosInf, NegInf = _floatconstants()
    File "/usr/lib/python2.7/json/decoder.py", line 18, in _floatconstants
    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
    LookupError: no codec search functions registered: can't find encoding
    Initializing display
    Writing '' to display

    It appears to me that there is some incompatibility with the JSON lib that the tutorial calls for importing. I loaded Python per the tutorial, but it looks like some additional step is necessary. Has anyone worked with this tutorial and gotten a different result?

  • administrators

    @Michael-Matyas Try running:

    opkg update
    opkg install python-codecs

    If you get further errors, you might have installed python-light instead of the full python package.
    To install the full python package:

    opkg update
    opkg install python

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.