Applications
Start an interactive Python session
TX54 User Guide
684
> scp host 192.168.4.1 user admin remote /home/admin/bin/test.py local
/etc/config/scripts/ to local
[email protected]'s password: adminpwd
test.py
100%
36MB
11.1MB/s
00:03
>
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
for
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
9 2021, 22:49:59)
[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
Страница 1: ...TX54 User Guide Firmware version 22 2 ...
Страница 190: ...Interfaces Bridging TX54 User Guide 190 ...
Страница 293: ...Hotspot Hotspot configuration TX54 User Guide 293 ...
Страница 332: ...Hotspot Show hotspot status and statistics TX54 User Guide 332 ...
Страница 584: ...Services Simple Network Management Protocol SNMP TX54 User Guide 584 4 Click Download ...
Страница 1069: ...Command line interface Command line reference TX54 User Guide 1069 reboot Reboot the system Parameters None ...