Quiquoqua48
Posts: 1
Joined: Tue Jul 02, 2019 9:03 am

Installazione Webiopi

Tue Jul 02, 2019 9:05 am

Salve a tutti, sto cercando di installare webiopi, sembra filare tutto liscio ma quando lancio il comando webiopi -h ricevo questo errore:

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.7/dist-packages/WebIOPi-0.7.1-py3.7-linux-armv7l.egg/webiopi/__init__.py", line 20, in <module>
    from webiopi.utils.thread import runLoop
  File "/usr/local/lib/python3.7/dist-packages/WebIOPi-0.7.1-py3.7-linux-armv7l.egg/webiopi/utils/thread.py", line 36
    def runLoop(func=None, async=False):
                               ^
SyntaxError: invalid syntax
Che posso fare?

alexplaton
Posts: 1
Joined: Sat Aug 03, 2019 7:45 pm

Re: Installazione Webiopi

Sat Aug 03, 2019 7:49 pm

It seems to be caused by the fact that async is (now?) a reserved keyword and can't be used as a variable name.
I was able to get webiopi to start by replacing the variable name async with async_ in the functionrunLoop in the file /usr/local/lib/python3.7/dist-packages/WebIOPi-0.7.1-py3.7-linux-armv6l.egg/webiopi/utils/thread.py . Function runLoop now looks like this:

Code: Select all

def runLoop(func=None, async_=False):
    global RUNNING
    RUNNING = True
    signal.signal(signal.SIGINT, stop)
    signal.signal(signal.SIGTERM, stop)

    if func != None:
        if async_:
            TASKS.append(Task(func, True))
        else:
            while RUNNING:
                func()
    else:
        while RUNNING:
            time.sleep(1)

Return to “Italiano”