-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError("'NoneType' object isn't iterable",) #80
Comments
It's hard to read without indentation... I think you need at least one 'yield' or 'yield from' in the handler functions (index(req, resp)) to make them a generator. Additional: you used the function name 'index' twice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ERROR:picoweb:30.000 <HTTPRequest object at 3fffd830> <Stream object at 3fffd4a0> TypeError("'NoneType' object isn't iterable",)
Traceback (most recent call last):
File "/lib/picoweb/init.py", line 206, in _handle
TypeError: 'NoneType' object isn't iterable
{'ir': 'S'}
here is my code
`import picoweb
def qs_parse(qs):
parameters = {}
ampersandSplit = qs.split("&")
for element in ampersandSplit:
equalSplit = element.split("=")
parameters[equalSplit[0]] = equalSplit[1]
return parameters
app = picoweb.WebApp(name)
@app.route("/move")
def index(req, resp):
try:
cmd = {x[0] : x[1] for x in [x.split("=") for x in req.qs[1:].split("&") ]}
print(cmd)
'''
if cmd == 'F': robot.forward()
if cmd == 'B': robot.backward()
if cmd == 'L': robot.turnleft()
if cmd == 'R': robot.turnright()
if cmd == 'S': robot.stop()
'''
except: pass
@app.route("/action")
def index(req, resp):
try:
cmd = qs_parse(req.qs)['type']
if cmd == '1': robot.beep(20)
except: pass
import ulogging as logging
logging.basicConfig(level=logging.INFO)
app.run(host='0.0.0.0', port=80)
`
The text was updated successfully, but these errors were encountered: