Python Micro:bit Bitio Error语言 - microbit. repr . repr . reple



我有一个micro:bit (v1.3 B),并试图在MacBook (macOS Monterey)上使用Python bitio库。我一直在看入门部分,现在已经到了"建立联系"部分。

我已经"闪过"了。通过上传文件将十六进制文件传到micro:bit,它成功地显示了bit的徽标,如图所示。

当我运行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("rnraw REPL; CTRL-B to exitrn>", 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("rnraw REPL; CTRL-B to exitrn>", 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
>]

修复了这个问题,原来我必须给终端(或任何编辑器/IDE使用)完整的磁盘访问设置

最新更新