|
From: Jason V. <jas...@sc...> - 2010-10-21 17:26:09
|
Hi Patrick,
I hope this reply isn't too late to be useful. This can be done, but
in an experimental "pymol2" kind of way. See layer5/PyMOL.h for
ideas. If you're building from source:
import sys, os
# make sure Python can find pymol2, I'm running this
# from the PyMOL home directory
sys.path.append( os.getcwd()+"/modules")
import pymol2
# create a new instance
p =pymol2.PyMOL()
# get its cmd
c = p.cmd
# start a 'session'
p.start()
# fetch and ray trace a file
c.fetch("1foo")
c.png("1foo.png", height=450, width=450, ray=1)
p.stop()
# try another instance & 'session'
p2 = pymol2.PyMOL()
c = p2.cmd
p2.start()
c.fetch("1rec")
c.png("1rec.png", height=450, width=450, ray=1)
p2.stop()
Cheers,
-- Jason
On Tue, Oct 12, 2010 at 1:50 PM, Patrick Winters
<pat...@gm...> wrote:
> Hi,
> I'm generating PNG images for a webserver whose WSGI python process
> will stay alive. For that reason I need to be able to startup and
> shutdown pymol using the API so it doesn't stay running (I assume
> that's how the API works). I've tried every combination I could
> figure to start it up after calling cmd.quit() but none of this seems
> to work. The second round hangs on cmd.quit and never saves a PNG.
> At this point the pymol process and thread are probably dead. How can
> I properly quit and restart pymol from the API?
> --
> Patrick
>
> import __main__
> __main__.pymol_argv = [ 'pymol', '-qc'] # Quiet and no GUI
> import pymol
> from pymol import cmd
> pymol.finish_launching()
> cmd.load("http://www.pdb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1ZXE")
> cmd.png("/tmp/test1.png")
> cmd.sync()
> cmd.quit()
> print "Finished round 1"
> pymol.start_pymol()
> pymol.finish_launching()
> cmd.reinitialize()
> cmd.load("http://www.pdb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1ZXE")
> cmd.png("/tmp/test2.png")
> cmd.sync()
> cmd.quit()
> print "Finished round 2"
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> PyMOL-users mailing list (PyM...@li...)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pym...@li...
>
--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC
(e) Jas...@sc...
(o) +1 (603) 374-7120
|