Start An Interactive Python Session - Digi TX54 User Manual

Hide thumbs Also See for TX54:
Table of Contents

Advertisement

Applications
> scp host 192.168.4.1 user admin remote /home/admin/bin/test.py local
/etc/config/scripts/ to local
admin@192.168.4.1's password: adminpwd
test.py
>
c. Type exit to exit the Admin CLI.
Depending on your device configuration, you may be presented with an Access selection
menu. Type quit to disconnect from the device.
Note
You can also create scripts by using the vi command when logged in with shell access.
2. Log into the TX54 command line as a user with shell access.
Depending on your device configuration, you may be presented with an Access selection
menu. Type shell to access the device shell.
3. Use the python command to run the Python application. In the following example, the Python
application, test.py, takes 3 parameters: 120, ports and storage:
# python /etc/config/scripts/test.py 120 ports storage

Start an interactive Python session

Use the python command without specifying any parameters to start an interactive Python session.
The Python session operates interactively using REPL (Read Evaluate Print Loop) to allow you to write
Python code on the command line.
Note
The Python interactive session is not available from the Admin CLI. You must access the device
shell in order to run Python applications from the command line. See
information about configuring authentication groups that include shell access.
1. Log into the TX54 command line as a user with shell access.
Depending on your device configuration, you may be presented with an Access selection
menu. Type shell to access the device shell.
2. At the shell prompt, use the python command with no parameters to enter an interactive
Python session:
# python
Python 3.6.13 (default, May
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
3. Type Python commands at the Python prompt. For example, to view help for the digidevice
module, type:
>>> help("digidevice")
Help on package digidevice:
NAME
TX54 User Guide
Start an interactive Python session
100%
36MB
Authentication groups
9 2021, 22:49:59)
11.1MB/s
00:03
for
684

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tx64

Table of Contents