Trouble with MicroPython Sandbox setup on Windows

Dear Chris,

thanks for writing in and welcome to our community. We will have a look into the issues you are observing. I have deliberately amended your posts for better readability of the error messages.

With kind regards,
Andreas.

make list-serials doesn’t show that the FiPy is connected to any of the ttyS.

Dear Chris,

we’ve answered you as best we can. Let’s go through all issues step by step.

You might just want to ignore that for now unless it will cause any further problems.

The reason for this is that the command was based on bsdtar [1]:

$ tar --version
bsdtar 2.8.3 - libarchive 2.8.3

This was our fault, sorry. The codebase should get sane after invoking "git pull" on your side.

This indicates there might be a leading slash missing. So, you might want to try again using

export MCU_PORT=/dev/ttyS5
  • make list-serials should list all available ttyS without touching them at all.
  • make list-boards displays the boards connected to the respective UART, after MCU_PORT has been configured appropriately.
  • Currently, there is no such thing like "make scan-serials" to fill the gap between these two. People will have to find out by other means [2].

With kind regards,
Andreas.


  1. This recently also hit @wtf while ramping up Betrieb der Terkin-Sandbox für MicroPython auf Debian GNU/Linux 9 (stretch) oder Ubuntu 14.04.6 LTS (Trusty Tahr). Sorry that we haven’t been aware enough when putting this line into the codebase which will obviously only work on FreeBSD and macOS. Fix installation of "MicroWebSrv2" dependency · hiveeyes/terkin-datalogger@72b340b · GitHub now mitigates this problem. ↩︎

  2. Do you actually know a way how "make scan-serials" could be done from the command line? As far as I know, the Arduino IDE will make it easy for users to find the UART port their devices are attached to. Since recognizing this from other folks, I am regularly thinking about how we could replicate this kind of convenience suitable to fit into the current Make- and Python-based sandbox environment. ↩︎

Andreas,
Thank you for the rapid reply! I really appreciate it.

make setup completed (with the ownership warnings).
make install seems to make it most of the way, but after connecting to the board it cycles several times through this sequence::

.venv3/bin/rshell --port /dev/ttyS5 --user micro --password python --buffer-size 2048 --file tools/upload-sketch.rshell
Using buffer-size of 2048
Connecting to /dev/ttyS5 (buffer-size 2048)...
Trying to connect to REPL  connected
Testing if ubinascii.unhexlify exists ... Y
Retrieving root directories ... /flash/
Setting time ... Dec 02, 2019 21:16:59
Evaluating board_name ... pyboard
Retrieving time epoch ... Jan 01, 1970

Finally it ends here:

File '/home/chris/hiveeyes/sources/hiveeyes-micropython-firmware/settings.py' doesn't exist

make list-boards
starts the same set of connection messages, but hangs on

Testing if ubinascii.unhexlify exists ...

The items of this sequence will vary on their --file argument. --file tools/upload-sketch.rshell is the last upload task. Everything is fine here, the output is just rather verbose right now.

You will have to establish a local settings.py which you can derive from settings.example.py or settings.example-bob.py first. We might think about improving this situation giving better feedback to the user.

Hm. This should just work, as the communication with the board seems to be successful as uploading works. Occasionally, you might want to reset the board when experiencing hiccups.

May I humbly ask which Pycom Firmware you are running? We recommend the Dragonfly Builds [1], the setup instructions [2] – while in German – can be easily machine-translated through the translation button below the post.

image


  1. Dragonfly firmware for Pycom/ESP32 ↩︎

  2. Betrieb der Terkin-Sandbox für MicroPython unter Linux ↩︎

Andreas,
I’m running 1.20.1.r1-0.6.0-pybytes-dragonfly.

I had trouble getting the latest pycom pybytes versions to run. Forum help pointed to your project, so that is why I’m trying to set up the Terkin environment. I had to start from scratch setting up Ubuntu on WSL to get this far. Now I’m trying to figure out how to access the device itself and write code. I am guessing that Pymakr on Atom will not work when Ubuntu is running.

I’m still at the very beginning trying to figure out my first steps! I really appreciate your help!

Thanks!
Chris

1 Like

Thanks likewise for trying to use our datalogger. Just keep on asking.

Unless I hear back from you, I will assume things will gradually start working after adding an appropriate settings.py and re-running make install.

Dear Chris,

I don’t see any problems here in general. However, one has to consider which features to use from which software. The commandline-based sandbox essentially gives you full control about the uploading process and drives the whole thing getting all the sources of Terkin and its third-party packages on bord.

On the other hand, Pymakr’s main functionality is also the file synchronization feature, please correct me if I am wrong on this detail. While we already have it on our agenda [1], the Terkin repository is not prepared to be used with Pymakr with respect to the file synchronization yet.

However, I would like to work on that if that will help the community. Maybe @poesel and you are the first ones ever actually asking for it. Nevertheless, I believe also @clemens and others might like it – so: This might be just the right time to finally start working on that aspect.

Apart from that, just editing in Atom and uploading it through the Sandbox should generally work flawlessly in parallel. However, access to the REPL must be exclusive and this is also used for uploading files.

So, to get more into a possible discussion around these details: Do you also like to use the integrated REPL shell within Atom? This might well block the uploading process, so I might see your point here if you are looking into this very direction.

For my part, I am editing in Pycharm and use make recycle / make repl to access the device at runtime, solely from the commandline [2].

Coming from there, I really would love to improve Terkin’s usage from within Pymakr/Atom to add more convenience for newcomers and users who would like to work within an integrated graphical environment. I would be happy to support you if this also resonates with you.

With kind regards,
Andreas.


  1. https://github.com/hiveeyes/hiveeyes-micropython-firmware/issues/32 ↩︎

  2. The main reason why I rejected to use Pymakr/Atom altogether when starting on Pycom and Terkin was its horrible robustness, mainly recognized by others who told me about their pains. That’s why @einsiedlerkrebs and I actually started the commandline-based Sandbox these days. ↩︎

Andreas,
Yes it does seem to be working now. I have more questions, but I’ll start a new thread
Thanks!
Chris

Andreas,
I’m not locked into pymakr/atom at all. I do like atom and would use it as my editor, but I can use the command line environment once I figure it out.

One problem I have is Ubuntu on WSL. The whole file system on WSL seems to be difficult to access and getting atom to edit in that file system seems difficult. Perhaps it’s easier than I think, but I read somewhere that messing with the WSL file system with Windows tools is dangerous. Not sure why.
Perhaps I should ditch WSL and either run Ubuntu in a VM or as a dual boot.
As you have put in so much effort to create the sandbox, I would not ask you to work on pymakr/atom on my account. I’ll look into pycharm.
Thanks
Chris

This was in the past! Now is really easy. Type in the WSL Ubuntu shell

explorer.exe .

Yes, this is a Windows command and notice the dot at the end of the line. You will get the windows file explorer with the Ubuntu file system and you can securely edit your *.py files. You can also copy and paste the path in the file explorer to open a folder in Atom as a project folder!

1 Like

2 posts were merged into an existing topic: Discussing standardization efforts for the Terkin MicroPython Sandbox

Dear Chris,

Actually, this might be a low-hanging fruit by just adding an appropriate pymakr.conf to the repository root directory, see https://github.com/hiveeyes/hiveeyes-micropython-firmware/issues/32. If it can be unlocked, it might also make others happy – again looking at @clemens, @poesel and @Thias here.

While saying this, the Make-based sandbox will always be my first citizen as it offers so much more features, see also Discussing standardization efforts for the Terkin-Sandbox.

However, the commandline-based tools can always be as companions to some more integrated tooling. In order to get the Terkin-Datalogger into the hands of more people, appropriate support for the popular IDEs would probably be worth some effort. We always wanted to go into that direction, see also Einsatz der MicroPython Firmware Releases mit IDEs.

Really recommended. It builds on the superpowers coming from JetBrains/IntelliJ and has be my friend for years already. There’s even a community edition available these days from Download PyCharm: Python IDE for Professional Developers by JetBrains.

Building upon that, I always wanted to have a look at the https://plugins.jetbrains.com/plugin/9777-micropython in order to check if support for Pycom devices like mentioned within MicroPython Plugin for PyCharm | Pycom user forum will already be available and solid.

Recently, I also found GitHub - JetBrains/intellij-micropython: Plugin for MicroPython devices in PyCharm and IntelliJ so there might even be a chance of making it work if it doesn’t have Pycom support out of the box, whatever adjustments might be required for that.

With kind regards,
Andreas.

explorer.exe .

did open up Windows Explorer, but in the c:/Windows/System 32 directory. I don’t see any of the WSL file system
Thx,
Chris

Are you actually on WSL2 (Windows10) already?

You can find it on \\wsl$\Ubuntu\root

Since my previous Win10 died and I have a different backup solution I can now use WSL. I chose Debian out of habit.

Problem: make setup tries to link into the /lib-dynload/ directory but that is a file?

markus@Calvin:/mnt/c/Users/Markus/Documents/GitHub/hiveeyes-micropython-firmware$ make setup
make[1]: Entering directory '/mnt/c/Users/Markus/Documents/GitHub/hiveeyes-micropython-firmware'
make[1]: Leaving directory '/mnt/c/Users/Markus/Documents/GitHub/hiveeyes-micropython-firmware'
virtualenv --python=python3 --no-site-packages .venv3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 357, in copyfile
    os.symlink(srcpath, dest)
NotADirectoryError: [Errno 20] Not a directory: '/usr/lib/python3.7/lib-dynload/readline.cpython-37m-x86_64-linux-gnu.so' -> '/mnt/c/Users/Markus/Documents/GitHub/hiveeyes-micropython-firmware/.venv3/lib/python3.7/lib-dynload/readline.cpython-37m-x86_64-linux-gnu.so'

hmmmm, versuchst du die Sandbox im Windows-Dateisystem zu starten? /mnt/c/Users/Markus/Documents/ versuche das mal in der Linux-Domäne und lege dir dort in home was an, z.B. /home/markus/hiveeyes/sources/hiveeyes-micropython-firmware

Falls du die Dateien dort in der Windows-Umgebung mit gewohnten Windows-Tool bearbeiten möchtest geht das sehr gut mit explorer.exe . (Punkt am Ende nicht übersehen).

Läuft bei mir zumindest mit Win10 und Ubuntu unter WSL. Dann sollte das Debian pur auch können.

Also die gewohnten tools sind die von Linux… :slight_smile:

Problem lag woanders: ich muss das ganze als root ausführen.

Implizit steht das in der Doku (terkin-datalogger/sandbox-setup.rst at master · hiveeyes/terkin-datalogger · GitHub), explizit aber nicht. Ich habs natürlich als user ausgeführt. :roll_eyes:
Jetzt ist es erfolgreich durchgelaufen.

1 Like