Despite copying a new one, old main.py is operational

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
KrishanCA
Posts: 12
Joined: Tue Jan 31, 2017 12:26 am

Re: Despite copying a new one, old main.py is operational

Post by KrishanCA » Tue Feb 21, 2017 10:12 pm

fdushin wrote:Using the webrepl console, try

Code: Select all

f = open('main.py')
print(f.read())
f.close()
and verify the file has the contents you expect it to have. (I have found that using webrepl will wrap the output, making long lines possible to read, whereas minicom will not. YMMV if you are using a different serial protocol tool (e.g., screen).

The only other thing I can think of:
  • * You accidentally uploaded a compiled main.mpy, but that would show up with os.listdir()
    * You accidentally burned main.mpy onto your image. (I have noticed that you cannot over-ride modules that are burned into firmware)
I had tried this before. Cant remember all the results of various combinations. But it looks like Webrepl is the culprit. Please see my earlier post.

User avatar
rdagger
Posts: 143
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Despite copying a new one, old main.py is operational

Post by rdagger » Tue Feb 28, 2017 6:34 pm

Just joined the forum. First day experimenting with an ESP8266. I encountered the same problem using the WebREPL client when trying to resend a modified file that I previously sent. I think the problem is that some browsers cache the uploaded file.

In FireFox (51.0.1 Windows) to resend a file, you have to click Browse and reselect the file before clicking Send to Device. Otherwise, the prior cached version is sent again.

Unfortunately, in Chrome (56.0.2924.87 Windows) the above doesn't work. It continues to send the original cached file. As KrishanCA mentioned, you can send a dummy file to clear the cache.

Not sure how other browsers behave.

Capstan
Posts: 117
Joined: Sun Jan 29, 2017 4:03 pm
Location: Texas, USA

Re: Despite copying a new one, old main.py is operational

Post by Capstan » Wed Mar 01, 2017 12:04 am

I use the adafruit ampy utility to move files to the device over the serial port. Usually works okay, though sometimes I will have to try it twice or reset the 8266 to get it to work.

https://learn.adafruit.com/micropython- ... stall-ampy

User avatar
rdagger
Posts: 143
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Despite copying a new one, old main.py is operational

Post by rdagger » Wed Mar 01, 2017 3:03 am

I saw the ampy utility but I need a network based solution. Too bad the WebREPL CLI can't be used simultaneously with the WebREPL.

I think the script just needs to be modified to clear the file input after sending or maybe place it in a form and use form reset.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Despite copying a new one, old main.py is operational

Post by Roberthh » Wed Mar 01, 2017 6:30 am

There are quiet a few methods for sending files over USB, like rshell and ampy. I use FTP with a small server embedded into the ESP. Even small, it's best to embed it into the flash. As compiled version it can run from the command line. And I do not use Webrepl, not even the CLI, which can coexist with the ftp server.
Two links to ftp. The first one can run in background, the second one runs in foreground and is much smaller. As client you can use Filezilla, FireFtp or command line ftp (not on Windows for the smaller version)
https://github.com/robert-hh/ESP8266-FTP-Server
https://github.com/cpopp/MicroFTPServer

anthony420
Posts: 2
Joined: Thu Mar 02, 2017 12:51 am

Re: Despite copying a new one, old main.py is operational

Post by anthony420 » Thu Mar 02, 2017 1:44 am

I have found the adafruit ampy utility to be a better choice for manipulating files. I've done it with the webREPL as well, but ampy just seems more solid. Easy-enough to try it.

Post Reply