The information in this page is updated in accordance with firmware version
RUTM_R_00.07.18
.
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 RUTM10 devices.
Note:
Python is additional software that can be installed from the
System →
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".
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
codeop
fcntl
pathlib
resource
struct
unicodedata
collections
filecmp
ipaddress
rlcompleter
subprocess
unittest
antigravity
colorsys
fileinput
itertools
pickle
runpy
sunau
urllib
argparse
compileall
fnmatch
pickletools
sched
symbol
array
concurrent
formatter
keyword
pipes
secrets
symtable
configparser
fractions
linecache
pkgutil
select
asynchat
contextlib
ftplib
locale
platform
selectors
sysconfig
warnings
asyncio
contextvars
functools
logging
plistlib
shelve
syslog
asyncore
mailbox
poplib
shlex
tabnanny
weakref
atexit
copyreg
genericpath
mailcap
posix
shutil
tarfile
wsgiref
audioop
crypt
getopt
marshal
posixpath
signal
telnetlib
xdrlib
base64
getpass
pprint
tempfile
ctypes
gettext
mimetypes
profile
smtpd
termios
xmlrpc
binascii
curses
pstats
smtplib
textwrap
xxlimited
binhex
dataclasses
graphlib
modulefinder
sndhdr
xxsubtype
bisect
datetime
multiprocessing
socket
threading
zipapp
builtins
netrc
py_compile
socketserver
zipfile
decimal
hashlib
nntplib
pyclbr
timeit
zipimport
cProfile
difflib
heapq
ntpath
pydoc
sqlite3
token
calendar
nturl2path
pydoc_data
sre_compile
tokenize
zoneinfo
distutils
numbers
pyexpat
sre_constants
trace
cgitb
doctest
opcode
queue
sre_parse
traceback
chunk
email
imaplib
operator
quopri
tracemalloc
cmath
encodings
imghdr
optparse
random
statistics
turtle
errno
importlib
ossaudiodev
readline
string
types
codecs
faulthandler
inspect
parser
reprlib
stringprep
typing