Hi,

You can run arbitrary python programs using the command line "run" command:

    run path_to_programs/python_program.py

The File->Run menu seems to prefer .pml files (that is, the dialog filters out all but these). And I think that pml files are meant for line by line interpreting.

gilleain torrance

On 3 Oct 2005, at 12:20, Terry Jones wrote:

Hi all

I've written some python code that I want to run from inside pymol using the File/Run command. After some playing around looking at error messages and the pymol source, I saw that pymol is reading my file line by line and
passing each line to eval.

So if my file contains lines that are each complete python commands,
File/Run works fine. But if it contains python like

  if a == b:
    pass

then File/Run fails with a syntax error (as eval falls over when it is
passed just the first line).

While I can see an obvious (and ugly) way to work around this, I wanted to first ask if there is another way to do what I'm trying to achieve. Without trying to understand too much of the pymol source, I can see it does use execfile under some circumstances. Is there some recommended way to run a
file of code? Maybe my code should simply call execfile itself?

Thanks for any help,
Terry Jones


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users



Reply via email to