Hi,

Probably the designated folder is missing. So, rdkit cannot create the file
in specified path. Thanks.

- malitha

On Wed, Jul 11, 2018, 5:46 AM Phuong Chau <pc...@smith.edu> wrote:

> Hello,
>
> I was trying to draw the 2D structure of a molecule inside a python script
> (.py). It works with other functions such as MolToSmiles,
> FingerPrintMol(),... but somehow the Draw.MolToSmile() function does not
> work. It kept throw errors of:
>  File "PairsFinder.py", line 53, in <module>
>
> Draw.MolToFile(chem,'~/Desktop/work/2018/July/10/500_v2/Chem1_avg7.png')
>   File "/usr/lib/python2.7/dist-packages/rdkit/Chem/Draw/__init__.py",
> line 182, in MolToFile
>     canvas.save()
>   File "/usr/lib/python2.7/dist-packages/rdkit/Chem/Draw/spingCanvas.py",
> line 111, in save
>     self.canvas.save()
>   File "/usr/lib/python2.7/dist-packages/rdkit/sping/PIL/pidPIL.py", line
> 166, in save
>     self._image.save(filename, format=format)
>   File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1672, in save
>     fp = builtins.open(filename, "wb")
> IOError: [Errno 2] No such file or directory:
> '~/Desktop/work/2018/July/10/500_v2/Chem1_avg7.png'
> My script is :
> chem = Chem.MolFromSmiles('Nc1ccccc1F')
> Draw.MolToFile(chem,'~/Desktop/work/2018/July/10/500_v2/Chem1_avg7.png')
>
> Would anyone help me please? How do I run Draw in python script?
>
> Thank you so much for your help
> --
> Phuong Chau
> Smith College '20
> Engineering Major
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to