Unable to upload project code to LoPy
I am trying to upload a LoRa project to the LoPy.
When I run something simple like
import time for i in range(10): print('hello') time.sleep(1)
the code runs flawlessly, but when I attempt to 'Upload project' I almost invariably get the following error, no matter what code I try to upload.
Connecting to COM14... Traceback (most recent call last): File "main.py", line 37, in <module> AttributeError: 'NoneType' object has no attribute 'mac' Pycom MicroPython 1.19.0.b1 [v1.9.4-28d0248d] on 2018-06-08; LoPy with ESP32 >>>
I've tried multiple different versions of the firmware with no luck. In some other versions of the firmware (including the latest 1.20.0.rc11) I get core dump errors like this:
=================CORE DUMP START ================= pEMAABQAAABsAQAA SMX/P8DC/z9Axf8/ 8MH/P+DE/z8LzQLl4Ff8P+BX/D9Ixf8/2Ff8PwUAAAD4r/8/+K//P0jF/z8AAAAA FAAAAESz/z9idHVUACHSIQAioWAYAgYAAAAAAEDF/z8AAAAAIQAGABQAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAB0dP0/3HT9P0R1/T8AAAAAAAAAAAEAAAAAAAAA FnxAPwAAAAAE2wlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM0EvQ== MIEAgPuJCUAwCQYAVosJgIDD/z8vAAAALwAAAAwAAAD/////AAAAAP7///8AAAAA YMP/PwAAAAARw/8/v8L/PzAAAAAAAAAAycL/PwUAAAAdAAAAAAAAAHDUCUB71AlA AAAAAL/C/z8wAAAArDcIQAC0/D8AAAAAAAAAAAAAAAD//z+zAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEcP/PwAAAADSSQmAoMP/P3EAAABxAAAA CAAAAP////8AAAAA/////3GBGoDAw/8//gAAAAAAAAAQAAAA/////wAAAADi//// PTocgODD/z8c//8//gAAAAAYAAAkFQAAYEP+P/n//z8aVRuAAMT/P/4AAAAU//8/ AAAAABgAAAAAGAAAmP/6P1BqHIAgxP8/1Or/P0Rk/T8cAAAATMT/P6oAAAABAAAA +h8bgHDE/z8YsP8/sMT/P01qHIBQxP8/2Ob/P3AAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAsMT/P9T7/z/AxP8/5Gn9P/Q2HEA6IBuAkMT/PwEAAAAAAAAA SMX/PwEAAAD+AAAAyK//PwAAAACwxP8/NyAbQAi6Qj8YsP8/AAAAADCz/z8BAAAA AAAAAODE/z8AAAAAAAAAAAAAAAAAAAAA5Gn9P/Q2HEAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7MT/PwAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA==
Does anyone know what's going on? Any help would be appreciated!! Thanks in advance.
@Ralph I just tried closing all the files/folders I had open and uploading and it worked! About to try uploading the code I was originally trying to upload. Thank you for the help!!
@ac113142 Aha ok, that means something went wrong with the status file on the board. It thinks your main.py file hasn't changed, but actually it has, and an old version of the main.py file is still on your board (with an error on line 37). As soon as you change something on the main.py file, save the file, then press upload, it should upload it.
Make sure you only have one project open in atom, since multi-projects can become confusing when working with pymakr and you end up uploading the wrong project. Also check that if you add or change any other files than main.py, those do get uploaded as well. If not, you might not be working in the right folder.
@ac113142 That's why i said: forget VCS/ATom pymakr for now. use ftp or the like to upload a test program. Since the dump complains about a bug in line 37, but you tried to upload a very short main.py, this upload failed. So there are two problems:
- Uploading a script
- An existing script that causes a core dump - which should not happen. If a script has a problem, it should simply stop.
@Ralph That's what it looks like... but my main.py file literally only has one line of code (the
print('hello this is a test')), and I haven't changed boot.py from whatever the default is. And it works fine if I try to run it, the error only pops up when I try to upload.
I'm just confused as to where this error is coming from.
@ac113142 Well that's very clear and expected output I would say.
'Uploading to /flash...
Reading file status
No files to upload
Upload done, resetting board...'
The above part tells you that there are no changed files to upload, so it aborts the upload and reboots the board (standard procedure, you can disable the reboot after upload in the config if you want).
Then it reboots, executes the boot.py and main.py files, as always. You clearly have an actual bug on line 36 in main.py.
@Ralph I reflashed using 1.18.2.r7 (I didn't see an r8?). Below is the output when I tried to upload
print('Hello this is a test')right after I reflashed the firmware. When I reconnect, the same line 37
AttributeError: 'NoneType' object has no attribute 'mac'pops up before I even try to upload, and again once I try to upload.
AutoConnect enabled, ignoring 'address' setting (see Global Settings) Searching for PyCom boards on serial... Connecting to COM14... >>> Uploading project (main folder)... Not safe booting, disabled in settings Uploading to /flash... Reading file status No files to upload Upload done, resetting board... OKets Jun 8 2016 00:22:57 rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff8028,len:8 load:0x3fff8030,len:1688 load:0x4009fa00,len:0 load:0x4009fa00,len:14592 entry 0x400a059c Traceback (most recent call last): File "main.py", line 37, in <module> AttributeError: 'NoneType' object has no attribute 'mac' Pycom MicroPython 1.18.2.r7 [v1.8.6-849-df9f237] on 2019-05-14; LoPy with ESP32 Type "help()" for more information. >>>
The core dump only seems to happen if I'm using 1.20.0.rc11.
@robert-hh I've been trying to upload using the alternative methods you described, just having issues getting things installed due to being on a work machine.
hi @ac113142, the error you are posting looks like it's right after connecting to your device. It says 'connecting to com14..' and then an error from file "main.py", line 37. So it's just started up and reporting an error in your main.py code. .
Can you post the output when you are connected to the board, stopped all running code (just to be sure for this test) and then hit 'upload'?
The core dump is never a good thing, usually means there is some low level bug. I've seen that happen when running a ton of things at the same time and the board running out of memory. But keep in mind 1.20.0.rc11 is the unstable release, so try it on the stable 1.18.2.r8 first.
robert-hh last edited by robert-hh
@ac113142 Did you try to upload using other tools? Like ftp or ampy from adafruit? Or rshell from Dave Hylands (https://github.com/dhylands/rshell). Or pyboard.py from Damien George, the creator of Micropython? (https://github.com/micropython/micropython/blob/master/tools/pyboard.py). The latter three also upload via USB.
@robert-hh I've tried uploading a script with just
print('hello')with the same result. The LoRa code I'm trying to upload has about 20 lines of code.
robert-hh last edited by robert-hh
@ac113142 What is the size of the python scripts you try to upload? Line of code for instance.
@robert-hh I've been using pymakr in VSC. I'll try out a different tool. I'm not sure I understand what you mean by your first question?
@ac113142 said in Unable to upload project code to LoPy:
both 1.18.2.r7 (master branch) and 1.20.0.rc11 are sufficiently recent. There is a 1.18.2.r8 and 1.20.0.rc12, but the difference may not matter. Two further questions:
Which size has the code you try to upload?
Did you try to upload the code using basic methods like ftp (FileZilla) or tools like ampy or rshell. I try to sort out side effects caused by pymakr and Atom/VSC.
>>> uos.uname() (sysname='LoPy', nodename='LoPy', release='1.18.2.r7', version='v1.8.6-849-df9f237 on 2019-05-14', machine='LoPy with ESP32', lorawan='1.0.2')
When I use the Pycom Firmware Update tool I have to manual download the tar.gz files because of a work proxy that blocks my connection to the update server. Is 1.20.0.rc11 actually the most recent version?
@ac113142 You should use a recent firmware. What is the output of:
You mention having tried several firmware versions. But
Pycom MicroPython 1.19.0.b1 [v1.9.4-28d0248d] on 2018-06-08; LoPy with ESP32
is not a recent firmware.