Rshell error raspberry pi0w to esp32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
alien1983
Posts: 17
Joined: Fri Sep 07, 2018 4:52 pm

Rshell error raspberry pi0w to esp32

Post by alien1983 » Fri Sep 07, 2018 5:25 pm

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

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by dhylands » Sat Sep 08, 2018 3:29 am

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,

alien1983
Posts: 17
Joined: Fri Sep 07, 2018 4:52 pm

Re: Rshell error raspberry pi0w to esp32

Post by alien1983 » Sat Sep 08, 2018 5:58 am

there is the same error.

Screen have no connection to esp.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by pythoncoder » 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)
?
Peter Hinch
Index to my micropython libraries.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by dhylands » Sat Sep 08, 2018 6:33 pm

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.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by pythoncoder » Sun Sep 09, 2018 4:03 am

That syntax must be new for V3.5, as it fails here under V3.4.3.
Peter Hinch
Index to my micropython libraries.

alien1983
Posts: 17
Joined: Fri Sep 07, 2018 4:52 pm

Re: Rshell error raspberry pi0w to esp32

Post by alien1983 » Sun Sep 09, 2018 2:27 pm

With python 3.4 & 3.7 not work.

The best idea is reinstall raspberry pi ?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by dhylands » Mon Sep 10, 2018 2:48 am

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

alien1983
Posts: 17
Joined: Fri Sep 07, 2018 4:52 pm

Re: Rshell error raspberry pi0w to esp32

Post by alien1983 » Mon Sep 10, 2018 3:46 pm

Thx

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Rshell error raspberry pi0w to esp32

Post by dhylands » Mon Sep 10, 2018 9:39 pm

I just created and released version 0.0.15 of rshell which should address the problem.

Post Reply