Area SX srl - Informatica e Microelettronica
0
Back to: Home Page Articles Microcontrollers Linux Embedded How to install the Python interpreter on the SX ARM Linux

How to install the Python interpreter on the SX ARM Linux

Publication Date: 22-08-2008 | Versione Italiana  | English Version
Tags: - Linux - Python -

In this article we will see how to install the Python 2.4 Interpreter and how to execute some example scripts on the SX ARM Linux.

In this article we analyze how to install the Python interpreter, version 2.4 crosscompiled to run over a SX ARM Linux (ARM9 processor) and how to execute some example scripts.

Here in Area SX web shop, you can buy an SD memory card with 1GB capacity preloaded with complete package of the Python 2.4.4 interpreter, with some extra libraries already installed, such as pySerial , pySqlLite e MySQLdb for example.

The pySerial library is mandatory to let the Python interpreter access the serial ports of the SX ARM Linux, the pySqlLite library let it create and manage local database SQLite. SQLite is a SQL DBMS (Database Management System) very fast and completely Open Source that can create and manage a database, compliant with the ANSI SQL92 standard, in a single file.
The third extra library installed è MySQLdb, mandatory if you want to manage an external MySQL database with the SX ARM Linux.

Installing the SD memory card on the SX ARM Linux

To connect the SD memory card in the SX AMR Linux you have to open it, removing the four cross screws on the sides. Once opened the metal top panel, find the other four screws which tie the board to the metal case (see also the following picture) and unlock them.


Now, you have to extract the board from the metal case and insert the SD memory card in its slot on the back side. Then of course remount everything.

Configuration

Because of an appropriate script, the configuration of the Python interpreter on the SX ARM Linux is strongly simplified. Just follow the few and easy steps described below.

  1. Turn on the SX ARM Linux and connect through a console SSH or Telent
  2. Login (default account: root root)
  3. Mount the SD memory card with the command: mount -t vfat /mnt/mmc/
  4. Launch the script named setup_python.sh this way:  /mnt/mmc/setup_python.sh
  5. When the script ends, restart the SX ARM Linux with the commands: reboot



  6. when the restart of the SX ARM Linux has ended, to check the correct installation you have to access again the SSH or Telnet console and, after login, to type: python and after few instants we will see displayed on the video the Python environment console.

To uninstall the Python environment, you just have to rename the files rc.bk and profile.bk (these to files are generated by the installation script setup_python.sh) Following these commands:

mv /etc/rc.bk /etc/rc
mv /etc/profile.bk /etc/profile


Then unmount the SD memory card:

umount /mnt/mmc/

and restart the SX ARM Linux.

The first Python script for the SX ARM Linux

All the Python scripts, which you want to run on the SX ARM Linux, must start with the following header:

#!/mnt/mmc/python/bin/python

A very simple test script may be realized this way:

  1. From the console of the SX ARM Linux edit with vi a new file (e.g. vi test.py) and copy the following code:

    #!/mnt/mmc/python/bin/python

    print "This is a test"

  2. Make the script runnable with the command: chmod +x /path/scriptname.py
  3. Launch the script with the command: ./ scriptname.py

Links

Python Official WebSite: http://www.python.org
SQLite Official WebSite: http://www.sqlite.org
MySQL Official WebSite: http://www.mysql.com
WebSite for pyserial: http://pyserial.wiki.sourceforge.net/pySerial
WebSite for MySQLdb: http://sourceforge.net/projects/mysql-python
WebSite for pysqlite: http://oss.itsystementwicklung.de/trac/pysqlite/


Segnala questo articolo: 



Tags: - Linux - Python -

Publication Date: 22-08-2008Hits: 33977
I marchi citati sono propriet� dei titolari dei relativi diritti. Le caratteristiche tecniche e i prezzi riportati sono indicativi e soggetti a variazioni senza preavviso. Le foto non hanno valore contrattuale. Nonostante accurate verifiche, il presente documento pu� contenere prezzi o specifiche errati. Area SX si scusa in anticipo e si impegna ad evitare tali imprecisioni.

 Area SX store
In this section you can buy directly the products described in this article
SD_1Gb_PYTHON;SXARML1;KCZ0100018;DLIG122;SXGSM;AMM.90;SWITCH_IES205;USB-WiFi-150N
All prices are indicated in Euros without shipping costs and VAT (where applicable). The prices are for single unit.
DescriptionCodeUnit Price
Read more info on this productAntenna a 90° per moduli GSM/GPRS con SMA/M
Antenna a 90° per moduli GSM/GPRS Quadri Band 850/900/1800/1900 MHz, con connessione SMA Maschio.

Questa antenna è compatibile con i seguenti prodotti: .
  • EZ863-GPS
  • EZ10-GPS
  • Telit GT863-PY


Prodotto compliant RoHs
AMM.90€ 5.00
Read more info on this productRead more info on this product

Resellers Social Contacts Conditions
Area SX s.r.l
Via Stefano Longanesi 25
00146 Roma

Tel: +39.06.99.33.02.57
Fax: +39.06.62.20.27.85
P.IVA 06491151004
Terms of sale
Warranty conditions
Resellers Conditions