I'm trying to start PyMol from another python program.
After the 0_99beta17 it is possible to start it from the __main__ part of a code. But when I start PyMol from a function 'pymol.finish_launching()' goes in an endless loop.
Here goes an example:
---------------------------------------------------------------
def funct():
  import __main__
  __main__.pymol_argv = [ 'pymol', '-qx' ]
  import pymol
  pymol.finish_launching()
print "finished"
if __name__ == '__main__':
  funct()
---------------------------------------------------------------
In this case PyMol window starts, but program never reaches 'print "finished"'.
The same time
---------------------------------------------------------------
if __name__ == '__main__':
  import __main__
  __main__.pymol_argv = [ 'pymol', '-qx' ]
  import pymol
  pymol.finish_launching()
  print "finished"
---------------------------------------------------------------
works fineand prints "finshed"
after getting into PyMol's finish_launching()  (inside __init__.py)
while not hasattr(__main__,'pymol'):
  e.wait(0.01)
Goes in an endless loop.
I've tried print dir(__main__) just before this loop. When PyMol is launched not from a function, __main__ indeed have attributes '__main__' and 'pymol'. Launched from a function, there are no '__main__' or 'pymol', but 'funct'. I'll really appreciate any help or hints how make it possible to launch PyMol from a function or from a method of some class.
 Dmitriy


Reply via email to