I have a problem when i download my code

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
chaoz
Posts: 1
Joined: Sat Dec 07, 2019 9:40 am

I have a problem when i download my code

Post by chaoz » Thu Dec 12, 2019 11:50 am

I have a problem when I download my code
The file can be downloaded but not run successfully. I download and run on upycraft. But when I disconnect, the code doesn't run.
the shell shows

Ready to download this file,please wait!
....
download ok
exec(open('blink.py').read(),globals()) /*Every time it gets stuck here, unless I stop it*/
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 13, in <module>
KeyboardInterrupt:

English is not my native language. Please forgive me if there is something wrong with the words.Thank you!

User avatar
MostlyHarmless
Posts: 166
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: I have a problem when i download my code

Post by MostlyHarmless » Fri Dec 13, 2019 4:51 am

chaoz wrote:
Thu Dec 12, 2019 11:50 am
exec(open('blink.py').read(),globals()) /*Every time it gets stuck here, unless I stop it*/
What is the content of blink.py?


Regards, Jan

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: I have a problem when i download my code

Post by jimmo » Mon Dec 16, 2019 1:33 am

MicroPython only runs main.py at startup.

When you click the run button in uPyCraft, it runs blink.py for you, but on startup you have to tell it.

The easiest thing to do is add "import blink" to the top of main.py.

Post Reply