Reputation: 169
I ran into this dependency problem between captcha.image.ImageCaptcha and Pillow today.
in exection: 'ImageDraw' object has no attribute 'textsize'
exc<0> File "C:\Users\farn\anaconda3\envs\TestDragonCondaEnv311_Windows\Lib\site-packages\captcha\image.py", type <class 'AttributeError'>, line 165, in _draw_character: [AttributeError] 'ImageDraw' object has no attribute 'textsize'
0 : <FrameSummary file C:\Users\farn\Documents\prgm\TestDragon\Server\TestDragonPlaygroundServer\src\SvUtil.py, line 6106 in getSvCaptchaImage>
1 : <FrameSummary file C:\Users\farn\anaconda3\envs\TestDragonCondaEnv311_Windows\Lib\site-packages\captcha\image.py, line 45 in generate>
2 : <FrameSummary file C:\Users\farn\anaconda3\envs\TestDragonCondaEnv311_Windows\Lib\site-packages\captcha\image.py, line 228
in generate_image>
3 : <FrameSummary file C:\Users\farn\anaconda3\envs\TestDragonCondaEnv311_Windows\Lib\site-packages\captcha\image.py, line 199
in create_captcha_image>
4 : <FrameSummary file C:\Users\farn\anaconda3\envs\TestDragonCondaEnv311_Windows\Lib\site-packages\captcha\image.py, line 165
in _draw_character>
---<0>-------------
somehow!
'ImageDraw' object has no attribute 'textsize'
[Thread-7 (process_request_thread)][INFO] 192.168.50.82 - - [07/Nov/2024 00:38:15] "GET /500.html HTTP/1.0" 4
I read some posts saying that Pillow has changed textsize to textlength.
Pillow deprecated textsize without concern of backward compatibility
But the problem is that the error happened inside captcha.image.ImageCaptcha.
I don't think it is OK for me to change captcha code since I am not in their team.
I neither know how this happened to my conda environment since all scripts ran well until today.
Can someone tell me what the compatible version numbers between Pillow and captcha are ?
Thank you very much.
Farn
Upvotes: 0
Views: 100
Reputation: 169
I just read from
older version with warning message with textsize
which says that pillow==9.5.0 still supports textsize.
Looks OK for me now.
But they said you will get a warning message for using outdated pillow.
Upvotes: 0