dhylands / rshell

Remote Shell for MicroPython
MIT License
944 stars 133 forks source link

`Retrieving root directories` fails on Mac Ventura and ESP8266 setup #204

Open petermchale opened 1 year ago

petermchale commented 1 year ago

My Mac appears to recognize /dev/cu.usbserial-0001 (an ESP8266 board) as a hostname and tries to connect to it over WiFi instead of using the USB cable. Turning off WiFi on the Mac partially solves the problem, but the following error remains. Any idea how to deal with this?

(venv) (base) Peters-Personal-MacBook-Pro:banana-car petermchale$ rshell --port /dev/cu.usbserial-0001 --debug
Debug = True
Port = /dev/cu.usbserial-0001
Baud = 115200
User = micro
Password = python
Wait = 0
List = 0
nocolor = 0
ascii = 0
Timing = 0
Quiet = 0
BUFFER_SIZE = 512
Cmd = []
Using buffer-size of 32
Connecting to /dev/cu.usbserial-0001 (buffer-size 32)...
Trying to connect to REPL  connected
Retrieving sysname ... ----- About to send 205 bytes of code to the pyboard -----
def sysname():
    try:
        import os
        return repr(os.uname().sysname)
    except:
        return repr('unknown')
output = sysname()
if output is None:
    print("None")
else:
    print(output)

-----
-----Response-----
b"'esp8266'\r\n"
-----
esp8266
Testing if ubinascii.unhexlify exists ... ----- About to send 224 bytes of code to the pyboard -----
def test_unhexlify():
    import ubinascii
    try:
        _ = ubinascii.unhexlify
        return True
    except:
        return False
output = test_unhexlify()
if output is None:
    print("None")
else:
    print(output)

-----
-----Response-----
b'True\r\n'
-----
Y
Retrieving root directories ... ----- About to send 150 bytes of code to the pyboard -----
def listdir(dirname):
    import os
    return os.listdir(dirname)
output = listdir('/')
if output is None:
    print("None")
else:
    print(output)

-----
-----Response-----
b''
-----
Traceback (most recent call last):
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1381, in connect
    ip_address = socket.gethostbyname(port)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/bin/rshell", line 33, in <module>
    sys.exit(load_entry_point('rshell==0.0.31', 'console_scripts', 'rshell')())
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/command_line.py", line 4, in main
    rshell.main.main()
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 3082, in main
    real_main()
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 3044, in real_main
    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1387, in connect
    connect_serial(port, baud=baud, wait=wait)
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1411, in connect_serial
    dev = DeviceSerial(port, baud, wait)
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1742, in __init__
    Device.__init__(self, pyb)
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1508, in __init__
    self.root_dirs = ['/{}/'.format(dir) for dir in self.remote_eval(listdir, '/')]
  File "/Users/petermchale/Desktop/iot/MicroPython-and-the-Internet-of-Things/banana-car/venv/lib/python3.9/site-packages/rshell/main.py", line 1630, in remote_eval
    return eval(self.remote(func, *args, **kwargs))
  File "<string>", line 0

SyntaxError: unexpected EOF while parsing
(venv) (base) Peters-Personal-MacBook-Pro:banana-car petermchale$