Malcolm, I believe the method you want is:
print cmd.get_scene_list() Hopefully that method is present in the PyMOL build you are running! Cheers, Warren > -----Original Message----- > From: Malcolm E Davis [mailto:malcolm.da...@bms.com] > Sent: Friday, December 19, 2008 3:46 PM > To: pymol-users@lists.sourceforge.net > Subject: [PyMOL] cmd.scene('*') > > 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 > > ------------------------------------------------------------------------ -- > ---- > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pymol-users > > >