#πŸ”’ cant fix error code

56 messages Β· Page 1 of 1 (latest)

crystal atlas
#

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.

dusty gobletBOT
#

@crystal atlas

Python help channel opened

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.

hoary patrol
#

What happens if you explicitly install pyscreeze with pip install pyscreeze?

crystal atlas
#

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

crisp remnant
#

Is it a photo that its trying to load?

hoary patrol
#

Can you share the output of python --version for us?

crystal atlas
#

i think

crisp remnant
crystal atlas
#

Python 3.12.5

hoary patrol
#

Just for the sake of argument, could you also run python -m pip install pyscreeze and see if the output is different?

crystal atlas
#

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

crisp remnant
#

bro

#

Shwo code

#

Lemme see

crystal atlas
#

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()

dusty gobletBOT
#

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.
crisp remnant
#

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

crystal atlas
#

'''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

crisp remnant
#

Xd

crystal atlas
#

lol

crisp remnant
#

Thise are apostrophes

#

Just copy this and put ur code in the middle ok?

#

One sec

crystal atlas
#

ok

crisp remnant
#
```py
# Put code here
#

Select msg

#

Copy

#

And replace the # put code here with code and it should work

crystal atlas
#
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()
#

πŸ™‚

crisp remnant
#

Good job

hoary patrol
#

@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.

crystal atlas
#

uninstall 3.12

hoary patrol
#

You might also try manually installing pillow and see what happens.

crystal atlas
#

pip install pyautogui

north socket
#

Just install pillow

#

manually

crystal atlas
#

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

north socket
#

you have a space in folder name

#

Very scary

crystal atlas
#

1st time with cmd:(

north socket
#

Use underscores. spaces are unpredictable

crystal atlas
#

how do I install it manually

#

where do i put it

dusty gobletBOT
#
Python help channel closed

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.