Archive for the ‘Python’ Category

Building Boost.Python 1.42 for QNX 6.4.1

June 8, 2010

Building the Boost C++ libraries ( for QNX is pretty straight forward. The build can be executed as described in the Boost documentation. I have performed the build of Boost 1.42 using QNX 6.4.1 installed in a virtual machine.

But there was a little tweak required to build the Boost.Python library. The problem is that python is located in /usr/qnx641/host/qnx6/x86/usr/bin/python but the required Python include files like Python.h are located in /usr/qnx641/target/qnx6/usr/include/python2.5. This setup is confusing the automatic detection of the include files used in the build process.

This can be fixed by providing the right include path, e.g by adding the following line to the file <boost_src_dir>/project-config.jam:

using python : 2.5 : /usr/qnx641/host/qnx6/x86/usr/bin/python : /usr/qnx641/target/qnx6/usr/include/python2.5 ;

Loading a Python module fails with the message “unknown symbol”

August 28, 2008

Using the import statement of Python to load a self build module sometimes fails. In my personal experience most of the time the problem was due to unresolved symbols in my .so modules. For QNX and many other POSIX compatible systems like GNU/Linux Python uses dlopen to load the dynamic libraries aka modules.


PyDev – One of my favorite plugins for Eclipse

August 28, 2008

While programming in Python I use most of the time the Python perspective provided by the PyDev plug in for Eclipse. PyDev is the abbreviation of Python Development Environment and available from This post outlines the steps installing PyDev and the Python lint pylint.


Debugger is failing to start with a time out

August 28, 2008

In case you get only this information in the view of Eclipse or Momentics IDE named Debug:

Thread[0] 1 <symbol is not available>

The corresponding source is displayed as:

No source available for “”

[View Disassembly …]

The launch of the target is terminated by a time out.


Often used pkgsrc commands

August 14, 2008

This my memo where I store the commands I’m using when building packages with pkgsrc (

Determining the package dependencies:
$ bmake show-depends-pkgpath

Finding build references to a given package, e.g. libdrm:
$ egrep ‘libdrm|xf86driproto’ */*/

All the available targets are documented in The pkgsrc make target reference – NetBSD Wiki.

This is used to rebuild a patched package:
bmake distinfo && bmake clean && bmake build

The following builds and install the package:
bmake distinfo && bmake clean && bmake package

QNX specific issues are discussed in the forum

Generating the Python docs on a Ubuntu GNU/Linux box

December 4, 2007

The first thing is to checkout the Python and doctools directories from the subversion repositories:

$ svn co python
$ svn co doctools

To install the required tools, as suggested from the doctools/README, I added the following packages:

# apt-get install python-pygments python-docutils

These are the steps really generating the documentation:

$ cd doctools
$ mkdir build-html
$ python -b html ../python/Doc build-html

Open the files generated in build-html, e.g. build-html/index.html, using file->open using your favorite web browser.

Everything works pretty straight forward as described in the doctools/README file.

Technorati Tags: , , , ,

Modify a read only tuple

December 4, 2007

Using tuples is very handy because of their flexibility and speed. But there is a drawback. Assigning a single item to a tuple does not work and results in a

 TypeError: object doesn't support item assignment

Appending to the tuple does not work, too. The reason is that tuples are immutable (read only) data structures ( The trick was provided at how2think/english/chap09.htm: replace the old read-only tuple with the new one where two tuples are concatenated:

>>> tuple = ('a', 'b', 'c', 'd', 'e')
>>> tuple[0]
>>> tuple[0] = 'A'
TypeError: 'tuple' object does not support item assignment
>>> tuple.append('A')
AttributeError: 'tuple' object has no attribute 'append'
>>> tuple = ('A',) + tuple[1:]
>>> tuple
('A', 'b', 'c', 'd', 'e')

Technorati Tags:

Example for creating a compressed file using Python

November 30, 2007

This example shows that the same methods can be used to writing a normal text file and a compressed file. Corresponding reading functions are provided, too.