rrwick / Trycycler

A tool for generating consensus long-read assemblies for bacterial genomes
GNU General Public License v3.0
306 stars 28 forks source link

AttributeError: 'ImageDraw' object has no attribute 'textsize' #68

Closed noahmueller97 closed 6 months ago

noahmueller97 commented 10 months ago

Hello there,

Thank you very much for providing this great tool. After following the steps in your trycycler guide I wanted to create a dotplot using the following command,

trycycler dotplot --cluster_dir trycycler/cluster_001

as it is written in the guide. Unfortunately I received the following error:

Traceback (most recent call last):
  File "/home/noah/miniconda3/envs/research_project/bin/trycycler", line 10, in <module>
    sys.exit(main())
  File "/home/noah/miniconda3/envs/research_project/lib/python3.10/site-packages/trycycler/__main__.py", line 45, in main
    dotplot(args)
  File "/home/noah/miniconda3/envs/research_project/lib/python3.10/site-packages/trycycler/dotplot.py", line 43, in dotplot
    image = create_dotplots(seq_names, seqs, args)
  File "/home/noah/miniconda3/envs/research_project/lib/python3.10/site-packages/trycycler/dotplot.py", line 90, in create_dotplots
    draw_labels(image, seq_names, start_positions, end_positions, text_gap, outline_width,
  File "/home/noah/miniconda3/envs/research_project/lib/python3.10/site-packages/trycycler/dotplot.py", line 174, in draw_labels
    get_font(draw, name, font_size, start_positions[name], end_positions[name])
  File "/home/noah/miniconda3/envs/research_project/lib/python3.10/site-packages/trycycler/dotplot.py", line 253, in get_font
    text_width, text_height = draw.textsize(label, font=font)
AttributeError: 'ImageDraw' object has no attribute 'textsize'

After creating a new environment and using python version 3.9 the issue still persisted. Then I found a related issue here from October 27, 2021. Following your advice and therefore replacing the dotplot.py file with the one you provided solved the problem for me. Nevertheless I wanted to let you know that the issue might still persist.

Ubuntu release: 22.04 Trycycler version: v0.5.4

Thank you and have a nice weekend.

Cheers,

Noah

rrwick commented 6 months ago

This should be fixed in the latest release of Trycycler (v0.5.5) which is now on Bioconda.

Ryan