From: DeLano, W. <wa...@su...> - 2002-02-19 17:19:30
|
NOTE: the following is unix-specific. This is a common problem with PyMOL. Right now it is impossible (in practice) to use PyMOL as merely an imported module within an external interpreter (i.e. without using "pymol.com" instead of "python" to invoke the interpreter). This will be fixed in a later version. For example: #!/bin/csh python <<END from pymol import cmd cmd.cls() END ...will fail. For now, you need to use the pymol.com script to launch your Python interpreter if you are going to use PyMOL. Normal commands are interpreted first by PyMOL and then passed to Python if PyMOL doesn't recognize the command. You can skip PyMOL evaluation with a preceeding /, which is almost equivalent to typing the same command (without a preceeding slash) in a Python interpreter: print "hello" /print "hello" However, you can run native Python script in external using the run command: run myscript.py ...which is almost equivalent to typing: python myscript.py ...on the unix or windows command shell, or by issuing execfile("myscript.py")=20 ...from within an existing Python interpreter. IMPORTANT CONCEPT: The key difference between=20 python myscript.py # on command line pymol.com myscript.py # on commmand line run myscript.py # in PyMOL is that default evaluation in PyMOL currently takes place in the "pymol" module, not "__main__". Right now there is no easy way to start a process in the "__main__" module. I will remedy this in the next public release, and probably make __main__ the default namespace for the run command (so long as that doesn't break anything). You can however, force evaluation of your script to occur in its own name-space: run myscript.py,module ...or in a local namespace: run myscript.py,local -- mailto:wa...@su... Warren L. DeLano, Ph.D. Informatics Manager Sunesis Pharmaceuticals, Inc. 341 Oyster Point Blvd. S. San Francisco, CA 94080 (650)-266-3606 FAX:(650)-266-3501 > From: Ingo Dramburg [mailto:dramburg@Mailer.Uni-Marburg.DE] =20 > Hi, >=20 > I want to include my own modules into PyMOL for visualization > purposes.=20 > If I try to use the pymol.cmd module to control a running > PyMOL process from an external python interpreter > I always get a segmentation fault. (SuSE 7.2, Python 2.0) > Everything else works fine. >=20 > Example: > >> from pymol import cmd > >> cmd.cls() > segmentaion fault >=20 > Is it possible to do such things in general or is it possible > to switch to a 'native' python mode in the PyMOL window to enter=20 > python commands directly :-).=20 >=20 > The next question is how can I pass selections from PyMOL to external=20 > scripts to do calculations that are not supported by PyMOL=20 > and later back to > PyMOL for visualization. >=20 > Thanks you for any help, >=20 > Ingo. > --=20 > ************************************************************ > Ingo Dramburg=20 >=20 > Institute of Pharmaceutical Chemistry > Philipps-University Marburg > Marbacher Weg 6, D 35032 Marburg, Germany >=20 > Tel. + 49 6421 282 1313 > Fax + 49 6421 282 8994 > e-mail dra...@ma... > http://www.agklebe.de/ >=20 > _______________________________________________ > PyMOL-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymol-users >=20 |