Pip3 install webthing

(Rick Rickanderson) #1

So I’m not sure what I’m doing wrong. Does webthing for python work with python3?

I have the latest Raspberry PI Image. I install the webthing api for python3 with:
sudo pip3 install webthing

I run python3 from the terminal then enter:
`import webthing’

Then get the following error:

>>> import webthing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "webthing.py", line 1, in <module>
    from webthing import (Action, Event, Property, SingleThing, Thing, Value, WebThingServer)
ImportError: cannot import name Action

(Michael Stegeman) #2

Yes, the library works just fine with Python 3. It appears the issue is that when you’re importing webthing, you’re actually importing your own script named webthing.py. Therefore, when that script in turn tries to import webthing, it’s actually looking at itself.

(Rick Rickanderson) #3

Thank you very much. Confirmed. I was doing that and it works fine for python3 and raspberry pi.