[chimera-dev] chimera import from unmodified python 2.5
Greg Couch
gregc at cgl.ucsf.edu
Wed Aug 6 11:19:23 PDT 2008
Yup, we compiled Python with the default options which uses UCS-2 instead
of UCS-4. Since both Ubuntu and RedHat/Fedora use UCS-4, I'll change our
Python to be the same. Tomorrow's daily build will use the UCS-4 API.
FYI, while chimera can work with a stock python, it is not completely
compatible. We use a newer version of Tk than the stock python, so we had
to modify the Tkinter module. We also made several other patches to the
Python library, e.g., the help() function so it would work better with
compiled modules. What this means is that if you are going to use the
stock python with chimera, you have to have extra setup code to use the
chimera GUI.
If you have Python code that you want to use with chimera, it's simplier
to set the CHIMERAPATH environment to include the stock python's
site-packages directory and your PYTHONPATH directories, or alter sys.path
in your Python code. "chimera --nogui script.py" is a powerful way to run
arbitrary Python code with the chimera modules.
And yes, please share how you are using chimera with the stock python. It
should be as "simple" as (1) setting the CHIMERA environment variable, (2)
adding CHIMERA/lib to LD_LIBRARY_PATH, (3) optionally setting up Tcl and
Tk to be chimera's version, (4) adding CHIMERA/share to sys.path, (3)
importing chimeraInit, and (5) calling chimeraInit.init with either
nogui=True or eventloop=False.
Greg Couch
UCSF Computer Graphics Lab
On Wed, 6 Aug 2008, Ondrej Marsalek wrote:
> hello everyone,
>
> first of all, i would like to say thank you for using vanilla python
> 2.5, i think this could be quite useful.
>
> unfortunately, there is one problem that keeps me from using chimera
> from a session of my regular python 2.5 installation (on ubuntu 8.04).
> after setting paths properly, an attempt to import chimera (or the
> binary module _chimera) produces the following exception:
>
>
> In [1]: import chimera
> ---------------------------------------------------------------------------
> <type 'exceptions.ImportError'> Traceback (most recent call last)
>
> /home/andy/<ipython console> in <module>()
>
> /home/andy/CHIMERA/share/chimera/__init__.py in <module>()
>
> <type 'exceptions.ImportError'>: /opt/chimera/lib/libwrappy2.so:
> undefined symbol: PyUnicodeUCS2_AsUTF8String
>
> In [2]: import _chimera
> ---------------------------------------------------------------------------
> <type 'exceptions.ImportError'> Traceback (most recent call last)
>
> /home/andy/<ipython console> in <module>()
>
> <type 'exceptions.ImportError'>: /opt/chimera/lib/libwrappy2.so:
> undefined symbol: PyUnicodeUCS2_AsUTF8String
>
>
> it seems that the python 2.5 provided with chimera is compiled with
> different unicode settings than the one in ubuntu. the shared chimera
> objects are compiled against that version of python and therefore
> can't be used from my normal python. the only way i see around this at
> the moment is to recompile chimera, but i wanted to leave that as the
> very last option.
>
> i would appreciate any suggestions, as a straightforward way to use
> chimera from my normal python would be really neat. i'll be glad to
> provide details if anyone is interested.
>
> regards,
> ondrej marsalek
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev
>
More information about the Chimera-dev
mailing list