Mu blocks writing code.py

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Catbar
 
Posts: 15
Joined: Fri Jul 13, 2018 6:14 pm

Mu blocks writing code.py

Post by Catbar »

I couldn't find this issue addressed anywhere. I think it may be a "feature" of the new beta of Mu. I get the message 'You cannot use the filename "code.py" This name is already used by another part of Python. If you use that name, things are likely to break. Please try again with a different filename.'
Mu_error.png
Mu_error.png (10.17 KiB) Viewed 232 times
One possibility: I have other versions of Python installed on my PC.

Is there something I'm missing? Thanks.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Mu blocks writing code.py

Post by adafruit_support_mike »

Try renaming the file.

Python, like most interpreted languages, has a dynamic runtime.. it loads resources from the filesystem as need demands. Apparently some piece of the system is named 'code.py', and that name conflict could make things go sideways.

User avatar
Catbar
 
Posts: 15
Joined: Fri Jul 13, 2018 6:14 pm

Re: Mu blocks writing code.py

Post by Catbar »

Yes, I'd already done the renaming via Mu, and then changed it on the Circuit Playground Express and that works. For now, that will have to do, I guess. Thanks.

User avatar
Catbar
 
Posts: 15
Joined: Fri Jul 13, 2018 6:14 pm

Re: Mu blocks writing code.py

Post by Catbar »

I tried using storage.erase_filesystem() and now I don't have the issue. I have no idea what I did to get it in the first place.

Thanks, Brian

User avatar
flybob
 
Posts: 26
Joined: Fri Dec 27, 2013 12:16 pm

Re: Mu blocks writing code.py

Post by flybob »

There appears to be an error in the tutorial here (https://learn.adafruit.com/welcome-to-c ... iting-code). Tutorial asks you to save the program as "code.py" This will generate an error. Instead save the program as "main.py" and you will be good to go.

User avatar
ntollervey
 
Posts: 5
Joined: Sun Jul 15, 2018 9:19 am

Re: Mu blocks writing code.py

Post by ntollervey »

Hi, I created and maintain Mu.

Sorry to hear you're having problems. You're right to summarise it's down to the "shadow module" checking. I'll fix this up in the Adafruit mode for the next release (which should arrive tomorrow).

Thanks,

N.

User avatar
ntollervey
 
Posts: 5
Joined: Sun Jul 15, 2018 9:19 am

Re: Mu blocks writing code.py

Post by ntollervey »

Hi,

Just a quick FYI. The issue was logged in Mu and fixed this afternoon here:

https://github.com/mu-editor/mu/issues/554

It'll be in the next release.

Thanks for the feedback. :-)

N.

User avatar
Catbar
 
Posts: 15
Joined: Fri Jul 13, 2018 6:14 pm

Re: Mu blocks writing code.py

Post by Catbar »

Thanks! Brian

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”