bablokb / cp-shell

Command-Shell for UART-only CircuitPython Devices (Port of rshell)
0 stars 0 forks source link

not installing correctly on MacOS with python 3.11 #1

Open UnexpectedMaker opened 4 days ago

UnexpectedMaker commented 4 days ago

I followed the instructions in the install section, but when I try to run cpshell I get the following...

seon@seon-m2-max-studio cp-shell % cpshell
No module named 'cpshell.commands'
Traceback (most recent call last):
  File "/Users/seon/.pyenv/versions/3.11.9/bin/cpshell", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/seon/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cpshell/main.py", line 229, in main
    run(main_options)
  File "/Users/seon/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cpshell/main.py", line 183, in run
    from .cmdshell import CmdShell
  File "/Users/seon/.pyenv/versions/3.11.9/lib/python3.11/site-packages/cpshell/cmdshell.py", line 24, in <module>
    from .commands.command import Command
ModuleNotFoundError: No module named 'cpshell.commands'
seon@seon-m2-max-studio cp-shell % 
bablokb commented 4 days ago

Thanks for the error-report. Since I neither have a Mac, nor a python 3.11 installation, It is hard to tell for me what the problem is.

Could you try to switch to the cloned directory and directly run

python3 -m cpshell.main
UnexpectedMaker commented 4 days ago

While python3 -m cpshell.main gets me further, it's not connecting to any board I plug in that has a serial port.

seon@seons-m2-max-mbp-2 cp-shell % python3 -m cpshell.main connect /dev/cu.usbmodem101

No boards connected - use the connect command to add one

/Users/seon/cp-shell>
seon@seons-m2-max-mbp-2 cp-shell % 

Here's the same port with mpremote:

seon@seons-m2-max-mbp-2 cp-shell % mpremote connect /dev/cu.usbmodem101 
Connected to MicroPython at /dev/cu.usbmodem101
Use Ctrl-] or Ctrl-x to exit this shell

>>> 
>>> 
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:

Hello from TinyC6!
------------------

Memory Info - gc.mem_free()
---------------------------
332752 Bytes

Flash - os.statvfs('/')
---------------------------
Size: 6196224 Bytes
Free: 6189056 Bytes

Pixel Time!

Traceback (most recent call last):
  File "code.py", line 45, in <module>
KeyboardInterrupt: 

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.0.0-alpha.5-5-g64f6db113d-dirty on 2023-11-17; TinyC6 with ESP32C6
>>> 
bablokb commented 3 days ago

Hm... Try running:

python3 -m cpshell.main -d
connect /dev/cu.usbmodem101

(the second command is from within the cpshell). Even if your invocation would work, it would just start cpshell, do the connect and then finish again.

Alternatively, try

python3 -m cpshell.main -d -p /dev/cu.usbmodem101

You can also pass the -w wait-time-in-seconds option (I never needed that). And it will fail if any other program uses the serial line (sometimes happens to me if I keep my terminal program open).