rshell: unexpected EOF while parsing

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

rshell: unexpected EOF while parsing

Post by ttmetro » Sun Oct 22, 2017 10:29 pm

When starting rshell six-1.11.0 on ubuntu with

Code: Select all

rshell -p /dev/ttyUSB0
I get the following error

Code: Select all

Connecting to /dev/ttyUSB0 ...
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1185, in connect
    ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/rshell", line 11, in <module>
    load_entry_point('rshell==0.0.11', 'console_scripts', 'rshell')()
  File "/usr/local/lib/python3.5/dist-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 2658, in main
    real_main()
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 2620, in real_main
    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1191, in connect
    connect_serial(port, baud=baud, wait=wait)
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1215, in connect_serial
    dev = DeviceSerial(port, baud, wait)
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1436, in __init__
    Device.__init__(self, pyb)
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1273, in __init__
    self.name = self.remote_eval(board_name, self.default_board_name())
  File "/usr/local/lib/python3.5/dist-packages/rshell/main.py", line 1353, in remote_eval
    return eval(self.remote(func, *args, **kwargs))
  File "<string>", line 0
    
    ^
SyntaxError: unexpected EOF while parsing
Same error for

Code: Select all

$ rshell
Welcome to rshell. Use Control-D to exit.
No MicroPython boards connected - use the connect command to add one
/home/ee49> connect telnet 192.168.10.104
Setup: ubuntu in VirtualBox running on top of OSX. I can connect to the (ESP32) from the pymakr atom plugin.
Bernhard Boser

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

Re: rshell: unexpected EOF while parsing

Post by pythoncoder » Mon Oct 23, 2017 12:19 pm

In a Ubuntu terminal run

Code: Select all

ls /dev/tty*
Can you see /dev/ttyUSB0? If not, there may be some magic required to ensure the virtual machine manager exposes the OSX port to Ubuntu.
Peter Hinch
Index to my micropython libraries.

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: rshell: unexpected EOF while parsing

Post by ttmetro » Mon Oct 23, 2017 3:43 pm

Yes, it shows up in ubuntu when the device is plugged in, and disappears when unplugged.
Bernhard Boser

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

Re: rshell: unexpected EOF while parsing

Post by pythoncoder » Wed Oct 25, 2017 6:34 am

Have you got a udev rule set up on the Ubuntu VM? See this post viewtopic.php?f=6&t=3843&p=22121&hilit=udev#p22121.

You also need to be a member of the dialout group - replace USER with your username
sudo usermod -a -G dialout USER

Failing the above, try running rshell as root - I'm not advocating this as a way of working but it might help diagnose permissions issues.
Peter Hinch
Index to my micropython libraries.

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: rshell: unexpected EOF while parsing

Post by ttmetro » Wed Oct 25, 2017 7:00 am

Thanks for your reply (and also libs, I use some, eg. MPU9250).

Doesn't seem a USB problem - I get the same error with 'connect telnet 192.168.10.104'. Also, pymakr (running on the ubuntu virtual machine) works.

I guess I'll need to download the rshell code and figure out what's wrong with the eval command. The SyntaxError is a bit odd. I'll report back once I get to it (for now I just use pymakr).

Bernhard
Bernhard Boser

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

Re: rshell: unexpected EOF while parsing

Post by dhylands » Sun Oct 29, 2017 2:00 pm

What device is showing up as /dev/ttyUSB0 ? Under linux, the pyboard's show up as /dev/ttyACM0

Or perhaps you're using something other than a pyboad?

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: rshell: unexpected EOF while parsing

Post by ttmetro » Sun Oct 29, 2017 3:17 pm

Device is ESP32 with SiLabs USB (Adafruit Huzzah32).

In the meantime I found the issue occurs after installing Anaconda Python 3 distribution. [Totally idiotic coincidence - Anaconda has nothing to do with the problem, see next message.] So it appears to be one of these Python version and path mix up problems.

I suppose I need to install rshell in a local directory for debugging. Just have not gotten around to it yet.

Bernhard
Last edited by ttmetro on Tue Oct 31, 2017 5:00 am, edited 1 time in total.
Bernhard Boser

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: rshell: unexpected EOF while parsing

Post by ttmetro » Tue Oct 31, 2017 4:53 am

Mystery solved: I'd defined a module "board" on my esp32 but did not define a field "board.name". Apparently (and the documentation explains this) rshell expects this name if the module board exists.

If not,

Code: Select all

self.remote(..., board_name, ('pyboard', ), {}) 
returns an empty string and the eval function called in remote_eval produces the error I was observing.

Possibly remote_eval could check the return value of self.remote before passing it to eval. But evidently I'm the only one ever running afoul of this error.

Many thanks to all who made suggestions!
Bernhard Boser

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

Re: rshell: unexpected EOF while parsing

Post by dhylands » Tue Oct 31, 2017 7:33 pm

I filed an issue in rshell so I don't forget.
https://github.com/dhylands/rshell/issues/32

Post Reply