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