问题描述:
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
ERROR thonny.plugins.micropython.backend: Crash in backend
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 136, in __init__
self._prepare_after_soft_reboot(clean)
File "C:\Users\Administrator\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 155, in _prepare_after_soft_reboot
self._execute_without_output(script)
File "C:\Users\Administrator\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 589, in _execute_without_output
raise ManagementError(script, out, err)
thonny.plugins.micropython.backend.ManagementError: Problem with a management command
SCRIPT:
class __thonny_*er:
import builtins
try:
import uos as os
except builtins.ImportError:
import os
import sys
# for object inspector
inspector_values = builtins.dict()
@builtins.clas*ethod
def print_repl_value(cls, obj):
global _
if obj is not None:
cls.builtins.print('[object_link_for_thonny=%d]' % cls.builtins.id(obj), cls.builtins.repr(obj), '', sep='')
_ = obj
@builtins.clas*ethod
def print_mgmt_value(cls, obj):
cls.builtins.print('', cls.builtins.repr(obj), '', sep='', end='')
@builtins.clas*ethod
def repr(cls, obj):
try:
s = cls.builtins.repr(obj)
if cls.builtins.len(s) > 50:
s = s[:50] + "..."
ret*n s
except cls.builtins.Exception as e:
ret*n ""
@builtins.clas*ethod
def listdir(cls, x):
if cls.builtins.hasattr(cls.os, "listdir"):
ret*n cls.os.listdir(x)
else:
ret*n [rec[0] for rec in cls.os.ilistdir(x) if rec[0] not in ('.', '..')]
@builtins.clas*ethod
def getcwd(cls):
if cls.builtins.hasattr(cls, "getcwd"):
ret*n cls.os.getcwd()
else:
# micro:bit
ret*n ""
@builtins.clas*ethod
def chdir(cls, x):
ret*n cls.os.chdir(x)
@builtins.clas*ethod
def rmdir(cls, x):
ret*n cls.os.rmdir(x)
STDOUT:
STDERR:
Traceback (most recent call last):
File "", line 2, in
File "", line 8, in __thonny_*er
ImportError: no module named 'sys'
Backend terminated or disconnected. Use 'Stop/Restart' to restart.