Hello there
I don’t know if it is me. but my code can’t import the webthings library the right way
my code:
from webthing import Property, Value, WebThingServer, SingleThing, Thing
import time
def make_thing():
print("hey1")
light = Thing(
'urn:dev:ops:my-lamp-1234',
'My Lamp',
['OnOffSwitch', 'Light'],
'A web connected lamp'
)
print("hey2")
light.add_property(
Property(
light,
'on',
Value(True),
metadata={
'@type': 'OnOffProperty',
'title': 'On/Off',
'type': 'boolean',
'description': 'Whether the lamp is turned on',
}))
print("hey3")
light.add_property(
The error code:
Traceback (most recent call last):
File "wt.py", line 1, in <module>
from webthing import Property, Value, WebThingServer, SingleThing, Thing
File "/usr/local/lib/python3.5/dist-packages/webthing/__init__.py", line 6, in <module>
from .property import Property
File "/usr/local/lib/python3.5/dist-packages/webthing/property.py", line 4, in <module>
from jsonschema import validate
File "/usr/local/lib/python3.5/dist-packages/jsonschema/__init__.py", line 56
raise AttributeError(f"module {__name__} has no attribute {name}")
^
SyntaxError: invalid syntax
Hello there I don’t know if it is me. but my code can’t import the webthings library the right way
my code:
The error code: