Python 3.7 runpy.py LINE 183 in _run_module_as_main mod_name

1528 views
Skip to first unread message

IMPORTACIONES EXCLUSIVAS

unread,
Jul 24, 2019, 11:28:31 PM7/24/19
to WebIOPi
Hello

i have a RPI 3 with Raspbian Buster with desktop.  i try to run webiopi with the command line :sudo webiopi -d -c /etc/webiopi/config,  and get this error.
""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
.

i instaled last python version (3.7.4) but that dont fix the error.

What can i do?

Captura.JPG

Alex Platon

unread,
Aug 3, 2019, 3:40:53 PM8/3/19
to WebIOPi
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 function runLoop 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:

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)

neuralassembly

unread,
Aug 23, 2019, 8:46:26 AM8/23/19
to WebIOPi
I created a new patch that supports Raspbian Buster and Raspberry Pi 4.
Please see the instructions below.


Please use it until the pull request to the doublebind's one is merged.

Reply all
Reply to author
Forward
0 new messages