This is a test version of Biostars. For the public version, visit https://www.biostars.org.
creating a python script to load a protein molecule and export it as .png file in pymol, without using GUI

Hi friends, I am trying to create a python script which can load a protein molecule from a .pdb file and export it as .png file in pymol, without the GUI opening up. This is my script :

#!/usr/bin/env python
import __main__
__main__.pymol_argv = [ 'pymol', '-c'] 
import sys, time, os
import pymol
pymol.finish_launching()
spath = os.path.abspath(sys.argv[1])
sname = spath.split('/')[-1].split('.')[0]
pymol.cmd.load(spath, sname)
pymol.cmd.disable("all")
pymol.cmd.enable(sname)
pymol.cmd.hide('all')
pymol.cmd.png("my_image.png")
pymol.cmd.quit()

I am not getting a png image of the molecule. Pls help me out.

pymol

0 answers

No answers yet.

Log in to answer this question.