Re: [PyMOL] Problem starting Pymol in a Python script

2003-11-07 Thread Truls A. Tangstad
On Fri, Nov 07, 2003 at 01:52:42PM +, Tom Walsh wrote:
 
 Hi,
 
  I'm trying to start Pymol (version 0.93) in a Python script,
 using the first method described in __init__.py i.e.:
 
 import pymol
 
 pymol.finish_launching()
 
 I've set the PYTHONPATH and PYMOL_PATH variables as required
 but I get this error message:
 
 -
 Traceback (innermost last):
   File pymol.py, line 3, in ?
 import pymol
   File pymol.py, line 5, in ?
 pymol.finish_launching()
 AttributeError: finish_launching
 -
 
  So what am I doing wrong?

It seems like you might have named your python script pymol.py, and
the import pymol statement just tries to import pymol.py instead of
the Pymol package. Try renaming your script to something other than
pymol.py.

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



Re: [PyMOL] Using PyMol as a library - no GUI

2003-10-17 Thread Truls A. Tangstad
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  0x4000 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