Page 1 of 2

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

Posted: Tue Jan 31, 2017 5:54 am
by KrishanCA
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?

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

Posted: Tue Jan 31, 2017 8:55 am
by deshipu
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?

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

Posted: Thu Feb 02, 2017 8:25 am
by KrishanCA
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.

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

Posted: Thu Feb 02, 2017 10:11 am
by mikruth
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.

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

Posted: Tue Feb 21, 2017 12:35 am
by KrishanCA
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?

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

Posted: Tue Feb 21, 2017 8:02 am
by deshipu
Are you absolutely sure you are copying the right file, and not some copy in some old directory somewhere?

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

Posted: Tue Feb 21, 2017 9:05 pm
by KrishanCA
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.

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

Posted: Tue Feb 21, 2017 9:06 pm
by KrishanCA
I am using webrepl to load the files. Is there any better way to upload the files?

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

Posted: Tue Feb 21, 2017 9:50 pm
by fdushin
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)

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

Posted: Tue Feb 21, 2017 10:09 pm
by KrishanCA
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.