Re: [Open Babel] Compressed pybel.Outputfile output

2015-04-25 Thread Maciek Wójcikowski
Hi Matthew, In latest version of OB (master branch on github) automatically detects .gz extensions and compresses the output - adds "-z" option to converter. https://github.com/openbabel/openbabel/blob/master/scripts/python/pybel.py#L253 If you're using newest OB it should work out of the box. Oth

Re: [Open Babel] Compressed pybel.Outputfile output

2015-04-24 Thread Matthew Lardy
Hi Stefano, That worked! Thanks! Matthew On Fri, Apr 24, 2015 at 3:34 PM, Stefano Forli wrote: > Hi Matthew, > I guess something like this could do the trick: > - > import gzip > import pybel > > mol = pybel.readfile('sdf', 'filename.sdf').next() > outfilename = 'exampl

Re: [Open Babel] Compressed pybel.Outputfile output

2015-04-24 Thread Stefano Forli
Hi Matthew, I guess something like this could do the trick: - import gzip import pybel mol = pybel.readfile('sdf', 'filename.sdf').next() outfilename = 'example.sdf.gz' output = gzip.open(outfilename, 'wb') molString = mol.write(format='sdf') output.write(molString) output.