On Fri, Oct 17, 2003 at 09:41:24AM -0700, Warren L. DeLano wrote:
> > Truls A. Tangstad wrote:
> > I'm very interested in using alot of the functionality that PyMol
> > offers programmatically from Python, i.e. without using a GUI at
> > all. The chempy package seems to cover alot of my needs, loading
> > different file formats etc. even though it doesn't seem to be
> > documented.
> > 
> > Is it also possible to use the rest of the functionality in PyMol from
> > other Python scripts? Right now, just importing the pymol package
> > seems to force the GUI to open.

> If you've got PyMOL configured to open on
> 
> import pymol
> pymol.finish_launching()
> 
> You can suppress the GUI feature and suppress startup output by
> providing command line arguments as follows.  Before importing PyMOL,
> set a "pymol_argv" list in the __main__ namespace.  PyMOL will interpret
> this as a sys.argv styled list of command line arguments.
> 
> import __main__
> __main__.pymol_argv['pymol','-qc']
> 
> import pymol
> pymol.finish_launching()

Thanks, seems to work like a charm in scripts after adding the
assignment operator:
__main__.pymol_argv = ['pymol', '-qc'] # adding miss

Somehow it segfaults when trying the same thing in an interactive
python interpreter though, right after importing pymol. This might be
due to a shoddy install on my part, but I'm including a gdb backtrace:

#0  0x41d7b21a in SettingGetGlobal_f () from 
/usr/lib/python2.3/site-packages/pymol/_cmd.so
#1  0x41d7c683 in SettingGet () from 
/usr/lib/python2.3/site-packages/pymol/_cmd.so
#2  0x41d6296d in OrthoAddOutput () from 
/usr/lib/python2.3/site-packages/pymol/_cmd.so
#3  0x41d679a5 in PCatchInit () from 
/usr/lib/python2.3/site-packages/pymol/_cmd.so
#4  0x4006d74d in PyCFunction_Call () from /usr/lib/libpython2.3.so.1.0
#5  0x40045e37 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0
#6  0x400a2a4a in PyEval_CallObjectWithKeywords () from 
/usr/lib/libpython2.3.so.1.0
#7  0x40055550 in PyFile_WriteObject () from /usr/lib/libpython2.3.so.1.0
#8  0x400556e6 in PyFile_WriteString () from /usr/lib/libpython2.3.so.1.0
#9  0x400d56b6 in PySys_WriteStderr () from /usr/lib/libpython2.3.so.1.0
#10 0x400d4b2c in PySys_WriteStderr () from /usr/lib/libpython2.3.so.1.0
#11 0x400d2c74 in Py_AtExit () from /usr/lib/libpython2.3.so.1.0
#12 0x40101043 in _PyUnicode_TypeRecords () from /usr/lib/libpython2.3.so.1.0

Any idea why it shouldn't work interactively?

I'm using PyMol 0.90 and Python 2.3.2 on Debian unstable.

-- 
Truls - kerfue+pymol-us...@herocamp.org

Reply via email to