In a Python script I am working on I would like to get a list of the
scenes that are defined. Unfortunately, cmd.scene('*') just prints the
list to stdout, but doesn't return anything. That is, if I have a
script test.py that looks like
from pymol import cmd
x = cmd.scene('*')
print x
And I type "run test.py" in PyMol I get the following output
PyMOL>run test.py
scene: stored scenes:
F1 F2
x='None'
Is there a different mechanism to get a list of defined scenes? Or an
argument, I've missed?
I have the following work around
from pymol import cmd
import sys
from StringIO import StringIO
tmp = StringIO()
(tmp,sys.stdout) = (sys.stdout,tmp)
cmd.scene('*')
(tmp,sys.stdout) = (sys.stdout,tmp)
list = tmp.getvalue().split("\n")[1].split()
print list
which generates what I want
PyMOL>run test.py
['F1', 'F2']
but that seems less than elegant.
Malcolm