Python Overview

What is Python?

Python is a high-level, interpreted programming language that is quite popular because it is simple to write, and easy to use.

Note: Python on Misty is really new, and still undergoing a ton of feature development! While you can't create a 'Skill' in Python yet, that feature is coming soon!

How Python Works on Misty

Misty currently runs Python 3.9, built for a 32 bit ARM architecture running on Windows. Misty also hosts a Python Language Server, which gives her the ability to analyze your Python scripts, providing code completion, highlighting, and syntax validation. Misty even has a Python editor that you can use to create and debug your code!

Misty's built in Python editor uses the Python runtime, Python Language Server, and a version of the Monaco editor to allow for simple Python development within Misty Studio.

To start using Python on Misty, open Misty Studio and navigate to Programming, then Python. You should see Misty's Python editor.

Python Editor

The buttons at the top of the page give you the tools necessary to start programming Misty. Here's what each of them does:

Python Editor

  • The 'New' button clears the editor window of all text
  • The 'Open' button lets you select an existing Python script to run on Misty
  • The 'Save' button lets you save your Python code to your computer
  • The templates dropdown give you some code to start with, which makes creating your first programs easier
  • The 'Load Template' button loads the contents of the selected template into the editor. Be careful, it'll replace anything currently in the editor!
  • The 'Run' button runs your script on Misty
  • The 'Stop' button stops a currently running script

Output Boxes

At the bottom of the editor, you'll see three boxes labelled 'Messages', 'Output', and 'Errors'.

Python Editor

Because Python scripts are run using the Python runtime on Misty, some of the outputs are what you'd expect to see from any shell script. The 'Output' box captures anything that your script outputs when using the Python 'print' function. These statements are reported after the script has completed execution. Similarly, the 'Errors' box captures any unhandled error produced by your script, which you'll be presented with after the completion of the script. Lastly, the 'Messages' box receives debug messages sent from your code in real time.

Note: To see how the real time messages work, try starting with the 'messaging' template.