Appendix c. using python, C.1. running python, C.2. adding libraries and modules – SENA Parani-MSP1000 User Manual
Page 74

74
Appendix C. Using Python
The Parani-MSP1000 supports python language for user customization.
C.1. Running Python
There are two different ways to start Python.
C.1.1 Interactive Interpreter from Command Line Interface
You can enter Python and start coding right way in the interactive interpreter by starting it from the
command line.
[root@MSP1000 usr2]# python
Python 2.5 (r25:51908, Mar 14 2007, 11:33:06)
[GCC 4.0.0 (DENX ELDK 4.0 4.0.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1
>>> b = 2
>>> c = a + b
>>> c
3
>>>
C.1.2 As a script from the Command Line Interface
A Python script can be executed by invoking the interpreter from the command line. Be sure that the
file permission mode allows execution.
[root@MSP1000 usr2]# cat cal.py
#!/bin/python
a = 1
b = 2
c = a + b
print "a + b = %d" % c
[root@MSP1000 usr2]# ./cal.py
a + b = 3
[root@MSP1000 usr2]#
C.2. Adding libraries and modules
Users can upload additional Python libraries and modules. The additional libraries and modules should
be located in the /usr2. When uploading files, the Bluetooth FTP and Secure Copy (scp) are available.
[root@MSP1000 usr2]# scp 192.168.7.8:/home/array.so ./