Problem getting rshell.py to run on linux mint 17.3
Problem getting rshell.py to run on linux mint 17.3
I'm having trouble getting rshell to run on linux mint 17.3. I am reasonably confident that I have python3 installed (i.e. if I type python3 on the console, I get the following output ...Python 3.4.3 (default, Oct 14 2015, 20:28:29) ...) I installed pyserial using the following sudo pip3 install pyserial. However when I try and start rshell.py I get the following output, Any suggestions on what to do next? It is my gut feeling that it is something to do with pyserial or the serial connection..
Traceback (most recent call last):
File "./rshell.py", line 2222, in <module>
main()
File "./rshell.py", line 2203, in main
autoscan()
File "./rshell.py", line 224, in autoscan
if is_micropython_usb_device(port):
File "./rshell.py", line 156, in is_micropython_usb_device
if port['ID_BUS'] != 'usb' or port['SUBSYSTEM'] != 'tty':
File "/usr/local/lib/python3.4/dist-packages/serial/tools/list_ports_common.py", line 83, in __getitem__
raise IndexError('{} > 2'.format(index))
IndexError: ID_BUS > 2
Traceback (most recent call last):
File "./rshell.py", line 2222, in <module>
main()
File "./rshell.py", line 2203, in main
autoscan()
File "./rshell.py", line 224, in autoscan
if is_micropython_usb_device(port):
File "./rshell.py", line 156, in is_micropython_usb_device
if port['ID_BUS'] != 'usb' or port['SUBSYSTEM'] != 'tty':
File "/usr/local/lib/python3.4/dist-packages/serial/tools/list_ports_common.py", line 83, in __getitem__
raise IndexError('{} > 2'.format(index))
IndexError: ID_BUS > 2
Re: Problem getting rshell.py to run on linux mint 17.3
Thanks for the report.
I've just pushed a new version that should address that particular issue for you. You may run into additional issues. if you do, please let me know.
EDIT: It looks like your linux is using a newer version of pyserial than I tested with.
I made a few changes that I think will fix the issue.
I've just pushed a new version that should address that particular issue for you. You may run into additional issues. if you do, please let me know.
EDIT: It looks like your linux is using a newer version of pyserial than I tested with.
I made a few changes that I think will fix the issue.
Re: Problem getting rshell.py to run on linux mint 17.3
Progress, but not quite there yet..
This is the output from ./test-shell.sh. Note that I have tested the version from "https://github.com/dhylands/rshell"
Testing ./rshell-test
Connecting to /dev/ttyACM0 ...
Traceback (most recent call last):
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2223, in <module>
main()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2204, in main
autoscan()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 226, in autoscan
connect_serial(port[0])
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 987, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 1163, in __init__
pyb = pyboard.Pyboard(port, baudrate=baud)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/pyboard.py", line 126, in __init__
self.serial = serial.Serial(device, baudrate=baudrate, interCharTimeout=1)
TypeError: __init__() got an unexpected keyword argument 'interCharTimeout'
Traceback (most recent call last):
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2223, in <module>
main()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2204, in main
autoscan()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 226, in autoscan
connect_serial(port[0])
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 987, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 1163, in __init__
pyb = pyboard.Pyboard(port, baudrate=baud)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/pyboard.py", line 126, in __init__
self.serial = serial.Serial(device, baudrate=baudrate, interCharTimeout=1)
TypeError: __init__() got an unexpected keyword argument 'interCharTimeout'
/dev/ttyACM0 - FAIL
(similar output if I just run ./rshell.py)
1) What is the best way to test the code, currently I am running ./test-shell.py with a working pyboard plugged into the usb. Is that the best way to proceed?
2) Is there anything I can do to assist in the debug? I dunno, like check the versions of python librarys on my system?
This is the output from ./test-shell.sh. Note that I have tested the version from "https://github.com/dhylands/rshell"
Testing ./rshell-test
Connecting to /dev/ttyACM0 ...
Traceback (most recent call last):
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2223, in <module>
main()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2204, in main
autoscan()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 226, in autoscan
connect_serial(port[0])
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 987, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 1163, in __init__
pyb = pyboard.Pyboard(port, baudrate=baud)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/pyboard.py", line 126, in __init__
self.serial = serial.Serial(device, baudrate=baudrate, interCharTimeout=1)
TypeError: __init__() got an unexpected keyword argument 'interCharTimeout'
Traceback (most recent call last):
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2223, in <module>
main()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 2204, in main
autoscan()
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 226, in autoscan
connect_serial(port[0])
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 987, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/rshell.py", line 1163, in __init__
pyb = pyboard.Pyboard(port, baudrate=baud)
File "/home/skelton/Projects/Python/PyBoard/rshell-master/pyboard.py", line 126, in __init__
self.serial = serial.Serial(device, baudrate=baudrate, interCharTimeout=1)
TypeError: __init__() got an unexpected keyword argument 'interCharTimeout'
/dev/ttyACM0 - FAIL
(similar output if I just run ./rshell.py)
1) What is the best way to test the code, currently I am running ./test-shell.py with a working pyboard plugged into the usb. Is that the best way to proceed?
2) Is there anything I can do to assist in the debug? I dunno, like check the versions of python librarys on my system?
Re: Problem getting rshell.py to run on linux mint 17.3
Your latest problem looks like an issue with pyboard.py (which rshell.py uses) and pyserial. I'll definitely take a look.
The old pyserial was written for 2.7 and mostly works under 3.0. I found the new pyserial here:
https://github.com/pyserial/pyserial.git
It looks like Mint is using the new pyserial (I saw list_ports_common.py in your original call stack - and that file doesn't even exist in the old pyserial).
Actually, it looks like all I had to do was: and it installed the new pyserial library, and I can now reproduce your problem.
The old pyserial was written for 2.7 and mostly works under 3.0. I found the new pyserial here:
https://github.com/pyserial/pyserial.git
It looks like Mint is using the new pyserial (I saw list_ports_common.py in your original call stack - and that file doesn't even exist in the old pyserial).
Actually, it looks like all I had to do was:
Code: Select all
sudo pip3 install --upgrade pyserial
Re: Problem getting rshell.py to run on linux mint 17.3
It looks like its a bug in pyserial.
A commit to fix it (in the new pyserial) was just posted a couple days ago, but it hasn't made it out to the PyPI servers yet.
I did a quick hack to pyboard.py that allows it to work with the new pyserial. I commited it to my new rshell repository here:
https://github.com/dhylands/rshell
EDIT: It seems I forgot to push the new pyboard.py - now fixed
A commit to fix it (in the new pyserial) was just posted a couple days ago, but it hasn't made it out to the PyPI servers yet.
I did a quick hack to pyboard.py that allows it to work with the new pyserial. I commited it to my new rshell repository here:
https://github.com/dhylands/rshell
EDIT: It seems I forgot to push the new pyboard.py - now fixed
Re: Problem getting rshell.py to run on linux mint 17.3
Yes works for me now. Thanks, I appreciate the effort you have put into sorting this.
Re: Problem getting rshell.py to run on linux mint 17.3
Having had rshell working once, I now can't seem to get it to connect to /dev/ACM0
I'm using rshell version 0.0.4, the latest version of pyserial (I did pip3 install --upgrade pyserial). I'm using
MicroPython v1.6-72-g53fec1e on 2016-02-20; PYBLITEv1.0 with STM32F411RE (but I suppose that the pyboard firmware is unlikely to cause the problem).. I can get the repl prompt if I do
sudo screen /dev/ttyACM0
but if I detach and do the following
sudo rshell
Connecting to /dev/ttyACM0 ... <it hangs for a while and then throws the following>
b' '
Traceback (most recent call last):
File "/usr/local/bin/rshell", line 9, in <module>
load_entry_point('rshell==0.0.4', 'console_scripts', 'rshell')()
File "/usr/local/lib/python3.4/dist-packages/rshell/command_line.py", line 4, in main
rshell.main.main()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 2363, in main
real_main()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 2332, in real_main
autoscan()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 287, in autoscan
connect_serial(port[0])
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1056, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1272, in __init__
Device.__init__(self, pyb)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1102, in __init__
self.has_buffer = self.remote_eval(test_buffer)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1193, in remote_eval
return eval(self.remote(func, *args, **kwargs))
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1171, in remote
self.pyb.enter_raw_repl()
File "/usr/local/lib/python3.4/dist-packages/rshell/pyboard.py", line 187, in enter_raw_repl
raise PyboardError('could not enter raw repl')
rshell.pyboard.PyboardError: could not enter raw repl
Any ideas?
I'm using rshell version 0.0.4, the latest version of pyserial (I did pip3 install --upgrade pyserial). I'm using
MicroPython v1.6-72-g53fec1e on 2016-02-20; PYBLITEv1.0 with STM32F411RE (but I suppose that the pyboard firmware is unlikely to cause the problem).. I can get the repl prompt if I do
sudo screen /dev/ttyACM0
but if I detach and do the following
sudo rshell
Connecting to /dev/ttyACM0 ... <it hangs for a while and then throws the following>
b' '
Traceback (most recent call last):
File "/usr/local/bin/rshell", line 9, in <module>
load_entry_point('rshell==0.0.4', 'console_scripts', 'rshell')()
File "/usr/local/lib/python3.4/dist-packages/rshell/command_line.py", line 4, in main
rshell.main.main()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 2363, in main
real_main()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 2332, in real_main
autoscan()
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 287, in autoscan
connect_serial(port[0])
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1056, in connect_serial
dev = DeviceSerial(port, baud, wait)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1272, in __init__
Device.__init__(self, pyb)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1102, in __init__
self.has_buffer = self.remote_eval(test_buffer)
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1193, in remote_eval
return eval(self.remote(func, *args, **kwargs))
File "/usr/local/lib/python3.4/dist-packages/rshell/main.py", line 1171, in remote
self.pyb.enter_raw_repl()
File "/usr/local/lib/python3.4/dist-packages/rshell/pyboard.py", line 187, in enter_raw_repl
raise PyboardError('could not enter raw repl')
rshell.pyboard.PyboardError: could not enter raw repl
Any ideas?
Re: Problem getting rshell.py to run on linux mint 17.3
You need to not just detech from screen, but make sure that the session is killed. Otherwise screen still has /dev/ttyACM0 open and some of the characters from the pyboard will go to screen and some will go to rshell. Needless to say this will cause problems.
You can check if anybody has /dev/ttyACM0 open by using the command: (note that lsof can take a while depending on your machine).
You can check if anybody has /dev/ttyACM0 open by using the command:
Code: Select all
lsof | grep ttyACM0
Re: Problem getting rshell.py to run on linux mint 17.3
Thanks, that was exactly the problem. Works now.
(but if you have to run screen as sudo remember to use the command sudo lsof | grep ttyACM0, else you just seem to get a blank return)
(but if you have to run screen as sudo remember to use the command sudo lsof | grep ttyACM0, else you just seem to get a blank return)