Wednesday, October 19, 2016

Using 'python' and 'python end' in pymol scripts

Using 'python' and 'python end' in pymol scripts

Dear Users,

I am trying to implement a script which uses a mix of pymol and python scripting. I enclosed the main portion within the 'python' and 'python end' commands. This runs perfectly fine in Pymol GUI mode, however when I tried it with 'pymol -cg my_script.py', it generates an error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pymol/parser.py", line 338, in parse
    parsing.run_file(path,self.pymol_names,self.pymol_names)
  File "/usr/lib/python2.7/dist-packages/pymol/parsing.py", line 452, in run_file
    execfile(file,global_ns,local_ns)
  File "/usr/lib/python2.7/dist-packages/pymol/parsing.py", line 447, in execfile
    b.execfile(filename, global_ns, local_ns)
  File "bondH.py", line 122
    python end
             ^
SyntaxError: invalid syntax

How do I overcome this problem?

Answer: 


Rename the script from .py to .pml


No comments:

Post a Comment