Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

PyPortal stopped reloading on code.py change
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PyPortal stopped reloading on code.py change

by robodude666 on Tue Jan 25, 2022 9:00 pm

Howdy,

I've been having a lot of fun with my new PyPortal the last few days. Last night it suddenly disconnected from PuTTY and now will no longer reload when code.py is changed (or frankly any file). It also doesn't respond to Ctrl+C or Ctrl+D, though it does show print output. It's worth noting that previously it would show up as COM3 and now it's COM5 in Device Manager.

It does pick up the new code when the reset button is pressed or USB power is applied. I know the USB cable is good as it's from a USB 2.5" HDD; plus the PyPortal does see the new code on hard reset.

The bootloader is flashed with update-bootloader-pyportal_m4-v3.14.0.uf2 and I'm running circuitpython adafruit-circuitpython-pyportal-en_US-7.1.1.uf2.

I've attempted re-flashing the bootloader and circuit python, but neither seemed to help.

The contents of boot_out.txt are as follows:

Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 7.1.1 on 2022-01-14;
Adafruit PyPortal with samd51j20
Board ID:pyportal


-robodude666

robodude666
 
Posts: 120
Joined: Sun Mar 28, 2010 12:12 am

Re: PyPortal stopped reloading on code.py change

by bludin on Wed Jan 26, 2022 2:42 am

can you re-activate it with
Code: Select all | TOGGLE FULL SIZE
import supervisor
supervisor.enable_autoreload()
?
Or maybe
Code: Select all | TOGGLE FULL SIZE
supervisor.set_next_code_file(...)
will fix it temporarily at least. See https://circuitpython.readthedocs.io/en/latest/shared-bindings/supervisor/index.html

bludin
 
Posts: 78
Joined: Thu Apr 16, 2020 8:57 am

Re: PyPortal stopped reloading on code.py change

by danhalbert on Wed Jan 26, 2022 9:01 am

Try erasing and reformatting CIRCUITPY from the REPL:
Code: Select all | TOGGLE FULL SIZE
import storage
storage.erase_filesystem()

Save any files you don't have copies of of, if you can.

danhalbert
 
Posts: 3173
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal stopped reloading on code.py change

by robodude666 on Wed Jan 26, 2022 9:04 pm

Got it working, thanks!

I reset the file system, then uploaded my code.py file and auto-reload still wasn't working. So I reset it again and tried modifying the Hello World file and it worked.

I eventually realized that the try...catch I had inside my while True loop was interfering with the reload mechanism.

robodude666
 
Posts: 120
Joined: Sun Mar 28, 2010 12:12 am

Re: PyPortal stopped reloading on code.py change

by tannewt on Thu Jan 27, 2022 2:27 pm

Ah yes. CTRL-C and auto-reload both use exceptions to exit the running program. You can catch them with a blanket try/except. Thanks for letting us know that was the issue.

tannewt
 
Posts: 2906
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.