uPyLoader - simple file transfer and communication

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Sat Jun 17, 2017 8:59 pm

THANK YOU THANK YOU THANK YOU THANK YOU !!! This is sooooooo much better than ampy !! I can't thank you enough.

I haven't tried the bytecode setup yet, will do that next.

Few minor comments:
- would be nice to remember my com port, every time I disconnect it goes back to com3 and if I try to connect there instead of the real com it hangs
- would be nice if the "MCU name" filled in automatically if you select just one file. Then you could use the "transfer" button instead of opening the file to start the transfer. (Hmmm, now it started doing it, so not sure why it didn't before?? Anyway, ignore this one)

eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Sun Jun 18, 2017 1:15 am

Interesting, so I grabbed the mpy-cross.exe from @Roberthh (Thanks Robert!!!!) and it worked great (after I grabed the pycom version, which I'm not familiar with but I guess my nodeMCU is running the pycom version?). But, I learned that you can't use it for main.py. So is the best way to just put a dummy main.py on the board that imports main_secondary.py and runs it?

Sorta like the sketch from Spinal Tap where they were the "originals" until they found out another band was the "originals", and then they were the "new originals" :lol:

UPDATE: Ok, duh. Just have one line in main.py: "import main_too" and put my old main.py into main_too.py (and compile to main_too.mpy)

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uPyLoader - simple file transfer and communication

Post by pythoncoder » Mon Jun 19, 2017 7:24 am

eradicatore wrote:...Just have one line in main.py: "import main_too" and put my old main.py into main_too.py (and compile to main_too.mpy)
That is generally the best way to work (whether or not you cross-compile). You debug your module at the REPL and then amend the one-line main.py when you want it to auto-run. If you need to disable auto-run just comment out the single line.
Peter Hinch
Index to my micropython libraries.

eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Mon Jun 19, 2017 1:13 pm

pythoncoder wrote:
eradicatore wrote:...Just have one line in main.py: "import main_too" and put my old main.py into main_too.py (and compile to main_too.mpy)
That is generally the best way to work (whether or not you cross-compile). You debug your module at the REPL and then amend the one-line main.py when you want it to auto-run. If you need to disable auto-run just comment out the single line.
I have been doing it a slightly different way. I get to the REPL by checking a gpio input to break out of my main loop. But this is a good idea you have here too. And sounds like rshell is something I should check out ASAP. Thanks!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: uPyLoader - simple file transfer and communication

Post by pythoncoder » Mon Jun 19, 2017 3:44 pm

Dave Hylands' rshell is so good I've long believed it should be recommended in the official documentation. The proliferation of utilities of varying quality is potentially confusing. I use rshell exclusively on ESP8266 and Pyboards.
Peter Hinch
Index to my micropython libraries.

eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Mon Jun 19, 2017 4:03 pm

pythoncoder wrote:Dave Hylands' rshell is so good I've long believed it should be recommended in the official documentation. The proliferation of utilities of varying quality is potentially confusing. I use rshell exclusively on ESP8266 and Pyboards.
Fair enough. I lived with the frustration that is Ampy (from adafruit) for a month before I totally stumbled upon uPyLoader yesterday out of trying to debug why Ampy all of the sudden just wasn't working. I had looked several times for better tools, but didn't like ESPloader or the others I found recommendations for. So yes, I agree something should be updated to help people find these newer tools of rshell and uPyLoader. :)

User avatar
c.man
Posts: 21
Joined: Thu Jul 06, 2017 9:12 pm

Re: uPyLoader - simple file transfer and communication

Post by c.man » Fri Jul 07, 2017 1:10 pm

hi,
i launch the script by:

python3 main.py

but I have this message error:

Traceback (most recent call last):
File "main.py", line 12, in <module>
from src.code_edit_dialog import CodeEditDialog
File "/home/carmine/Scaricati/uPyLoader-master/src/code_edit_dialog.py", line 11, in <module>
from src.setting import Settings
File "/home/carmine/Scaricati/uPyLoader-master/src/setting.py", line 1, in <module>
from json import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'


why ?

eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Fri Jul 07, 2017 3:54 pm

I'm not sure why you can't import that module. You might want to just start up a python REPL prompt (just type "python3" or "python") and then when you get the >>> prompt try typing:

from json import JSONDecodeError

That's the line that's breaking for you. Maybe also try "import json" at the python command line? I don't think you have to install json specially. I tried "pip install json" and it gave an error.

Note, the author (Ivan) of uPyLoader has created a downloadable exe which should avoid having to install any dependencies like you're running into issues with here. Go here:

https://github.com/BetaRavener/uPyLoade ... tag/v0.1.1

There are a lot of new updates I helped with, so I definitely recommend getting this latest version.

User avatar
c.man
Posts: 21
Joined: Thu Jul 06, 2017 9:12 pm

Re: uPyLoader - simple file transfer and communication

Post by c.man » Fri Jul 07, 2017 4:51 pm

Hi,
thank you for reply.
I work in Ubuntu 14.04 (not windows system). I tried so:
a) In python Repl:

from json import JSONDecodeError

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'JSONDecodeError'

b) import json

and is all ok.

c) I tried also "sudo pip install json" but I have:

The directory '/home/carmine/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/carmine/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting json
Downloading json-99.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-pb87v7h0/json/setup.py", line 2, in <module>
raise RuntimeError("Package 'json' must not be downloaded from pypi")
RuntimeError: Package 'json' must not be downloaded from pypi

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pb87v7h0/json/

eradicatore
Posts: 52
Joined: Thu Apr 20, 2017 9:19 pm

Re: uPyLoader - simple file transfer and communication

Post by eradicatore » Fri Jul 07, 2017 5:30 pm

Well I'm remote on my phone so can't test but if you want try to do this:

sudo pip install simplejson

And then change that import to simplejson:

from simplejson import JSONDecodeError

Post Reply