Manage Python Applications - Digi TransPort WR11 User Manual

Hide thumbs Also See for TransPort WR11:
Table of Contents

Advertisement

Managing applications and programs

Manage Python applications

Some Digi TransPort routers support the Python scripting language. Python allows you to extend and
enhance the basic functionality of the router through programming. The routers contain a Python
interpreter you can invoke from the command line. This is useful for developing scripts. The more
usual way to use Python is to write a script to implement a required function and to run this script
autonomously. It is common practice for Python scripts to use the file extension .py, such as
myscript.py. A Python script is a text file containing Python commands and may be created using a
normal plain text editor. Python is a powerful language and obtains some of its power from the many
modules that are available for it. A description of the Python language is outside the scope of this
manual. For more information on Python programming see the
www.digi.com.
CAUTION! Avoid writing Python scripts, or taking any other kind of actions, that perform
frequent flash writing. NAND flash typically accommodates a limited number of writes, up to
100,000. Exceeding this limit can cause device failure.
É
  Web
1. Go to Applications > Python > Python Files.
2. Enter the Python file management settings as needed:
Module search path
The search path for Python modules that are not in the default search path. Specify multiple
locations by separating pathnames with colons, such as pymod1.zip:python21.zip. This
causes the interpreter to search for two compressed files pymod1.zip and python21.zip.
TransPort routers have a flat filing system structure that does not support subdirectories.
Redirect the Python output to debug
Allows the redirection of the stdout file handle to the debug output (stderr) file handle. The
default for this parameter is Off. The easiest way to see this redirection in action is to issue
the command to start the Python interpreter from a debug/CLI terminal. Note that the screen
remains blank. Stop the interpreter (using the exit() command), set this parameter to On, and
re-issue the command to start the interpreter. This time, the familiar Python welcome
message and prompt should appear on the console.
Digi TransPort® Routers User Guide
Manage Python applications
Digi Python Programmer's Guide
on
825

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents