Page 1 of 1

Rshell error raspberry pi0w to esp32

Posted: Fri Sep 07, 2018 5:25 pm
by alien1983
Connect by Screen to esp32 micropython is ok (raspberry pi0W =>> esp32 via usb )

But by rshell it not work:/


root@raspberrypi:/home/pi/esp# rshell --buffer-size=30 -p /dev/ttyU
SB0
Traceback (most recent call last):
File "/usr/local/bin/rshell", line 9, in <module>
load_entry_point('rshell==0.0.14', 'console_scripts', 'rshell')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 356, in loa
d_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2476, in lo
ad_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2190, in lo
ad
['__name__'])
File "/usr/local/lib/python3.4/dist-packages/rshell/command_line.py", li
ne 1, in <module>
import rshell.main
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 508
wrapper.extra_funcs = [*funcs]
^
SyntaxError: can use starred expression only as
assignment target

Re: Rshell error raspberry pi0w to esp32

Posted: Sat Sep 08, 2018 3:29 am
by dhylands
You can't use screen and rshell at the same time to connect to a MicroPython board. You need to quite out of screen and then use rshell,

Re: Rshell error raspberry pi0w to esp32

Posted: Sat Sep 08, 2018 5:58 am
by alien1983
there is the same error.

Screen have no connection to esp.

Re: Rshell error raspberry pi0w to esp32

Posted: Sat Sep 08, 2018 4:54 pm
by pythoncoder
alien1983 wrote:
Fri Sep 07, 2018 5:25 pm
...
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 508
wrapper.extra_funcs = [*funcs]
^
SyntaxError: can use starred expression only as
assignment target
@dhylands Dave, that line of code looks suspect to me. Should it read

Code: Select all

    wrapper.extra_funcs = list(funcs)
?

Re: Rshell error raspberry pi0w to esp32

Posted: Sat Sep 08, 2018 6:33 pm
by dhylands
pythoncoder wrote:
Sat Sep 08, 2018 4:54 pm
alien1983 wrote:
Fri Sep 07, 2018 5:25 pm
...
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 508
wrapper.extra_funcs = [*funcs]
^
SyntaxError: can use starred expression only as
assignment target
@dhylands Dave, that line of code looks suspect to me. Should it read

Code: Select all

    wrapper.extra_funcs = list(funcs)
?
I created this little test program:

Code: Select all

#!/usr/bin/env python3

import inspect

def extra_funcs(*funcs):
    """Decorator which adds extra functions to be downloaded to the pyboard."""
    def extra_funcs_decorator(real_func):
        def wrapper(*args, **kwargs):
          return real_func(*args, **kwargs)
        wrapper.extra_funcs = [*funcs]
        wrapper.source = inspect.getsource(real_func)
        wrapper.name = real_func.__name__
        return wrapper
    return extra_funcs_decorator

def foo1():
    print('foo1')

def foo2():
    print('foo2')

@extra_funcs(foo1, foo2)
def bar():
    print('bar')

def test_func(func):
    if hasattr(func, 'extra_funcs'):
        print('test_func: extra_funcs =', func.extra_funcs)
    else:
        print('test_func: no extra_funcs')

test_func(bar)
and it seems to work either way for me (using python 3.6.5) and my Raspberry Pi (running Python 3.5.3)

I did a bit of searching and it appears that prior to 3.5.0 this syntax wasn't allowed. And using the `list(funcs)` variant works properly under python2, so I'll go ahead and change it.

Re: Rshell error raspberry pi0w to esp32

Posted: Sun Sep 09, 2018 4:03 am
by pythoncoder
That syntax must be new for V3.5, as it fails here under V3.4.3.

Re: Rshell error raspberry pi0w to esp32

Posted: Sun Sep 09, 2018 2:27 pm
by alien1983
With python 3.4 & 3.7 not work.

The best idea is reinstall raspberry pi ?

Re: Rshell error raspberry pi0w to esp32

Posted: Mon Sep 10, 2018 2:48 am
by dhylands
The quickest way would be to edit the file with the error and change the [*funcs] to list(funcs) i.e. Change:

Code: Select all

wrapper.extra_funcs = [*funcs]
to be:

Code: Select all

wrapper.extra_funcs = list(funcs)
The file to edit was mentioned in the error: /usr/local/lib/python3.4/dist-packages/rshell/main.py line 508

Re: Rshell error raspberry pi0w to esp32

Posted: Mon Sep 10, 2018 3:46 pm
by alien1983
Thx

Re: Rshell error raspberry pi0w to esp32

Posted: Mon Sep 10, 2018 9:39 pm
by dhylands
I just created and released version 0.0.15 of rshell which should address the problem.