Ok, good to know. I was using the code as shown on the tutorials page, and since I have only limited experience with the zlib module, I was not exactly sure about what it's doing in the first place. I am still wondering though if it is possible to avoid the reinstallment of the plugin whenever a line in the code is changed to see how it affects the functionality. Can this be circumvented somehow?
Martin On 09.02.11 15:57, Tsjerk Wassenaar wrote: > Hi Martin, > > I have trouble to see how the window buffer size could be negative. > Probably it should be > > zlib.decompress(pdbFile.read()[22:], zlib.MAX_WBITS) > > Downloading in compressed form is much more efficient. But otherwise I > don't think it should give you trouble doing it like that. > > Cheers, > > Tsjerk > > On Wed, Feb 9, 2011 at 1:43 PM, Martin Hediger<ma....@bluewin.ch> wrote: >> 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. >> >> >> >> >> ------------------------------------------------------------------------------ >> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: >> Pinpoint memory and threading errors before they happen. >> Find and fix more than 250 security defects in the development cycle. >> Locate bottlenecks in serial and parallel code that limit performance. >> http://p.sf.net/sfu/intel-dev2devfeb >> _______________________________________________ >> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) >> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users >> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net >> > > ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net) Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net