Having Trouble Understanding Thonny File System

580 views
Skip to first unread message

Steve Lawson

unread,
Apr 15, 2022, 4:47:22 PM4/15/22
to thonny
When developing on Win10, I'm used to New'ing a file on my D: Drive [I reserve my C: drive for operating system stuff].  Then I edit it in an editor or an IDE, then compile and lode HEX into an MCU.

But, this is a new paradigm for me: the files reside on the device, right?  But, how do you achieve version control?  If the active file [i.e. the file I'm actually editing] resides on the device [e.g. ESP32/NodeMCU/Raspberry Pi Zero/etc.], then I would like there to be a mirrored copy on my Win10 file system [i.e. "local file"], with some kind of version control.

In my attempts to achieve something like this, I can't figure out what causes a local file to get loaded into the device [I'm currently playing with a NodeMCU].  What command(s)/action(s) result in, for instance, a local boot.py file to get loaded into my NodeMCU?  Same with a local main.py file?  I see that both can exist in the Thonny IDE, one had square braces around it ("[filename]"), what does that mean, etc.?

Aivar Annamaa

unread,
Apr 18, 2022, 3:25:27 AM4/18/22
to thonny
Hi!

The square braces around filename indicate the file is "remote", ie. on the remote Linux system or on the MicroPython MCU. 

The ability to directly edit remote files is mostly meant for beginners. If you want version control then it makes sense to keep the "master copy" of your code in local files and transfer the code to the target device when you are ready to test it. Note that Thonny allows running local files on target device without creating a remote file -- when you press F5, it simply sends the unnamed content of current editor over SSH or serial connection for execution. When you are happy with the code, you'll want to transfer the code into a file on the target device. You can use either "File => Save copy as" or you can open the file browser (View => Files), navigate to desired local and target directories, right-click on the source file(s) and select "Upload to ...".

Best regards,
Aivar

Reply all
Reply to author
Forward
0 new messages