Hi,

In the example code below, there is a selection object "myself" within PyMOL, I 
try to obtain the selected residues within Python.
The "out=x.cmd.do" prints the selection to stdout, but the variable out remains 
None. What would be a good way to get the selection without going through disk 
I/O?

import pymol2
x=pymol2.PyMOL()
x.start()
x.cmd.do("fetch 1crn; select mysel, /1crn//A/10-20")
out=x.cmd.do("iterate mysel and name CA, (resi)")
print(out)

A separate question, when I run the following line of Python, I got an error 
(however the command works using PyMOL's command interface):

out=x.cmd.do("iterate mysel and name CA, print(resi)")

I got an error:
return _cmd.alter(_self._COb, selection, expression, True,
  File "", line 1, in <module>
NameError: name 'print' is not defined

What's the syntax error in this line?

Thank you,
Yingyao

_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to