From: Martin H. <ma...@bl...> - 2011-02-09 12:44:07
|
Dear all I was just working through the Plugin tutorial http://www.pymolwiki.org/index.php/Plugins_Tutorial Writing the plugin from the tutorial as is shown, I happen to receive a gzip error (from the Python Shell): >>> zlib.decompress(pdbFile.read()[22:], -zlib.MAX_WBITS) Traceback (most recent call last): File "<stdin>", line 1, in<module> zlib.error: Error -5 while decompressing data So I figured, why is the PDB file decompressed in the first place, why not just call the PDB file directly from the PDB database: def remote(pdbCode): pdbCode = pdbCode.upper() try: *pdbFile = urllib2.urlopen('http://www.pdb.org/pdb/files/' + pdbCode + '.pdb')* #pdbFile = urllib2.urlopen('http://www.rcsb.org/pdb/cgi/export.cgi/' + # pdbCode + '.pdb.gz?format=PDB&pdbId=' + # pdbCode + '&compression=gz') #cmd.read_pdbstr(zlib.decompress(pdbFile.read()[22:], -zlib.MAX_WBITS), # pdbCode) *cmd.read_pdbstr(pdbFile.read()[22:], pdbCode)* except: print "Unexpected Error:", sys.exc_info()[0] tkMessageBox.showerror('Invalid Code', pdbCode) This seems to work fine in the sense that the PDB file is correctly downloaded and loaded into the PyMOL viewer. I have two questions now: 1) Are there any problems I could run into using this approach? 2) I was thinking its a bit tedious to reinstall a plugin everytime I change a single line of code. Is there an easy and smart way to see how new code is working within PyMOL without having to reinstall the plugin all the time? Thanks for any suggestions. |