Using Conda for Python 2.7 vs 3.x switching

Needing a system that allows for easy switching of Python versions or, within one version, switching between different environments, Conda is the easiest way to go.

Conda is a package and environment management system, that was exactly developed for this purpose. With Anaconda being a collection of Python packages we are set to go. The installation is straight forward and does not require root rights. Select and download the appropriate installer from the Anaconda download page.


Setup and configure xterm as your default terminal emulator

In order to set xterm as default terminal emulator for Ubuntu/Unity or IceWM and to make it a bit nicer (appearance and scrolling behaviour), I will give some short tips here.

First we need to edit the $HOME/.Xresources file:


Creating your personal Python environment using virtualenv

Often you are working on a computer where you do not have the user privileges to install custom Python modules (or software in general). Or you do not want to mess with the operating systems Python environment. Then, sometimes you just want (or have to) install python modules with a specific version, e.g. to get the exact behaviour as on a given server. This is where virtualenv comes in. Virtualenv is a tool to create virtual Python environments, that are exactly like a complete Python installation and are therefore fully customizable but do not need root privileges.

In this tutorial, I assume you already have a computer where you have Python up and running, and that you know how to run it in your shell. This is e.g. the case for all Ubuntu based systems.

Now let's make use of virtualenv


Using Gildas/Class from Python

As many people have been asking me on how to use Gildas/Class from within Python, I'll try to give a quick tour here. You will need to have Class installed including the Pyclass extension.

Before you start the Python script you need to initialize Gildas in the shell. Make also sure it is in your $PYTHONPATH. On my local PC using a bash shell where Gildas is installed in $GILDAS_DIR that is

source $GILDAS_DIR/
export PYTHONPATH=$PYTHONPATH:$GILDAS_DIR/gildas-exe-mar18b/x86_64-ubuntu14.04-gfortran/python/

The example above is for the version of Class tested in March 2018 - you might need to change the path for your installed version accordingly. Check if Class is running as usual and that indeed you find the Gildas-path in your $PYTHONPATH.

Then you can execute the Python script or go into iPython. Here is a minimal example:

import pygildas, pyclass
# if you want your program to catch PygildasErrors:
from pgutils import PygildasError
# you are good to go from here, but to access stuff easier, I prefer
# to assign the two most commonly used objects to individual 
# variables for easy access
# get the gildas command line interpreter to issue commands quickly
sic = pyclass.comm
# get the pyclass.gdict object for easy Gildas variable access
g = pyclass.gdict
# just execute commands as you would within Class
# you just do not have the display - use matplotlib ;)
sic('SIC MESSAGE GLOBAL ON') # or OFF for less noise
sic('file in "myData.apex"')
# ...

To access Gildas variables we use the pyclass.gdict (the object we assigned to g). Unfortunately


ASUS RT-N56U und Netzwerkdrucker unter Ubuntu Linux oder Windows 7

Um am ASUS RT-N56U Router einen Drucker zu betreiben muss man theoretisch nicht viel tun: Drucker einstecken und am Client PC entsprechend einrichten. Wie letzteres aber ohne die ASUS Wireless Utilities funktioniert (diese gibt es für Linux nicht), will ich hier kurz für Linux (Ubuntu mittels CUPS Web-Interface) und Windows 7 beschreiben.


Wichtig sind hier eigentlich nur zwei Dinge: