PPTs logo

Table Of Contents

Using pyParaTools with pyMOL

PyMOL-pyParaTools coupling will be supported in future versions. As a reference here are some examples of how PyParaTools can be invoked by pyMOL and how PyMOL can invoke pyParaTools.

Running pyParaTools protocols in pyMOL

Determining if pyParaTools is being invoked within pyMOL:

>>> from pymol import *
>>> cmd.load("m0.pdb")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/pymol/importing.py", line 869, in load
    _self.unlock(r,_self)
  File "/usr/lib/pymodules/python2.6/pymol/locking.py", line 79, in unlock
    if (thread.get_ident() == pymol.glutThread):
AttributeError: 'module' object has no attribute 'glutThread'

If being run from the command line and AttributeError ‘glutThread’ will be raised. This is a simple check that can be exploited.

Spawning PyMOL from pyParaTools

>>> import __main__
>>> #__main__.pymol_argv = [ 'pymol', '-qc'] To pass argument
>>>
>>> import sys, time, os
>>> import pymol
>>>
>>> pymol.finish_launching()

Building a fully-fledged PyMOL pyParaTools plugin