ImportError: cannot import name oledExp



  • My OLD works fine with commands like:

    oled-exp -i write "hello"

    But I can't get the stock ticker to work. I get the following error:

    root@Omega-****:~/oled-stock-ticker# python main.py
    Traceback (most recent call last):
    File "main.py", line 4, in <module>
    import oledDriver
    File "/root/oled-stock-ticker/oledDriver.py", line 1, in <module>
    from OmegaExpansion import oledExp
    ImportError: cannot import name oledExp

    I can't find any information on this error. I've tried installing the drivers and it did not help.



  • @Susan-Donovan Have you installed all dependencies according to the documentation? opkg update, opkg install python-light python-urllib3 pyOledExp git git-http ca-bundle



  • Thank you Maximilian Gerhardt

    OK I was able to fix this problem by updating:

    opkg upgrade libonioni2c pyOnionI2C
    opkg install python-light pyOledExp

    But now there is a new error

    Initializing display
    Traceback (most recent call last):
    File "main.py", line 21, in <module>
    stockList = stocks.getStocks(config["stocks"])
    File "/root/oled-stock-ticker/stocks.py", line 33, in getStocks
    return readGoogleFinance(stocksRequest.data.decode('utf-8')) # returns list of stock objects
    File "/root/oled-stock-ticker/stocks.py", line 22, in readGoogleFinance
    data = json.loads(data) # read the json
    File "/usr/lib/python2.7/json/init.py", line 339, in loads
    return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded

    I have not edited the json yet, so it should be formatted correctly.
    I'm still learning how to use python, so some of this is confusing to me.

    What should I try next to fix this error?



  • I think this new error may mean that I need to get rid of "python-light" and just have python. I found this thread about removing python so I can reinstall it:

    http://community.onion.io/topic/337/want-to-uninstall-python/11

    I'm a bit nervous about botching it up.

    If this fails is there anyway to just erase everything on the onion and start over?

    Thank you



  • OK I just did a reinstall of the console and everything. I'm using the terminal on a mac (the real one not the browser.) still getting the json error:

    Traceback (most recent call last):
    File "main.py", line 21, in <module>
    stockList = stocks.getStocks(config["stocks"])
    File "/root/oled-stock-ticker/stocks.py", line 33, in getStocks
    return readGoogleFinance(stocksRequest.data.decode('utf-8')) # returns list of stock objects
    File "/root/oled-stock-ticker/stocks.py", line 22, in readGoogleFinance
    data = json.loads(data) # read the json
    File "/usr/lib/python2.7/json/init.py", line 339, in loads
    return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded

    Really stuck at this point.



  • @Susan-Donovan I think Google has stopped / revamped the Google Finance API.
    How much longer will the Google Finance RESTFUL API function?
    Everyone hates the new look of Google Finance

    Stock Ticker is another example of "It worked at previously!" ™ @Lazar-Demin ;-)



  • Thank you. At least now I know why it isn't working maybe some rainy sunday I'll try to look into the code and fix it I have some experience pulling json data like this for other projects on ATMEGE328p and ESP8266. The Omega is almost overwhelming me with all the features and coding options, but I like it.

    I made the newsfeed work instead and will adapt that into to train time display for my husband.

    Good to know I wasn't just messing up.


Log in to reply
 

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