Closed arisliang closed 2 years ago
Hi @arisliang, I hope you are doing well. Yes, I see this too.
This behaviour changed after 3.10 None
values do not behave the same. As you can no longer run int(None)
. Which throws the [Type Conversion error] (https://docs.python.org/3.10/library/functions.html#int). But it should not as it hasn't even been updated yet in the main documentation. int(None) ""used"" to return Zero, hence why we are seeing this complain.
int(None)
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
I did some digging around and created a fix for you. if you want to resolve this on your machine as a workaround until this gets resolved do the following.
in your error you will get the path to the file it is complaining on line 701 of pyautogui.init Copy that path and open the file in your text editor.
THEN: Paste these two lines into your existing pyautogui installed package: (mine is line 701 & 702):
firstArg = 0 if firstArg is None else firstArg
secondArg = 0 if secondArg is None else secondArg
It should look like this:
else:
firstArg = 0 if firstArg is None else firstArg
secondArg = 0 if secondArg is None else secondArg
return Point(int(firstArg), int(secondArg)) # firstArg and secondArg are just x and y number values
You can reference my commit if it helps visually.
pip install pyautogui --upgrade --force
# OR
pip3 install pyautogui --upgrade --force
** Now in my search I discovered another odd behaviour that I addressed in #690. and PR691 Separately, but just as an FYI.
Have a Great day!
Thanks for the fix. I can wait for the next release.
There's an example usage in readme
pyautogui.move(None, 10)
.It runs with error in repl:
version: '0.9.53' windows 10