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

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

Post by KrishanCA » Tue Jan 31, 2017 5:54 am

Hi,

I am trying to replace my main.py but it seems the existing 'main.py' is operational and new versions are not being taken.
I have tried uploading new file. Removing existing file and then writing a new file. Tried reset after removing and then writing but no avail. When I read the main.py the old file text is received and the same is being executed.

How to solve this?

User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

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

Post by deshipu » Tue Jan 31, 2017 8:55 am

KrishanCA wrote:I have tried uploading new file. Removing existing file and then writing a new file.
Can you tell us what you did exactly, when you write that you have "tried" things? What tools did you use, what commands did you execute and what were the responses to those commands?

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 » Thu Feb 02, 2017 8:25 am

Here is copy of screen interaction

paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import os
=== os.listdir()
=== os.remove('main.py')
=== os.listdir()
['boot.py', 'webrepl_cfg.py', 'main.py']
['boot.py', 'webrepl_cfg.py']

reset board. There is no execution of main.py
then I send the 'main.py' using webrepl
Here is the confirmation
>>> import os
>>> os.listdir()
['boot.py', 'webrepl_cfg.py', 'main.py']
>>>
>>>
After loading the file I reset the machine, but the old ('main.py') is executed.
When I receive the file. i get the old code.

mikruth
Posts: 18
Joined: Wed Jan 11, 2017 6:00 pm

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

Post by mikruth » Thu Feb 02, 2017 10:11 am

I had this problem loading a new main.py with webrepl. Although Send a File was already populated with main.py I found I had to Choose file again and select main.py from the directory to get the new file loaded.

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 12:35 am

mikruth wrote:I had this problem loading a new main.py with webrepl. Although Send a File was already populated with main.py I found I had to Choose file again and select main.py from the directory to get the new file loaded.
I am still facing the same problem. Request you to please explain in detail how you are able to manage? I am choosing the file again every time I am trying to load. In fact it shows file as deleted and does not execute when I reboot the board without main.py. But when I copy the new main.py, it executes the deleted one.

How do we log this as a bug so that the problem is resolved?

User avatar
deshipu
Posts: 1348
Joined: Thu May 28, 2015 5:54 pm

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

Post by deshipu » Tue Feb 21, 2017 8:02 am

Are you absolutely sure you are copying the right file, and not some copy in some old directory somewhere?

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 9:05 pm

Yes,

Very sure. Now I am in a phase where In need to complete my software. I tried over 20 times yesterday.

I have firmware version is 'MicroPython v1.8.6-7-gefd0927 on 2016-11-10; ESP module with ESP8266'. Will changing firmware help?

Which version is know to not have this problem?

Also please point to link where I can report the bug.

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 9:06 pm

I am using webrepl to load the files. Is there any better way to upload the files?

User avatar
fdushin
Posts: 32
Joined: Thu Jul 21, 2016 5:38 pm

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

Post by fdushin » Tue Feb 21, 2017 9:50 pm

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)

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:09 pm

Ok. So the problem is with webrepl. Now I send to device a dummy file dummy.py and then send main.py and it works fine. At least it allows me to work for now.

Post Reply