[chimera-dev] chimera import from unmodified python 2.5
Ondrej Marsalek
ondrej.marsalek at uochb.cas.cz
Sat Aug 9 13:51:14 PDT 2008
On Wed, Aug 6, 2008 at 20:19, Greg Couch <gregc at cgl.ucsf.edu> wrote:
> 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.
thanks, it works now. at least that part, anyway.
> 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.
i was primarily interested in using a non-gui version. having also the
ability to use the gui would be nice, but not important for me at the
moment.
> 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.
i use the ipython shell for my normal python work and i found it
complicated to get i to work in this way.
> 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.
i have the following chimera.env file that i source in bash:
export CHIMERA=/opt/chimera
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CHIMERA/lib
export PYTHONPATH=$PYTHONPATH:$CHIMERA/share:$CHIMERA/lib:$CHIMERA/lib/python2.5/site-packages
the nogui version works, but that is not exactly what i wanted, as
that provides a midas prompt (if i understand it correctly). i would
rather like to stay in my original python shell (ipython in this
case). is there a way to do that?
the gui version fails, which is expected, as i did not take care of
any tcl/tk changes. in case this is useful, the traceback is at the
bottom. however, as i said, this is not my aim at the moment. i would
be quite happy with getting my stock python into the same state as the
built-in idle shell but without the gui. i hope it makes at least some
sense.
regards,
ondrej marsalek
In [2]: chimeraInit.init( [], eventloop=False )
Traceback (most recent call last):
File "/usr/bin/ipython", line 27, in <module>
IPython.Shell.start().mainloop()
File "/var/lib/python-support/python2.5/IPython/Shell.py", line 77,
in mainloop
self.IP.mainloop(banner)
File "/var/lib/python-support/python2.5/IPython/iplib.py", line
1537, in mainloop
self.interact(banner)
File "/var/lib/python-support/python2.5/IPython/iplib.py", line
1684, in interact
more = self.push(line)
File "/var/lib/python-support/python2.5/IPython/iplib.py", line 1986, in push
more = self.runsource('\n'.join(self.buffer), self.filename)
File "/var/lib/python-support/python2.5/IPython/iplib.py", line
1904, in runsource
if self.runcode(code) == 0:
File "/var/lib/python-support/python2.5/IPython/iplib.py", line
1941, in runcode
exec code_obj in self.user_ns
File "<ipython console>", line 1, in <module>
File "CHIMERA/share/chimeraInit.py", line 338, in init
tkgui.initializeGUI(exitonquit)
File "CHIMERA/share/chimera/tkgui.py", line 2562, in initializeGUI
File "CHIMERA/share/chimera/tkgui.py", line 2472, in createApp
TclError: package "Tix" isn't loaded statically
Error starting chimera:
TclError: package "Tix" isn't loaded statically
(see reply log for Python traceback info)
More information about the Chimera-dev
mailing list