Services and applications Python
Digi TransPort WR Routers User Guide
152
Python
TransPort devices support Python 3.5, providing the ability to run Python applications on the device,
either from a file or interactively.
You can also configure TransPort devices to automatically run Python applications when the device
restarts.
WARNING! If your Python application repeatedly writes to files or logs, it can cause
excessive wear on the flash memory. Therefore, you should design your Python scripts to
keep frequently-modified data in memory and write to files only when required.
Run a Python application at the command line
Command line
Python applications can be run from a file at the command line. The Python application will run until it
completes, displaying output and prompting for additional user input if needed. To interrupt the
application, enter CTRL-C or use the python stop command from another CLI session.
1. Upload the Python application script to the TransPort device using the Web UI File System
page or applications such Filezilla, SFTP or SCP. See Upload and download files for information
about uploading files.
2. Use the python command to run the Python application. In the following example, the Python
application, health.py, takes 3 parameters: 120, ports and storage:
digi.router> python health.py 120 ports storage
Show running Python applications
Command line
Use the show python command to list Python applications currently running on your TransPort device.
For example:
digi.router> show python
ID File Name Arguments
--------------------------------------------------------------------
4990 health.py 120 ports storage
4993 scripts/python/traffic.py 300 --quiet
6322 (interactive)
Stop a Python application
Command line
Use the python stop command to stop a running Python application.