Cedric MORETTI wrote:
>
> Hello all,
>
> I have I little problem with RDKIT( I hope :D)
>
> My program don’t arrive to close the SDwriter whereas I put the 
> command “writer.close()” and Chem.SDWriter.close() in the end of programm
>
> I just let the part of the code that is import for understand the 
> problem and the error.
>
> I have the error when the program has finished to read the file
>
> Tks
>
> C
>
> from sys import *
>
> #from ChemScript11 import *
>
> from cinfony import rdk
>
> from rdkit import Chem
>
> import time
>
> reader1 = Chem.SDMolSupplier(sys.argv[0])
>
> writer = Chem.SDWriter(sys.argv[1])
>
> z = 0
>
> for mol in reader1:
>
> “
>
> [Blablablablabla ( It’s to simulate a code)]
>
> writer.write(mol)
>
> writer.close()
>
> reader1.close()
>
> Chem.SDWriter.close()
>
> Traceback (most recent call last):
>
> File "C:\Scripttravail\supermain.py", line 18, in <module>
>
> exec(file.read())
>
> File "<string>", line 51, in <module>
>
> AttributeError: 'SDWriter' object has no attribute 'close
>
> **********************************************************************
> DISCLAIMER
> This email and any files transmitted with it, including replies and forwarded 
> copies (which may contain alterations) subsequently transmitted from 
> Firmenich, are confidential and solely for the use of the intended recipient. 
> The contents do not represent the opinion of Firmenich except to the extent 
> that it relates to their official business.
> **********************************************************************
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> ------------------------------------------------------------------------
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Hi Cedric,
the Chem.SDWriter Object does not need to be closed, does it? It is 
automatically closed at the end of your program.
It doesn't even have a method that is named 'close()' like the ones you 
might know from python text file I/O objects.
This is what the Traceback error complains when it says :
->AttributeError: 'SDWriter' object has no attribute 'close'
So you should go well with simply deleting the three lines at the end of 
your script that give the .close() commands.
Hope this helps,
Markus

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to