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
>



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands

------------------------------------------------------------------------------
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

Reply via email to