Home - Forums - Documentation - Gallery - Bugs

These are just a few basic things you will need to ensure that you can use Python with CS and CEL.

Contents

1. First make sure you have Python installed

Python.org is a good place to get Python and find tutorials.

SWIG

SWIG is a library which connects programs written in C/C++ with a variety of high-level programming languages. The CS/CEL python bindings use SWIG to generate the Python API. So you will need SWIG installed before you compile CS and CEL in order for them to create the python bindings. Tested versions of swig include 1.3.24 or 1.3.27, 1.3.28, 1.3.29.

If you needed to install SWIG and/or Python, you will need to reconfigure and recompile CS and CEL.

Check

You should check you have the following: inside cs directory: cspace.py and _cspace.pyd (or _cspace.so on unix like systems) inside cel directory: blpython.dll (ot blpython.so on unix like systems) and blcelc.py

Test

There are several apps you can run to test the python bindings are working correctly.

  • For cs bindings: run pysimp from the crystalspace dir.
  • For cel bindings: run start_smallgame.sh from the cel dir. Note for this the crystalspace python module (cspace.py and _cspace.*) must be in the pythonpath (setting PYTHONPATH to the CRYSTAL dir should be enough at this point).

Troubleshooting

CS python bindings take too long to compile

This most likely means you're running out of ram compiling the bindings. You can try closing as many apps as possible before compiling, or getting a precompiled solution.

Problems linking on linux-ppc

This is a known ppc gcc problem, and we're trying to work around this on a branch on svn. You can try to contact the python people to help on testing this, other than this there is no known solution yet.

Errors compiling the bindings

Most probably your swig generated files are not up to date due to some recent api change. You can try getting swig and reconfiguring+recompiling, or wait and update to catch the next update of the files from the server (note this can take some hours).


Back to PyCrystal

| Article | Discussion | View source | History |