Template:Networking rutos manual python: Difference between revisions
Gytispieze (talk | contribs) m (Text replacement - "\{\{Template: Networking_rutos_manual_fw_disclosure (.*) (.*) (.*) (.*) \}\}" to "{{Template: Networking_device_manual_fw_disclosure | series = {{{series}}} | name = {{{name}}} | fw_version ={{Template: Networking_device_manual_latest_fw | series = {{{series}}} | name = {{{name}}} }} }}") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template: | {{Template: Networking_device_manual_fw_disclosure | ||
| fw_version ={{Template: | | series = {{{series}}} | ||
| name = {{{name}}} | |||
| fw_version ={{Template: Networking_device_manual_latest_fw | |||
| series = {{{series}}} | | series = {{{series}}} | ||
| name = {{{name}}} | | name = {{{name}}} | ||
}} | }} | ||
}} | }} | ||
__TOC__ | |||
==Summary== | ==Summary== | ||
<b>Python</b> is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. | <b>Python</b> is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. | ||
Teltonika <b>Python3</b> package uses Python version <b>3.9.7</b>. The list of all modules included in the package can be found bellow. | |||
---- | ---- | ||
This manual page provides an overview of | This manual page provides an overview of Python3 functionality in {{{name}}} devices. | ||
<b> | <b>Note:</b> Python is additional software that can be installed from the <b>System → [[{{{name}}} Package Manager|Package Manager]]</b> page. | ||
< | |||
<span style="color:#d33">'''Disclaimer: before installing Python3 package make sure that the target device has a sufficient amount of free storage space!!!'''</span> | <span style="color:#d33">'''Disclaimer: before installing Python3 package make sure that the target device has a sufficient amount of free storage space!!!'''</span> | ||
== | ==Python3 Usage== | ||
After installing the package a new command will become available in [[Command_Line_Interfaces_RutOS|CLI (Command-line interface)]] which enables the device to invoke Python scripts or program files and allows access to the Python interpreter interface. | After installing the package a new command will become available in [[Command_Line_Interfaces_RutOS|CLI (Command-line interface)]] which enables the device to invoke Python scripts or program files and allows access to the Python interpreter interface. | ||
Line 111: | Line 93: | ||
root@Teltonika-RUTXXX:~# | root@Teltonika-RUTXXX:~# | ||
</pre> | </pre> | ||
==Python3 Modules== | |||
<table class="nd-othertables"> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">abc</td> | |||
<td style="width: 200px; font-weight: normal;">codeop</td> | |||
<td style="width: 200px; font-weight: normal;">fcntl</td> | |||
<td style="width: 200px; font-weight: normal;">io</td> | |||
<td style="width: 200px; font-weight: normal;">pathlib</td> | |||
<td style="width: 200px; font-weight: normal;">resource</td> | |||
<td style="width: 200px; font-weight: normal;">struct</td> | |||
<td style="width: 200px; font-weight: normal;">unicodedata</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">aifc</td> | |||
<td style="width: 200px; font-weight: normal;">collections</td> | |||
<td style="width: 200px; font-weight: normal;">filecmp</td> | |||
<td style="width: 200px; font-weight: normal;">ipaddress</td> | |||
<td style="width: 200px; font-weight: normal;">pdb</td> | |||
<td style="width: 200px; font-weight: normal;">rlcompleter</td> | |||
<td style="width: 200px; font-weight: normal;">subprocess</td> | |||
<td style="width: 200px; font-weight: normal;">unittest</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">antigravity</td> | |||
<td style="width: 200px; font-weight: normal;">colorsys</td> | |||
<td style="width: 200px; font-weight: normal;">fileinput</td> | |||
<td style="width: 200px; font-weight: normal;">itertools</td> | |||
<td style="width: 200px; font-weight: normal;">pickle</td> | |||
<td style="width: 200px; font-weight: normal;">runpy</td> | |||
<td style="width: 200px; font-weight: normal;">sunau</td> | |||
<td style="width: 200px; font-weight: normal;">urllib</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">argparse</td> | |||
<td style="width: 200px; font-weight: normal;">compileall</td> | |||
<td style="width: 200px; font-weight: normal;">fnmatch</td> | |||
<td style="width: 200px; font-weight: normal;">json</td> | |||
<td style="width: 200px; font-weight: normal;">pickletools</td> | |||
<td style="width: 200px; font-weight: normal;">sched</td> | |||
<td style="width: 200px; font-weight: normal;">symbol</td> | |||
<td style="width: 200px; font-weight: normal;">uu</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">array</td> | |||
<td style="width: 200px; font-weight: normal;">concurrent</td> | |||
<td style="width: 200px; font-weight: normal;">formatter</td> | |||
<td style="width: 200px; font-weight: normal;">keyword</td> | |||
<td style="width: 200px; font-weight: normal;">pipes</td> | |||
<td style="width: 200px; font-weight: normal;">secrets</td> | |||
<td style="width: 200px; font-weight: normal;">symtable</td> | |||
<td style="width: 200px; font-weight: normal;">uuid</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">ast</td> | |||
<td style="width: 200px; font-weight: normal;">configparser</td> | |||
<td style="width: 200px; font-weight: normal;">fractions</td> | |||
<td style="width: 200px; font-weight: normal;">linecache</td> | |||
<td style="width: 200px; font-weight: normal;">pkgutil</td> | |||
<td style="width: 200px; font-weight: normal;">select</td> | |||
<td style="width: 200px; font-weight: normal;">sys</td> | |||
<td style="width: 200px; font-weight: normal;">venv</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">asynchat</td> | |||
<td style="width: 200px; font-weight: normal;">contextlib</td> | |||
<td style="width: 200px; font-weight: normal;">ftplib</td> | |||
<td style="width: 200px; font-weight: normal;">locale</td> | |||
<td style="width: 200px; font-weight: normal;">platform</td> | |||
<td style="width: 200px; font-weight: normal;">selectors</td> | |||
<td style="width: 200px; font-weight: normal;">sysconfig</td> | |||
<td style="width: 200px; font-weight: normal;">warnings</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">asyncio</td> | |||
<td style="width: 200px; font-weight: normal;">contextvars</td> | |||
<td style="width: 200px; font-weight: normal;">functools</td> | |||
<td style="width: 200px; font-weight: normal;">logging</td> | |||
<td style="width: 200px; font-weight: normal;">plistlib</td> | |||
<td style="width: 200px; font-weight: normal;">shelve</td> | |||
<td style="width: 200px; font-weight: normal;">syslog</td> | |||
<td style="width: 200px; font-weight: normal;">wave</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">asyncore</td> | |||
<td style="width: 200px; font-weight: normal;">copy</td> | |||
<td style="width: 200px; font-weight: normal;">gc</td> | |||
<td style="width: 200px; font-weight: normal;">mailbox</td> | |||
<td style="width: 200px; font-weight: normal;">poplib</td> | |||
<td style="width: 200px; font-weight: normal;">shlex</td> | |||
<td style="width: 200px; font-weight: normal;">tabnanny</td> | |||
<td style="width: 200px; font-weight: normal;">weakref</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">atexit</td> | |||
<td style="width: 200px; font-weight: normal;">copyreg</td> | |||
<td style="width: 200px; font-weight: normal;">genericpath</td> | |||
<td style="width: 200px; font-weight: normal;">mailcap</td> | |||
<td style="width: 200px; font-weight: normal;">posix</td> | |||
<td style="width: 200px; font-weight: normal;">shutil</td> | |||
<td style="width: 200px; font-weight: normal;">tarfile</td> | |||
<td style="width: 200px; font-weight: normal;">wsgiref</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">audioop</td> | |||
<td style="width: 200px; font-weight: normal;">crypt</td> | |||
<td style="width: 200px; font-weight: normal;">getopt</td> | |||
<td style="width: 200px; font-weight: normal;">marshal</td> | |||
<td style="width: 200px; font-weight: normal;">posixpath</td> | |||
<td style="width: 200px; font-weight: normal;">signal</td> | |||
<td style="width: 200px; font-weight: normal;">telnetlib</td> | |||
<td style="width: 200px; font-weight: normal;">xdrlib</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">base64</td> | |||
<td style="width: 200px; font-weight: normal;">csv</td> | |||
<td style="width: 200px; font-weight: normal;">getpass</td> | |||
<td style="width: 200px; font-weight: normal;">math</td> | |||
<td style="width: 200px; font-weight: normal;">pprint</td> | |||
<td style="width: 200px; font-weight: normal;">site</td> | |||
<td style="width: 200px; font-weight: normal;">tempfile</td> | |||
<td style="width: 200px; font-weight: normal;">xml</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">bdb</td> | |||
<td style="width: 200px; font-weight: normal;">ctypes</td> | |||
<td style="width: 200px; font-weight: normal;">gettext</td> | |||
<td style="width: 200px; font-weight: normal;">mimetypes</td> | |||
<td style="width: 200px; font-weight: normal;">profile</td> | |||
<td style="width: 200px; font-weight: normal;">smtpd</td> | |||
<td style="width: 200px; font-weight: normal;">termios</td> | |||
<td style="width: 200px; font-weight: normal;">xmlrpc</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">binascii</td> | |||
<td style="width: 200px; font-weight: normal;">curses</td> | |||
<td style="width: 200px; font-weight: normal;">glob</td> | |||
<td style="width: 200px; font-weight: normal;">mmap</td> | |||
<td style="width: 200px; font-weight: normal;">pstats</td> | |||
<td style="width: 200px; font-weight: normal;">smtplib</td> | |||
<td style="width: 200px; font-weight: normal;">textwrap</td> | |||
<td style="width: 200px; font-weight: normal;">xxlimited</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">binhex</td> | |||
<td style="width: 200px; font-weight: normal;">dataclasses</td> | |||
<td style="width: 200px; font-weight: normal;">graphlib</td> | |||
<td style="width: 200px; font-weight: normal;">modulefinder</td> | |||
<td style="width: 200px; font-weight: normal;">pty</td> | |||
<td style="width: 200px; font-weight: normal;">sndhdr</td> | |||
<td style="width: 200px; font-weight: normal;">this</td> | |||
<td style="width: 200px; font-weight: normal;">xxsubtype</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">bisect</td> | |||
<td style="width: 200px; font-weight: normal;">datetime</td> | |||
<td style="width: 200px; font-weight: normal;">grp</td> | |||
<td style="width: 200px; font-weight: normal;">multiprocessing</td> | |||
<td style="width: 200px; font-weight: normal;">pwd</td> | |||
<td style="width: 200px; font-weight: normal;">socket</td> | |||
<td style="width: 200px; font-weight: normal;">threading</td> | |||
<td style="width: 200px; font-weight: normal;">zipapp</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">builtins</td> | |||
<td style="width: 200px; font-weight: normal;">dbm</td> | |||
<td style="width: 200px; font-weight: normal;">gzip</td> | |||
<td style="width: 200px; font-weight: normal;">netrc</td> | |||
<td style="width: 200px; font-weight: normal;">py_compile</td> | |||
<td style="width: 200px; font-weight: normal;">socketserver</td> | |||
<td style="width: 200px; font-weight: normal;">time</td> | |||
<td style="width: 200px; font-weight: normal;">zipfile</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">bz2</td> | |||
<td style="width: 200px; font-weight: normal;">decimal</td> | |||
<td style="width: 200px; font-weight: normal;">hashlib</td> | |||
<td style="width: 200px; font-weight: normal;">nntplib</td> | |||
<td style="width: 200px; font-weight: normal;">pyclbr</td> | |||
<td style="width: 200px; font-weight: normal;">spwd</td> | |||
<td style="width: 200px; font-weight: normal;">timeit</td> | |||
<td style="width: 200px; font-weight: normal;">zipimport</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">cProfile</td> | |||
<td style="width: 200px; font-weight: normal;">difflib</td> | |||
<td style="width: 200px; font-weight: normal;">heapq</td> | |||
<td style="width: 200px; font-weight: normal;">ntpath</td> | |||
<td style="width: 200px; font-weight: normal;">pydoc</td> | |||
<td style="width: 200px; font-weight: normal;">sqlite3</td> | |||
<td style="width: 200px; font-weight: normal;">token</td> | |||
<td style="width: 200px; font-weight: normal;">zlib</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">calendar</td> | |||
<td style="width: 200px; font-weight: normal;">dis</td> | |||
<td style="width: 200px; font-weight: normal;">hmac</td> | |||
<td style="width: 200px; font-weight: normal;">nturl2path</td> | |||
<td style="width: 200px; font-weight: normal;">pydoc_data</td> | |||
<td style="width: 200px; font-weight: normal;">sre_compile</td> | |||
<td style="width: 200px; font-weight: normal;">tokenize</td> | |||
<td style="width: 200px; font-weight: normal;">zoneinfo</td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">cgi</td> | |||
<td style="width: 200px; font-weight: normal;">distutils</td> | |||
<td style="width: 200px; font-weight: normal;">html</td> | |||
<td style="width: 200px; font-weight: normal;">numbers</td> | |||
<td style="width: 200px; font-weight: normal;">pyexpat</td> | |||
<td style="width: 200px; font-weight: normal;">sre_constants</td> | |||
<td style="width: 200px; font-weight: normal;">trace</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">cgitb</td> | |||
<td style="width: 200px; font-weight: normal;">doctest</td> | |||
<td style="width: 200px; font-weight: normal;">http</td> | |||
<td style="width: 200px; font-weight: normal;">opcode</td> | |||
<td style="width: 200px; font-weight: normal;">queue</td> | |||
<td style="width: 200px; font-weight: normal;">sre_parse</td> | |||
<td style="width: 200px; font-weight: normal;">traceback</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">chunk</td> | |||
<td style="width: 200px; font-weight: normal;">email</td> | |||
<td style="width: 200px; font-weight: normal;">imaplib</td> | |||
<td style="width: 200px; font-weight: normal;">operator</td> | |||
<td style="width: 200px; font-weight: normal;">quopri</td> | |||
<td style="width: 200px; font-weight: normal;">ssl</td> | |||
<td style="width: 200px; font-weight: normal;">tracemalloc</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">cmath</td> | |||
<td style="width: 200px; font-weight: normal;">encodings</td> | |||
<td style="width: 200px; font-weight: normal;">imghdr</td> | |||
<td style="width: 200px; font-weight: normal;">optparse</td> | |||
<td style="width: 200px; font-weight: normal;">random</td> | |||
<td style="width: 200px; font-weight: normal;">stat</td> | |||
<td style="width: 200px; font-weight: normal;">tty</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">cmd</td> | |||
<td style="width: 200px; font-weight: normal;">enum</td> | |||
<td style="width: 200px; font-weight: normal;">imp</td> | |||
<td style="width: 200px; font-weight: normal;">os</td> | |||
<td style="width: 200px; font-weight: normal;">re</td> | |||
<td style="width: 200px; font-weight: normal;">statistics</td> | |||
<td style="width: 200px; font-weight: normal;">turtle</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">code</td> | |||
<td style="width: 200px; font-weight: normal;">errno</td> | |||
<td style="width: 200px; font-weight: normal;">importlib</td> | |||
<td style="width: 200px; font-weight: normal;">ossaudiodev</td> | |||
<td style="width: 200px; font-weight: normal;">readline</td> | |||
<td style="width: 200px; font-weight: normal;">string</td> | |||
<td style="width: 200px; font-weight: normal;">types</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
<tr> | |||
<td style="width: 200px; font-weight: normal;">codecs</td> | |||
<td style="width: 200px; font-weight: normal;">faulthandler</td> | |||
<td style="width: 200px; font-weight: normal;">inspect</td> | |||
<td style="width: 200px; font-weight: normal;">parser</td> | |||
<td style="width: 200px; font-weight: normal;">reprlib</td> | |||
<td style="width: 200px; font-weight: normal;">stringprep</td> | |||
<td style="width: 200px; font-weight: normal;">typing</td> | |||
<td style="width: 200px; font-weight: normal;"></td> | |||
</tr> | |||
</table> | |||
[[Category:{{{name}}} Services section]] | [[Category:{{{name}}} Services section]] |
Latest revision as of 11:09, 24 October 2023
The information in this page is updated in accordance with firmware version .
Summary
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.
Teltonika Python3 package uses Python version 3.9.7. The list of all modules included in the package can be found bellow.
This manual page provides an overview of Python3 functionality in {{{name}}} devices.
Note: Python is additional software that can be installed from the System → [[{{{name}}} Package Manager|Package Manager]] page.
Disclaimer: before installing Python3 package make sure that the target device has a sufficient amount of free storage space!!!
Python3 Usage
After installing the package a new command will become available in CLI (Command-line interface) which enables the device to invoke Python scripts or program files and allows access to the Python interpreter interface.
To invoke a Python script or program file use the command python <python_file> and replace <python_file> with the relative or absolute path to the Python script or program file.
root@Teltonika-RUTXXX:~# python /test_py.py Hello world!
Alternatively, using just the command python will let you enter the interpreter and write and execute your code there.
root@Teltonika-RUTXXX:~# python Python 3.9.7 (default, Mar 23 2023, 08:32:35) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print("Hello world!") Hello world! >>>
For more information on how to use python command use the command python --help in the device's CLI and for how to use Python interpreter use the command help() in the Python interpreter interface.
root@Teltonika-RUTXXX:~# python --help
root@Teltonika-RUTXXX:~# python Python 3.9.7 (default, Mar 23 2023, 08:32:35) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> help() Welcome to Python 3.9's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.9/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help>
To exit the Python interpreter interface and return to device's CLI use the command exit() or quit().
root@Teltonika-RUTXXX:~# python Python 3.9.7 (default, Mar 23 2023, 08:32:35) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit() root@Teltonika-RUTXXX:~#
root@Teltonika-RUTXXX:~# python Python 3.9.7 (default, Mar 23 2023, 08:32:35) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> quit() root@Teltonika-RUTXXX:~#
Python3 Modules
abc | codeop | fcntl | io | pathlib | resource | struct | unicodedata |
aifc | collections | filecmp | ipaddress | pdb | rlcompleter | subprocess | unittest |
antigravity | colorsys | fileinput | itertools | pickle | runpy | sunau | urllib |
argparse | compileall | fnmatch | json | pickletools | sched | symbol | uu |
array | concurrent | formatter | keyword | pipes | secrets | symtable | uuid |
ast | configparser | fractions | linecache | pkgutil | select | sys | venv |
asynchat | contextlib | ftplib | locale | platform | selectors | sysconfig | warnings |
asyncio | contextvars | functools | logging | plistlib | shelve | syslog | wave |
asyncore | copy | gc | mailbox | poplib | shlex | tabnanny | weakref |
atexit | copyreg | genericpath | mailcap | posix | shutil | tarfile | wsgiref |
audioop | crypt | getopt | marshal | posixpath | signal | telnetlib | xdrlib |
base64 | csv | getpass | math | pprint | site | tempfile | xml |
bdb | ctypes | gettext | mimetypes | profile | smtpd | termios | xmlrpc |
binascii | curses | glob | mmap | pstats | smtplib | textwrap | xxlimited |
binhex | dataclasses | graphlib | modulefinder | pty | sndhdr | this | xxsubtype |
bisect | datetime | grp | multiprocessing | pwd | socket | threading | zipapp |
builtins | dbm | gzip | netrc | py_compile | socketserver | time | zipfile |
bz2 | decimal | hashlib | nntplib | pyclbr | spwd | timeit | zipimport |
cProfile | difflib | heapq | ntpath | pydoc | sqlite3 | token | zlib |
calendar | dis | hmac | nturl2path | pydoc_data | sre_compile | tokenize | zoneinfo |
cgi | distutils | html | numbers | pyexpat | sre_constants | trace | |
cgitb | doctest | http | opcode | queue | sre_parse | traceback | |
chunk | imaplib | operator | quopri | ssl | tracemalloc | ||
cmath | encodings | imghdr | optparse | random | stat | tty | |
cmd | enum | imp | os | re | statistics | turtle | |
code | errno | importlib | ossaudiodev | readline | string | types | |
codecs | faulthandler | inspect | parser | reprlib | stringprep | typing |
[[Category:{{{name}}} Services section]]