Re: [PyMOL] How to obtain a PyMOL selection within Python

2024-05-28 Thread Zhou, Yingyao via PyMOL-users
Here is the solution. Wonder if someone can help explain why the line below gives an error about print is not defined: out=x.cmd.do("iterate mysel and name CA, print(resi)") Thanks! import pymol2 x=pymol2.PyMOL() x.start() x.cmd.do("fetch 1crn; select mysel, /1crn//A/10-20") out=[] def f(ch

[PyMOL] How to obtain a PyMOL selection within Python

2024-05-28 Thread Zhou, Yingyao via PyMOL-users
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