These are just a few basic things you will need to ensure that you can use Python with CS and CEL.
1. First make sure you have Python installed
Python.org is a good place to get Python and find tutorials.
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, 1.3.31.
If you needed to install SWIG and/or Python, you will need to reconfigure and recompile CS and CEL.
You should check you have the following: inside cs directory: out/<platform>/<buildmode>/bindings/python/cspace/ with many .py, .pyd/.so files.
inside cel directory: blpython.dll (ot blpython.so on unix like systems), blcelc.py, and _blcelc.pyd/.so.
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 (out/<platform>/<buildmode>/bindings/python/cspace/) must be in the pythonpath (setting PYTHONPATH to that dir should be enough at this point, or else just run "jam install_bindings").
Setting environment variables correctly
You should check that you have correctly set the CRYSTAL and CEL environment variables as explained in the manual, and then, you should check the python modules (the ones from the Check stage above) are in pythonpath. This is done by setting the PYTHONPATH environment variable to point to the dirs where these are located.
Note also that for statically built celstart, you'll also need to point to the zipfile so python can find the scripts (as an example "export PYTHONPATH=$CRYSTAL/out/<platform>/<buildmode>/bindings/python/cspace/:$CEL:/path/to/worlfile.zip").
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. This shouldnt happen on 1.3 onwards.
Problems linking on linux-ppc
Should be fixed from 1.3 onwards.
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).
crystalspace.application.celstart: Can't load behaviour layer 'blpython' with id 'cel.behaviourlayer.python'!
If all else is working (ie, pysimp, python tutorials, cel smallgame), then probably you need to set the PYTHONPATH environment variable to point to your CRYSTAL and CEL python plugin locations, and possibly also to the zip file with the world (ie, like said before, on windows: right click my computer, properties Advanced tab, Environment variables button).
Back to PyCrystal