Because Python's standard library pdb module does import code:
❯ echo "this file in the Mu installation folder should not be imported" > code.py
❯ python run.py
Traceback (most recent call last):
File "/Users/microbit-carlos/workspace/carlos/mu/run.py", line 2, in <module>
from mu.app import run
File "/Users/microbit-carlos/workspace/carlos/mu/mu/app.py", line 47, in <module>
from .logic import Editor, LOG_FILE, LOG_DIR, ENCODING
File "/Users/microbit-carlos/workspace/carlos/mu/mu/logic.py", line 36, in <module>
from pyflakes.api import check
File "/Users/microbit-carlos/workspace/carlos/mu/.venv-qt6/lib/python3.10/site-packages/pyflakes/api.py", line 10, in <module>
from pyflakes import checker, __version__
File "/Users/microbit-carlos/workspace/carlos/mu/.venv-qt6/lib/python3.10/site-packages/pyflakes/checker.py", line 11, in <module>
import doctest
File "/Users/microbit-carlos/.pyenv/versions/3.10.8/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/doctest.py", line 100, in <module>
import pdb
File "/Users/microbit-carlos/.pyenv/versions/3.10.8/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pdb.py", line 77, in <module>
import code
File "/Users/microbit-carlos/workspace/carlos/mu/code.py", line 1
this file in the Mu installation folder should not be imported
^^^^
SyntaxError: invalid syntax
The bug here is that somehow the CircuitPython mode must be saving the code.py file in the Mu's cwd instead of the CIRCUITPY drive.
These other crash reports are from having the cope.py file in other directories, that are likely added to the path as well, like the "Desktop", "Downloads" or other folders:
It's very interesting that this has only happened with Mu v1.2.0, not a single crash report from earlier versions. So maybe something we accidentally introduced in the last release?
Because Python's standard library
pdb
module doesimport code
:The bug here is that somehow the CircuitPython mode must be saving the
code.py
file in the Mu's cwd instead of theCIRCUITPY
drive.Crash reports:
These other crash reports are from having the
cope.py
file in other directories, that are likely added to the path as well, like the "Desktop", "Downloads" or other folders: