This is a read-only mirror of pymolwiki.org

RPC

From PyMOL Wiki
Revision as of 03:15, 5 March 2018 by Cchem (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Remote control of PyMOL is possible with XML-RPC.

Launch PyMOL with the "-R" option to start the RPC server.

pymol -R

Connect from any client, using python:

try:
    # Python 2
    import xmlrpclib
except ImportError:
    # Python 3:
    import xmlrpc.client as xmlrpclib

srv = xmlrpclib.Server('http://localhost:9123')

srv.do('fetch 2xwu')
srv.do('as cartoon')
srv.do('spectrum')

# or
srv.fetch('2xwu')
srv.show_as('cartoon')
srv.spectrum()

See Also