Pythonista FAQ#

Note

This FAQ is work-in-progress. If you find something missing or your question is not answered, please send an email to pythonista@omz-software.com.

Which version of Python does Pythonista support?

Pythonista currently supports Python 3.10.

Up until version 3.4, Pythonista also included a Python 2.7 interpreter, but as official support for Python 2.x has ended in 2020, it has been removed in version 3.4 of Pythonista.

Which modules from the standard library work on iOS?

Most of the Python standard library “just works” in Pythonista, but there are some notable exceptions and limitations:

  • The subprocess and multiprocessing modules are present, but actually launching subprocesses will result in a PermissionError, due to the sandboxing restrictions on iOS. All scripts in Pythonista are running in the same process as the app itself.

  • The readline and curses modules are not available, as Pythonista does not include a full terminal emulation.

  • Tkinter is not supported. For building GUIs on iOS (in Pythonista), you can alternatively use the ui module. Another (cross-platform) alternative would be to build a web-based GUI using e.g. bottle or flask.

  • The turtle module is available as a custom port, but it doesn’t have full feature parity with other platforms. For most (learning) purposes, it should be sufficient though.

Does Pythonista include module X?

Please see the list of Third-Party Modules that are bundled with Pythonista.

Can I install additional modules?

If the module is “pure Python” (i.e. no compiled C/C++ code), and doesn’t depend on any other modules that aren’t available in Pythonista, it’s possible to add additional modules by simply copying the module’s files to either your script’s containing folder, or to the special “site-packages” folder that you can view by selecting “Python Modules” in the file browser.

Can I run scripts in the background?

When you run a script in Pythonista, it continues running for a certain amount of time when you put the app in the background, but the script’s execution may be suspended after the app has been in the background for about 30 seconds (the exact time may vary).

This should be enough to e.g. load a request in Safari from a web server running in Pythonista, but if you need the script to be running for longer periods of time, the app needs to be in the foreground (e.g. in split view on an iPad).

How can I pass arguments (sys.argv) to a script?

Tap and hold the run (▷) button.

Can I run scripts at specific times or triggered by other events?

On iOS 14 and later, you can add “personal automations” in the Shortcuts app to automate running scripts (or other shortcuts) when various events happen (time of day, location, specific app launched, etc.). By using a “Run Pythonista Script” action in the automated shortcut, you can run it in response to these events. Please note that scripts that run in shortcuts have certain limitations, e.g. they can’t be interactive, and the amount of memory is quite limited. See the shortcuts module documentation for more information.

For more details on setting up personal automation, please see Personal automation (Shortcuts User Guide).

How can I launch other apps from a script?

You can use the webbrowser module with custom URL schemes to launch other apps. Many system and third-party apps can be opened (and automated) with custom URL schemes.

Please note that opening URLs is not always possible when the script is running in an app extension (e.g. in the Shortcuts app).

How can I launch Pythonista from other apps?

You can use the Pythonista URL Scheme pythonista3:// to launch Pythonista from other apps and to automate certain actions, like opening or running a script.

How can I get files into Pythonista?

You can use iCloud and the Files app to get files from other devices into Pythonista.

You can also import files from the system file picker by creating a new file (“+” button in the file browser), and then selecting “Import…”.

Another option is to use the share sheet extension. When sharing a file from any app that uses the standard share sheet, you can select the “Run Pythonista Script” action (once enabled), and then select “Import File”.

Why do Pythonista’s local files not show up in the Files app?

Pythonista’s local files are stored in a special folder that is shared between the main app and the app extensions (share sheet, shortcuts, keyboard…). This allows scripts running in either of these environments to share data easily.

Unfortunately, it is not easily possible to show this folder in the Files app, as the standard integration assumes that the app’s documents are in a folder that would only be accessible by the main app. It would be possible to work around this by building a file provider extension (essentially a Files app plugin), but so far, the effort required hasn’t seemed worth it.

You can still use the Files app with Pythonista’s iCloud documents, however.

Can I use the camera in Pythonista?

You can use the photos.capture_image() function to show a camera interface and use the resulting image in your script.

Low-level access to the camera hardware (e.g. taking a picture without user interaction) is currently not supported, though you may be able to achieve this by using the objc_util module for accessing Objective-C APIs directly.

Does Pythonista support VoiceOver?

Yes, Pythonista should be fully usable with VoiceOver, though there are some limitations when working with non-textual content (e.g. the UI editor, animations, etc.), and not all sample scripts are written with VoiceOver in mind. If you are using VoiceOver, and would like to suggest improvements or report issues, please send an email to pythonista@omz-software.com.