asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

TypeError on MacOs #783

Open turbolay opened 1 year ago

turbolay commented 1 year ago

pyautogui version 0.9.54 python 3.10.9 64b macOs Ventura 13.1 - M2 Chip

I can't use pixel utilities with pyautogui, I always have the error '<' not supported between instances of 'str' and 'int' even for simpliest code like:

import pyautogui
im1 = pyautogui.screenshot()

Same for pyautogui.pixel(100,100).

I didn't find any reference of this problem anywhere. Any idea? Am I missing a permission or something like that?

damies13 commented 1 year ago

Thank you @turbolay, I'm getting the same error with ImageHorizonLibrary when it calls pyautogui.screenshot(), I just started investigating this issue and found your issue, good to know I'm not the only one.

I'll add additional info as I run my automated test's using github actions with ubuntu-latest, macos-latest and windows-lates,

Hope that helps.

damies13 commented 1 year ago

FYI adding this to my requirements.txt file worked around this issue for me

# pyscreeze 0.1.29 doesn't seem to work with pyautogui 0.9.53
pyscreeze==0.1.28
# pyautogui 0.9.54 has issues on MacOS https://github.com/asweigart/pyautogui/issues/783
# pyautogui is a prerequisite of imagehorizonlibrary
pyautogui!=0.9.54
ffdd270 commented 1 year ago

https://github.com/asweigart/pyscreeze/commit/dbe9cb8938d47cf5586f4a4a409eb093c900fa11

Perhaps this commit is causing the problem.

Replacing the offending PIL__version check with the code below will fix the issue.

if tuple(map(int, PIL__version__.split('.'))) < (6, 2, 1):