Python Micro:位Bitio错误-微位,repl,repl,REPL异常:尝试接收超时

oalqel3c  于 2022-11-28  发布在  Python
关注(0)|答案(1)|浏览(205)

我有一个micro:bit(v1.3 B),我正在尝试在MacBook(macOS Monterey)上使用Python bitio library。我一直在学习入门部分,已经到了“建立连接”部分。
我已经通过上传文件将bitio.hex文件“闪现”到micro:bit,它成功地显示了bitio标志,就像here所示的那样。
当我运行python3 counter.py时,它给出了以下错误:

microbit.repl.repl.REPLException: Timeout trying to receive [
raw EPL; CTRL-B to exit
>]

完整回溯:

Traceback (most recent call last):
  File "/Users/User/Downloads/bitio-master/src/counter.py", line 3, in <module>
    import microbit
  File "/Users/User/Downloads/bitio-master/src/microbit/__init__.py", line 130, in <module>
    repl.to_raw()
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 109, in to_raw
    self.wait_repl_response()
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 143, in wait_repl_response
    self.receive("\r\nraw REPL; CTRL-B to exit\r\n>", timeout=2)
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 82, in receive
    raise REPLException("Timeout trying to receive [%s]" % buffer)
microbit.repl.repl.REPLException: Timeout trying to receive [
raw EPL; CTRL-B to exit
>]

全输出:

User@Users-Macbook-Pro src % python3 counter.py
No micro:bit has previously been detected
Scanning for serial ports
remove device, then press ENTER
scanning...
found 137 device(s)
plug in device, then press ENTER
scanning...
found 138 device(s)
found 1 new device
selected:/dev/tty.usbmodem14202
Do you want this device to be remembered? (Y/N)Y
connecting...
Traceback (most recent call last):
  File "/Users/User/Downloads/bitio-master/src/counter.py", line 3, in <module>
    import microbit
  File "/Users/User/Downloads/bitio-master/src/microbit/__init__.py", line 130, in <module>
    repl.to_raw()
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 109, in to_raw
    self.wait_repl_response()
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 143, in wait_repl_response
    self.receive("\r\nraw REPL; CTRL-B to exit\r\n>", timeout=2)
  File "/Users/User/Downloads/bitio-master/src/microbit/repl/repl.py", line 82, in receive
    raise REPLException("Timeout trying to receive [%s]" % buffer)
microbit.repl.repl.REPLException: Timeout trying to receive [
raw EPL; CTRL-B to exit
>]
xwbd5t1u

xwbd5t1u1#

修正了这个问题,原来我不得不在设置中给予终端(或者任何编辑器/IDE使用的)完全的磁盘访问权

相关问题