PYTHON AND LINUX
(LOPORA AND OTHER PYTHON PROGRAMS)
KLIK HIER VOOR DE NEDERLANDSE VERSIE
Busy with Linux!
Software installation and configuration
Is there only one method in Windows, in Linux there are more ways to install software. I did that as described here below. But probably it is also possible with the application "Ubuntu Software Center".
Open a console window: CTRL+ALT+T or search for "Terminal" with the Dash Home (can be found on top in the Launcher). Or for the real Linux Nerds: CTRL+ALT+F1, but then your Desktop environment has gone and you cannot scroll the console window anymore. And my keyboard gave strange characters.
Installation of Python if that has not been done, type the following commands+Enter:
sudo apt-get install python
Installation of Numpy, type the following commands+Enter:
sudo apt-get install python-numpy
Installation of the PIL library, type the following commands+Enter:
sudo apt-get install python-imaging python-imaging-tk
(The command "sudo" will give you the required rights to install the software as administrator, "apt-get install" is the command to download and install the software.)
And close the console window by typing EXIT or clicking the red little cross of the console window (or CTRL+ALT+F7 if you opened it with CTRL+ALT+F1).
The next steps will be done in the Desktop environment:
Installation of Python audio:
Open the webbrowser and download from the site "http://people.csail.mit.edu/hubert/pyaudio/":
"python-pyaudio_xxxx.deb" and click on the file (xxxx is the applicable version).
Then it will be installed automatically by the Ubuntu Software Center.
During a 2nd installation of Linux, it turned out that "pyaudio" could also be installed with the Ubuntu Software Center by searching for "pyaudio".
Installation of Python IDLE:
Search with the Ubuntu Software Center "Python for IDLE(using Python-2.7)" and install it. This is the developement environment / editor for Python, but there are also others available.
Of course we have to control the audio. Lock the Sound application
to the Launcher, then you do not have to search for the application all the time.
But how do we start LOPORA? There are more possibilities!
Start "IDLE" and open in IDLE the Python program "LOPORA". Now you can modify it and run the program as follows.
Select "Run" and then "Run Module". Now you will see two windows, one with the program and a Python Shell window where you can find various remarks and error messages. The advantage of this method is that the Shell Window does not dissappear when an error occurs and that you can read the error message.
Open a console window: CTRL+ALT+T or search for "Terminal" with the Dash Home (NOT CTRL+ALT+F1, that does not work here!!!) and go to the directory where the program can be found.
Type "python LOPORAv02c.py" (of "python2.7 LOPORAv02c.py" when you want to use version 2.7) and the program will start. Beware of uppercase and lower case characters and of course without the "" signs!
Make in the same directory as the program a script file with the name "startlopora.sh".
This file contains the ASCII text:
In the first line the directory will be changed to that where the program "LOPORAv02c.py" is. Here, "onno" is the username, will be different in your PC. And your directory will also be different, so modify it for your own PC.
In the second line, the program will be started.
Make this scriptfile executable (click with the right mouse key on this scriptfile and look at permissions). When you do click on this file and if you select "Run", LOPORA will start.
It is also possible to place a link to this scriptfile on the Desktop. Then you can start the program by clicking on this link on the Desktop.
And you can add this scriptfile to the "Startup Applications" via the "Dash Home" application on top of the Launcher at the left on the Desktop (search for Startup Applications). That is what I did, LOPORA does start when the PC is switched on. And LOPORA can be set to "autorun mode".
Add the name of the scriptfile to the Startup applications if you
want to start LOPORA automatically when the PC is switched on.
Open a console window: CTRL+ALT+T or search for "Terminal" with the Dash Home.
Type the following commands:
Now you will see a list of .desktop files of the applications. Somewhere you can find "idle-python2.7.desktop" on the screen (the name is perhaps different on your PC).
sudo gedit idle-python2.7.desktop
By the command "sudo", this file will be opened as root-administrator in the text editor "gedit".
Modify the line "exec=/usr/bin idle-python2.7 -n" in "exec=/usr/bin idle-python2.7 %F".
By adding %F, it has become a selectable application.
We can make "IDLE" a selectable application by adding %F.
Error message: "IOError: [Errno 2] No such file or directory: 'helvB08.pil'"
When you have this or similar problems, you working directory is not the same as that of the Python program. Can happen for example when you made a link to the program, then the working directory will be the directory of the link instead of the directory of the program. Can be avoided by starting the program via Possibility 3 as described here above.
UTF8 errors are possible with other languages like for example Russian. Search on the internet for a solution for Python in you language.
Still a small problem
When starting the PC, I always have to disconnect and reconnect the audio plug from the "line input". Otherwise, the soundcard does not work correctly. If other PC's do have the same problem and what the reason is, I don't know...
BACK TO INDEX PA2OHH