Reputation: 33
I have written a python script that takes an upstream result and outputs it as a pml script (series of PyMoL commands). When I run the file in pymol, some of the commands run, but the command line returns 'Invalid selection' Selector-Errors.
For instance. The script returns text lines such as:
fetch 3MPF
create 3MPFB63,3MPF and c. B and i. 63-68
remove 3MPF
align 3MPFB63, ref
When the script is run in PyMoL it says:
PyMOL>fetch 3MPF
please wait ...
PyMOL>create 3MPFB63,3MPF and c. B and i. 63-68
Selector-Error: Invalid selection name "3MPF".
( 3MPF and c. B and i. 63-68 )<--
PyMOL>remove 3MPF
Selector-Error: Invalid selection name "3MPF".
( 3MPF )<--
PyMOL>align 3MPFB63, ref
Selector-Error: Invalid selection name "3MPFB63".
3MPFB63<--
However, when those commands from the error are run individually, i.e. copying and pasting the snippet create 3MPFB63,3MPF and c. B and i. 63-68
the command runs perfectly well and makes the selection and creates the object.
Any help would be greatly appreciated.
Upvotes: 0
Views: 2380
Reputation: 33
It appears as if the answer to this problem is including async=0 in the fetch call, forcing the command-line to wait on the return from that command before executing the second command, i.e. it was trying to select objects before they existed.
For example,
fetch 3MPF, async=0
create 3MPFB63,3MPF and c. B and i. 63-68
delete 3MPF
align 3MPFB63, ref
This now works as intended. Will post back if down the line something else breaks when the full PML is auto-ran.
Classic, "as soon as you resort to asking on SO you figure it out," situation.
Upvotes: 1