C:\Users\ryan\Desktop\py scrypts>python wack.py
Traceback (most recent call last):
File "C:\Users\ryan\Desktop\py scrypts\wack.py", line 60, in <module>
main()
File "C:\Users\ryan\Desktop\py scrypts\wack.py", line 43, in main
screenshot = pg.screenshot(region=(startScreenshotCornerX, startScreenshotCornerY, 50, 1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ryan\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyautogui_init_.py", line 228, in _couldNotImportPyScreeze
raise PyAutoGUIException(
pyautogui.PyAutoGUIException: PyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call.
#π cant fix error code
56 messages Β· Page 1 of 1 (latest)
@crystal atlas
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
What happens if you explicitly install pyscreeze with pip install pyscreeze?
C:\Users\ryan\Desktop\py scrypts>pip install pyscreeze
Requirement already satisfied: pyscreeze in c:\users\ryan\appdata\local\programs\python\python312\lib\site-packages (0.1.30)
the code i copied is a year old
Is it a photo that its trying to load?
Can you share the output of python --version for us?
i think
Then make sure the photo is named exactly what the code is trying to load
Python 3.12.5
Just for the sake of argument, could you also run python -m pip install pyscreeze and see if the output is different?
C:\Users\ryan\Desktop\py scrypts>python -m pip install pyscreeze
Requirement already satisfied: pyscreeze in c:\users\ryan\appdata\local\programs\python\python312\lib\site-packages (0.1.30)
idk were it is geting the pictures from
1 sec
'''import pyautogui as pg
import multiprocessing as mp
import time
Variables to modify
sceneScreenshotCornerX = 350
sceneScreenshotCornerY = 210
sceneScreenshotWidth = 650
sceneScreenshotHeight = 640
leftBorderToToilet = 69
topBorderToToilet = 135
toiletToToiletX = 130
toiletToToiletY = 213
startScreenshotCornerX = 900
startScreenshotCornerY = 100
startButtonX = 700
startButtonY = 1000
gameFPS = 60 # Set this number to the FPS your game runs at
gameplaySeconds = 60 # If you didn't fully upgrade the Whack-A-Potato game time, set this to how many seconds your game lasts
-------------------
def launchAutoclicker():
time.sleep(3)
while True:
# Get toilets screenshot and check for potatoes
screenshot = pg.screenshot(region=(sceneScreenshotCornerX, sceneScreenshotCornerY, sceneScreenshotWidth, sceneScreenshotHeight))
#screenshot.save("screenshot1.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for y in range(topBorderToToilet, sceneScreenshotHeight, toiletToToiletY): # 3 rows
for x in range(leftBorderToToilet, sceneScreenshotWidth, toiletToToiletX): # 5 columns
if screenshot.getpixel((x,y))[0] > 200: # If brown or golden, click
pg.click(x + sceneScreenshotCornerX,y + sceneScreenshotCornerY)
time.sleep(1 / gameFPS)
def main():
while True:
# Checks if game can start
screenshot = pg.screenshot(region=(startScreenshotCornerX, startScreenshotCornerY, 50, 1))
#screenshot.save("screenshot2.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for startX in range(0, 50):'''
# If the game can start, launch launchAutoclicker() independently
if screenshot.getpixel((startX, 0))[2] > 200:
clickerProcess = mp.Process(target=launchAutoclicker)
clickerProcess.start()
pg.click(startButtonX, startButtonY)
time.sleep(gameplaySeconds + 5)
clickerProcess.kill()
break
# Wait one second between checks (remove this if you want it to never stop checking, not recommended)
time.sleep(1)
START
if name == 'main':
main()
Hey @crystal atlas!
It looks like you are trying to paste code into this channel.
You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.
Here is an example of how it should look:
```
Hello, world!
```
This will result in the following:
Hello, world!```
You can **edit your original message** to correct your code block.
Uh
Pls send it again but like this
Three of these b4 the msg --> ```py
And then anither three at the end
so py
So it gets rendered as python code and easier to read
'''py import pyautogui as pg
import multiprocessing as mp
import time
Variables to modify
sceneScreenshotCornerX = 350
sceneScreenshotCornerY = 210
sceneScreenshotWidth = 650
sceneScreenshotHeight = 640
leftBorderToToilet = 69
topBorderToToilet = 135
toiletToToiletX = 130
toiletToToiletY = 213
startScreenshotCornerX = 900
startScreenshotCornerY = 100
startButtonX = 700
startButtonY = 1000
gameFPS = 60 # Set this number to the FPS your game runs at
gameplaySeconds = 60 # If you didn't fully upgrade the Whack-A-Potato game time, set this to how many seconds your game lasts
-------------------
def launchAutoclicker():
time.sleep(3)
while True:
# Get toilets screenshot and check for potatoes
screenshot = pg.screenshot(region=(sceneScreenshotCornerX, sceneScreenshotCornerY, sceneScreenshotWidth, sceneScreenshotHeight))
#screenshot.save("screenshot1.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for y in range(topBorderToToilet, sceneScreenshotHeight, toiletToToiletY): # 3 rows
for x in range(leftBorderToToilet, sceneScreenshotWidth, toiletToToiletX): # 5 columns
if screenshot.getpixel((x,y))[0] > 200: # If brown or golden, click
pg.click(x + sceneScreenshotCornerX,y + sceneScreenshotCornerY)
time.sleep(1 / gameFPS)
def main():
while True:
# Checks if game can start
screenshot = pg.screenshot(region=(startScreenshotCornerX, startScreenshotCornerY, 50, 1))
#screenshot.save("screenshot2.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for startX in range(0, 50):
# If the game can start, launch launchAutoclicker() independently
if screenshot.getpixel((startX, 0))[2] > 200:
clickerProcess = mp.Process(target=launchAutoclicker)
clickerProcess.start()
pg.click(startButtonX, startButtonY)
time.sleep(gameplaySeconds + 5)
clickerProcess.kill()
break
# Wait one second between checks (remove this if you want it to never stop checking, not recommended)
time.sleep(1)
START
if name == 'main':
main()'''
sorry im suck
Xd
lol
ok
```py
# Put code here
Select msg
Copy
And replace the # put code here with code and it should work
import pyautogui as pg
import multiprocessing as mp
import time
# Variables to modify #
sceneScreenshotCornerX = 350
sceneScreenshotCornerY = 210
sceneScreenshotWidth = 650
sceneScreenshotHeight = 640
leftBorderToToilet = 69
topBorderToToilet = 135
toiletToToiletX = 130
toiletToToiletY = 213
startScreenshotCornerX = 900
startScreenshotCornerY = 100
startButtonX = 700
startButtonY = 1000
gameFPS = 60 # Set this number to the FPS your game runs at
gameplaySeconds = 60 # If you didn't fully upgrade the Whack-A-Potato game time, set this to how many seconds your game lasts
# ------------------- #
def launchAutoclicker():
time.sleep(3)
while True:
# Get toilets screenshot and check for potatoes
screenshot = pg.screenshot(region=(sceneScreenshotCornerX, sceneScreenshotCornerY, sceneScreenshotWidth, sceneScreenshotHeight))
#screenshot.save("screenshot1.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for y in range(topBorderToToilet, sceneScreenshotHeight, toiletToToiletY): # 3 rows
for x in range(leftBorderToToilet, sceneScreenshotWidth, toiletToToiletX): # 5 columns
if screenshot.getpixel((x,y))[0] > 200: # If brown or golden, click
pg.click(x + sceneScreenshotCornerX,y + sceneScreenshotCornerY)
time.sleep(1 / gameFPS)
def main():
while True:
# Checks if game can start
screenshot = pg.screenshot(region=(startScreenshotCornerX,
startScreenshotCornerY, 50, 1))
#screenshot.save("screenshot2.png") # If you want to see the screenshot for testing remove the first "#" on this line (saving the screenshot takes up time and will kill the autoclicking)
for startX in range(0, 50):
# If the game can start, launch launchAutoclicker() independently
if screenshot.getpixel((startX, 0))[2] > 200:
clickerProcess = mp.Process(target=launchAutoclicker)
clickerProcess.start()
pg.click(startButtonX, startButtonY)
time.sleep(gameplaySeconds + 5)
clickerProcess.kill()
break
# Wait one second between checks (remove this if you want it to never stop checking, not recommended)
time.sleep(1)
### START ###
if __name__ == '__main__':
main()
π
Good job
@crystal atlas Okay. My best guess is that pyscreeze hasn't been updated to require a version of Pillow that's compatible with Python 3.12.
I recommend moving to Python 3.11.
uninstall 3.12
You might also try manually installing pillow and see what happens.
See this pull request: https://github.com/asweigart/pyscreeze/pull/115/commits that's languished for 6 months
pip install pyautogui
Microsoft Windows [Version 10.0.22631.4037]
(c) Microsoft Corporation. All rights reserved.
C:\Users\ryan>"C:\Users\ryan\Desktop\py scrypts\wack.py"
now it is not runing
1st time with cmd:(
Use underscores. spaces are unpredictable
how do I install it manually
setup.py what do i do with this
where do i put it
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.