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

2003-10-24 Thread Warren L. DeLano
Truls,

That looks to me like a crash where the PyMOL API was somehow
called before PyMOL was initialized...how and why this could happen is a
mystery to me though -- that's what pymol.finish_launching() is supposed
to prevent -- but there may be some flaw in the logic.

Cheers,
Warren


--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

 -Original Message-
 From: Debian Chooser [mailto:ker...@herocamp.org] On Behalf Of Truls
A.
 Tangstad
 Sent: Friday, October 17, 2003 3:18 PM
 To: Warren L. DeLano
 Cc: pymol-users@lists.sourceforge.net
 Subject: Re: [PyMOL] Using PyMol as a library - no GUI
 
 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




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

2003-10-17 Thread Warren L. DeLano
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()

Cheers,
Warren

--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

 -Original Message-
 From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
 ad...@lists.sourceforge.net] On Behalf Of Truls A. Tangstad
 Sent: Friday, October 17, 2003 4:48 AM
 To: pymol-users@lists.sourceforge.net
 Subject: [PyMOL] Using PyMol as a library - no GUI
 
 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.
 
 --
 Truls - kerfue+pymol-us...@herocamp.org
 
 
 ---
 This SF.net email is sponsored by: SF.net Giveback Program.
 SourceForge.net hosts over 70,000 Open Source Projects.
 See the people who have HELPED US provide better services:
 Click here: http://sourceforge.net/supporters.php
 ___
 PyMOL-users mailing list
 PyMOL-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/pymol-users




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