User`s guide
361
Entity
Instance
Parameter
Values
Equivalent Web Parameter
ScriptBasic script
Examples
To set User parameter 1 to IPv4 address 10.1.1.1, enter the command:
basic 0 string1 10.1.1.1
To execute a script from the CLI, enter the command:
bas <myscript.sb>
To kill a running script from the CLI, enter the command:
Basic 0 kill
Python Applications
Configuration – Application > Python
Python Files
Configuration – Application > Python > Python Files
Some of the Digi TransPort routers support the Python scripting language which gives users
the facility to extend and enhance the basic functionality of the router. The routers contain a
Python interpreter which may be invoked from the command line. This can be 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”, e.g. “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.
Module search path
The parameter in this text entry box sets the search path for Python modules that are not in
the default search path. Multiple locations may be specified by separating pathnames with
colons, e.g. “pymod1.zip:python21.zip”. This will cause the interpreter to search for the two
compressed files pymod1.zip and python21.zip. Note that TransPort routers have a flat filing
system structure that does not support subdirectories.
Redirect the Python output to debug
When checked, this checkbox allows the redirection of the stdout file handle to the debug
output (stderr) file handle. The default state of this parameter is “Off”. The easiest way to
see this in action is to issue the command to start the Python interpreter from a debug/CLI
terminal and 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.
Related CLI Commands
Entity
Instance
Parameter
Values
Equivalent Web Parameter
pycfg 0 modpath
valid search path,
e.g. “mymod.py”
Module search path
pycfg 0 stderr2stdout
0,1
0 = Off
1 = On
Redirect the Python output to
debug