Category     

NCOS: SDK NCOS 6.1.0 Modules

« Go Back

Information

 
Content

Although the routers (as of NCOS 6.1) are running Python 3.3, the files in /usr/lib/python3.3 is a subset of the standard modules you'll find on your development PC.

Modules included, use freely

  • __future__ - [https://docs.python.org/3.5/library/__future__.html Future statement definitions]: * abc - [https://docs.python.org/3/library/abc.html Abstract Base Classes]: as outlined in PEP 3119
  • argparse - [https://docs.python.org/3/library/argparse.html Parser for command-line options, arguments and sub-commands]: parse arguments out of sys.argv
  • base64 - [https://docs.python.org/3/library/base64.html Base16, Base32, Base64, Base85 Data Encodings]: 
  • bisect- [https://docs.python.org/3/library/bisect.html Array bisection algorithm]: 
  • calendar - [https://docs.python.org/3/library/calendar.html General calendar-related functions]: add days to a date, leap years, and so on
  • cgi - [https://docs.python.org/3/library/cgi.html Common Gateway Interface support]: 
* chunk - [https://docs.python.org/3/library/chunk.html Read IFF chunked data]: Audio Interchange File Format (AIFF/AIFF-C) and the Real Media File Format (RMFF)
* cmd - [https://docs.python.org/3/library/cmd.html Support for line-oriented command interpreters]: 
* code - [https://docs.python.org/3/library/code.html Interpreter base classes]: 
* codecs - [https://docs.python.org/3/library/codecs.html Codec registry and base classes]:
* codeop - [https://docs.python.org/3/library/codeop.html Compile Python code]: 
* collections - [https://docs.python.org/3/library/collections.html Container datatypes]: complex data types, such as linked lists, ordered keyed data, etc
* configparser - [https://docs.python.org/3/library/configparser.html Configuration file parser]: parse ".INI" file
* contextlib - [https://docs.python.org/3/library/contextlib.html Utilities for with-statement contexts]: 
* copy - [https://docs.python.org/3/library/copy.html Shallow and deep copy operations]: 
* copyreg- [https://docs.python.org/3/library/copyreg.html Register pickle support functions]: 
* cProfile - [https://docs.python.org/3/library/profile.html The Python Profilers]: 
* ctypes - [https://docs.python.org/3/library/ctypes.html A foreign function library for Python]: 
* datetime - [https://docs.python.org/3/library/datetime.html Basic date and time types]: 
* dateutil - [https://pypi.python.org/pypi/python-dateutil Extensions to the standard Python datetime module]: 
* difflib - [https://docs.python.org/3/library/difflib.html Helpers for computing deltas]: 
* dummy_threading - [https://docs.python.org/3/library/dummy_threading.html Drop-in replacement for the threading module]: 
* email - [https://docs.python.org/3/library/email.html An email and MIME handling package]: 
* encodings - [https://docs.python.org/3/library/codecs.html Codec registry and base classes]: see module 'codecs'
* fnmatch - [https://docs.python.org/3/library/fnmatch.html Unix filename pattern matching]: 
* functools - [https://docs.python.org/3/library/functools.html Higher-order functions and operations on callable objects]: 
* getopt - [https://docs.python.org/3/library/getopt.html C-style parser for command line options]: 
* gettext - [https://docs.python.org/3/library/gettext.html Multilingual internationalization services]: 
* glob - [https://docs.python.org/3/library/glob.html Unix style pathname pattern expansion]: for example, convert "*.txt" into list of filtered files in a directory.
* gzip - [https://docs.python.org/3/library/gzip.html Support for gzip files]: 
* hashlib - [https://docs.python.org/3/library/hashlib.html Secure hashes and message digests]: SHA, MD5, etc
* heapq - [https://docs.python.org/3/library/heapq.html Heap queue algorithm]: 
* hmac - [https://docs.python.org/3/library/hmac.html Keyed-Hashing for Message Authentication]: per RFC 2104
* html - [https://docs.python.org/3/library/html.html HyperText Markup Language support]: 
* http - [https://docs.python.org/3/library/http.html HTTP modules]: uses 'socketserver' and 'urllib' for HTTP client/servers.
* importlib - [https://docs.python.org/3/library/importlib.html The implementation of import]: 
* io - [https://docs.python.org/3/library/io.html Core tools for working with streams]: 
* ipaddress - [https://docs.python.org/3/library/ipaddress.html IPv4/IPv6 manipulation library]: test & convert IP addresses
* json - [https://docs.python.org/3/library/json.html JSON encoder and decoder]: converts text or Python dict{} objects to/from JSON.
* keyword - [https://docs.python.org/3/library/keyword.html Testing for Python keyword]: for example, can prevent you from dynamically creating a variable named 'True', which would break all uses of 'True' as a boolean value
* linecache - [https://docs.python.org/3/library/linecache.html Random access to text lines]: 
* locale - [https://docs.python.org/3/library/locale.html Internationalization services]: 
* logging - [https://docs.python.org/3/library/logging.html Logging facility for Python]: ''this module is your friend! Use of Syslog via logging is your primary debug/trace tool.''
* lzma - [https://docs.python.org/3/library/lzma.html Compression using the LZMA algorithm]: 
* mailbox - [https://docs.python.org/3/library/mailbox.html Manipulate mailboxes in various formats]: 
* mimetypes - [https://docs.python.org/3/library/mimetypes.html Map filenames to MIME types]: use file extensions to guess file contents
* numbers - [https://docs.python.org/3/library/numbers.html Numeric abstract base classes]: dive into Complex numbers
* os - [https://docs.python.org/3/library/os.html Miscellaneous operating system interfaces]: since CP router runs Linux, use with care if you develop under Windows.
* os.path - [https://docs.python.org/3/library/os.path.html Common pathname manipulations]: part of module 'os', but very commonly used.
* pickle - [https://docs.python.org/3/library/pickle.html Python object serialization]: for example, convert a python list[] into an object which can be passed across TCP/IP, then reformed as a list[] on another python system.
* pkgutil - [https://docs.python.org/3/library/pkgutil.html Package extension utility]: provides utilities for the import system, in particular package support
* platform - [https://docs.python.org/3/library/platform.html Access to underlying platform’s identifying data]: 
* pprint - [https://docs.python.org/3/library/pprint.html Data pretty printer]: control how complex objects are formatted for display
* py_compile - [https://docs.python.org/3/library/py_compile.html Compile Python source files]: 
* queue - [https://docs.python.org/3/library/queue.html A synchronized queue class]: for example, queue data safely between threads
* quopri - [https://docs.python.org/3/library/quopri.html Encode and decode MIME quoted-printable data]: RFC 1521/1522: MIME (Multipurpose Internet Mail Extensions) parts 1 and 2
* random - [https://docs.python.org/3/library/random.html Generate pseudo-random numbers]: for example, select a random number between 1 and 100
* re - [https://docs.python.org/3/library/re.html Regular expression operations]: 
* reprlib- [https://docs.python.org/3/library/reprlib.html Alternate repr() implementation]: 
* runpy - [https://docs.python.org/3/library/runpy.html Locating and executing Python modules]: alternative to importlib module
* shlex - [https://docs.python.org/3/library/shlex.html Simple lexical analysis]: 
* smtplib - [https://docs.python.org/3/library/smtplib.html SMTP protocol client]: per RFC 821 (Simple Mail Transfer Protocol) and RFC 1869 (SMTP Service Extensions)
* socket - [https://docs.python.org/3/library/socket.html Low-level networking interface]: 
* socketserver - [https://docs.python.org/3/library/socketserver.html A framework for network servers]: warning - designing a system where each transaction generates a NEW socket-server instance will greatly increase router CPU load, impacting router function!
* sre_compile, sre_constants, sre_parse - (no link): a specialized 'regular expression' parser
* ssl - [https://docs.python.org/3/library/ssl.html TLS/SSL wrapper for socket objects]: use with care - just because you use TLS, doesn't mean you have used it correctly. See online docs!
* stat - [https://docs.python.org/3/library/stat.html Interpreting stat() results]: parse details about files
* string - [https://docs.python.org/3/library/string.html Common string operations]: 
* stringprep - [https://docs.python.org/3/library/stringprep.html Internet String Preparation]: RFC 3454 defines a procedure for “preparing” Unicode strings in internet protocols.
* struct - [https://docs.python.org/3/library/struct.html Interpret bytes as packed binary data]: use to (as example) convert floating point to a bytes string, safely handling 'endian' issues.
* subprocess - [https://docs.python.org/3/library/subprocess.html Subprocess management]: to be used INSTEAD of os.system or os.spawn!
* tarfile - [https://docs.python.org/3/library/tarfile.html Read and write tar archive files]: 
* telnetlib - [https://docs.python.org/3/library/telnetlib.html Telnet client]: 
* textwrap - [https://docs.python.org/3/library/textwrap.html Text wrapping and filling]: clean out extra spaces, chop into multi-line, etc
* threading - [https://docs.python.org/3/library/threading.html Thread-based parallelism]: also includes semaphores / locks for safe multi-threading
* token - [https://docs.python.org/3/library/token.html Constants used with Python parse trees]: 
* tokenize - [https://docs.python.org/3/library/tokenize.html Tokenizer for Python source]: a lexical scanner for Python source code, implemented in Python.
* traceback - [https://docs.python.org/3/library/traceback.html Print or retrieve a stack traceback]: 
* tty - [https://docs.python.org/3/library/tty.html Terminal control functions]: 
* types - [https://docs.python.org/3/library/types.html Dynamic type creation and names for built-in types]: 
* urllib - [https://docs.python.org/3/library/urllib.html URL handling modules]: 
* uu - [https://docs.python.org/3/library/uu.html Encode and decode uuencode files]: 
* uuid - [https://docs.python.org/3/library/uuid.html UUID objects according to RFC 4122]: create standard hash and unique id values
* weakref - [https://docs.python.org/3/library/weakref.html Weak references]: create light-weight objects (less RAM)
* xml - [https://docs.python.org/3/library/xml.html XML Processing Modules]: 

Build-Ins included

Some modules which can be imported, don't exist in /usr/lib/python3.3
* errno - [https://docs.python.org/3/library/errno.html Standard errno system symbols]:
* fcntl - [https://docs.python.org/3/library/fcntl.html The fcntl and ioctl system calls]:
* ioctl - [https://docs.python.org/3/library/fcntl.html The fcntl and ioctl system calls]:
* gc - [https://docs.python.org/3/library/gc.html Memory garbage collector interface]: Use to manually speed up large memory allocations.
* math - [https://docs.python.org/3/library/math.html Mathematical functions]:
* pydoc - [https://docs.python.org/3/library/pydoc.html Documentation generator and online help system]:
* select - [https://docs.python.org/3/library/select.html Waiting for I/O completion]: Wait on input from multiple sockets in single thread.
* sys - [https://docs.python.org/3/library/sys.html System-specific parameters and functions]: Includes things like 'platform', which indicate the hardware code is running on.
* time - [https://docs.python.org/3/library/time.html Time access and conversions]

Modules included, use PIP to add to your PC

* dnslib - [https://pypi.python.org/pypi/dnslib Simple library to encode/decode DNS wire-format packets]: 
* dnsproxy - [https://pypi.python.org/pypi/dnslib See dnslib]: 
* OpenSSL - [https://pypi.python.org/pypi/pyOpenSSL Python wrapper module around the OpenSSL library]: 
* pyrad - [https://pypi.python.org/pypi/pyrad RADIUS client as described in RFC2865]:
* serial - [http://pyserial.readthedocs.org/en/latest/pyserial.html PySerial - serial port access]:

Modules included, use discouraged

* bdb - [https://docs.python.org/3/library/bdb.html Debugger framework]: not so useful given limited STDIO on router
* compileall - [https://docs.python.org/3/library/compileall.html Byte-compile Python libraries]: future Cradlepoint NCOS will require other versions of Python.
* cp - (no link): Cradlepoint-specific module 
* cpsite - (no link): Cradlepoint-specific module 
* dis - [https://docs.python.org/3/library/dis.html Disassembler for Python bytecode]: Python byte-code may be HW specific
* genericpath - (no link) : use module 'os.path' instead.
* imp - [https://docs.python.org/3/library/imp.html Access the import internals]: use module 'importlib' instead
* inspect - [https://docs.python.org/3/library/inspect.html Inspect live objects]: limited use due to limited I/O options on a router
* lib-dynload - (no link) : HW/system specific module search and load
* opcode - [https://docs.python.org/3/library/dis.html Disassembler for Python bytecode]: Python byte-code may be HW specific
* pdb - [https://docs.python.org/3/library/pdb.html The Python Debugger]: limited use due to limited I/O options on a router
* posixpath - (no link) : use module 'glob' or 'os.path' instead
* shutil - [https://docs.python.org/3/library/shutil.html High-level file operations]: copy or delete files or entire directory trees; ''warning - writing files in router flash memory risks router failure.''
* ssh - (no link): Cradlepoint-specific module
* tempfile - [https://docs.python.org/3/library/tempfile.html Generate temporary files and directories]: ''warning - writing files in router flash memory risks router failure.''
* tornado - [https://pypi.python.org/pypi/tornado Python web framework and asynchronous networking library]: module added by PIP, may not be available in future firmware.
* warnings - [https://docs.python.org/3/library/warnings.html Warning control]: add warnings to your code, not so useful given limited STDIO on router

Common Modules NOT included

These common module are not included in NCOS 6.1. To use, you will need to add manually to your TAR.GZIP archive.
* ftplib - [https://docs.python.org/3/library/ftplib.html FTP protocol client]: 
* zipfile - [https://docs.python.org/3/library/zipfile.html Work with ZIP archives]: consider using GZIP instead (or 7zip on Windows)

 
Knowledge Home | Product