logo

Save and Load Python scripts from the web editor

PROBLEM

The Python editor at microbit.co.uk used to save and load scripts to the cloud.

The Python editor at python.microbit.org does not allow scripts to be saved and loaded to/from the cloud.

Where have all my Python scripts gone?

Change in website to microbit.org seems to have lost my Python scripts.

How do I save and load scripts in the new microbit.org hosted Python web editor?

How do I transfer Python scripts from the microbit.co.uk website to the python.microbit.org website?

SOLUTION

As of 2nd Nov 2016, a new feature has been added to the Python web editor at python.microbit.org. You can now load Python scripts into the web editor, edit them, and save them again.

blob1478077331530.png

 

This editor uses a ‘local file system’ save and load feature. When you press the DOWNLOAD button, this will download a .hex file that contains both the MicroPython interpreter and your Python script. This is the file you flash onto your micro:bit to run the program.

You can also now press the SAVE button, and this will save just the .py Python source to a file on your local computer.

To read .py scripts back into the editor for editing, just drag them from your local filing system onto the editor window at python.microbit.org, and it will read in your script. You can then edit it, and then either SAVE it or DOWNLOAD it as normal.

Also, if you have any .hex files that were generated in any version of MicroPython (that includes scripts written originally on the microbit.co.uk Python web editor, and scripts written inside the codewith.mu offline editor), you can now just drag and drop the .hex file from your local computer filing system onto the editor window. The editor will extract the Python script from this .hex file and load it into the editor so you can change it (and re-save or re-download again later).

NOTES

1. The new Python editor at python.microbit.org does not support cloud storage like the BBC hosted Python editor did at microbit.co.uk. But you can use it without needing teacher access codes or a partner login account, because you save and load the files locally onto your own computer. If you are in a school networked environment, you can store these scripts in student folders or shared folders and manage them yourself. You can also put the .hex or the .py files in blogs or other public web pages and other users can download these files into their editor or onto their micro:bits directly.

2. The new Python editor at python.microbit.org is updated on a much faster release cycle than the editor at microbit.co.uk, and as a result of this, it has more features in it (such as the file system, speech, and singing). We recommend that you use the editor at python.microbit.org in preference to the microbit.co.uk website, as it will receive more ongoing development.

3. If you have a number of Python scripts stored in the cloud as generated by the microbit.co.uk Python editor, you can download these to .hex files and then import them into the editor at python.microbit.org by just dragging those .hex files onto the editor.

4. The python.microbit.org editor will only work with a single Python script at a time. If you want to use advanced features such as Python modules, the REPL interactive prompt, or the FILES interactive file browser, you could consider installing and using the codewith.mu offlne editor.

5. The cloud version of the Python editor hosted at microbit.co.uk will still store and retrieve any Python scripts that you have saved using your teacher or partner login account. But if you want to use the latest Python features, you can use the steps above to download .hex files and then use the new Python editor at python.microbit.org to edit them.

0 found this helpful
All for Joomla All for Webmasters