Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Image' object has no attribute 'tostring' #4044

Closed
kexul opened this issue Apr 16, 2021 · 1 comment
Closed

AttributeError: 'Image' object has no attribute 'tostring' #4044

kexul opened this issue Apr 16, 2021 · 1 comment

Comments

@kexul
Copy link

kexul commented Apr 16, 2021

Describe the bug
MolToImage not working

To Reproduce

Python 3.7.8 | packaged by conda-forge | (default, Nov 17 2020, 23:45:15) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from rdkit import Chem 
>>> a = Chem.MolFromSmiles('CCCCC') 
>>> from rdkit.Chem.Draw import MolToImage
>>> b = MolToImage(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/miniconda3/envs/uii/lib/python3.7/site-packages/rdkit/Chem/Draw/__init__.py", line 101, in MolToImage
    img, canvas = _createCanvas(size)
  File "/data/miniconda3/envs/uii/lib/python3.7/site-packages/rdkit/Chem/Draw/__init__.py", line 56, in _createCanvas
    canvas = Canvas(img)
  File "/data/miniconda3/envs/uii/lib/python3.7/site-packages/rdkit/Chem/Draw/cairoCanvas.py", line 147, in __init__
    imgd = getattr(image, 'tobytes', image.tostring)("raw", "BGRA")
AttributeError: 'Image' object has no attribute 'tostring'

Configuration (please complete the following information):

  • RDKit version: 2019.09.3
  • OS: centos
  • Python version (if relevant): 3.7.8
  • Are you using conda? yes
  • If you are using conda, which channel did you install the rdkit from? conda-forge
@kexul kexul added the bug label Apr 16, 2021
@greglandrum
Copy link
Member

This has been fixed in the most recent version of the RDKit: 2020.03.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants