reddit-place-script-2022 icon indicating copy to clipboard operation
reddit-place-script-2022 copied to clipboard

IndexError: image index out of range

Open KingWifi opened this issue 2 years ago • 10 comments

Bug Report Form

Checklist

  • [x] I am using the latest version of the code.
  • [x] I am absolutely sure I read the README in its entirety.
  • [x] I have made sure this is not a duplicate issue.
  • [x] I have filled out this form correctly.

cmd output:

[02-Apr-22 23:11:30] :: [INFO] - place-script started
[02-Apr-22 23:11:30] :: [INFO] - Loaded image size: (48, 34)
[02-Apr-22 23:11:31] :: [INFO] - Thread #0 ::
[02-Apr-22 23:11:31] :: [INFO] - Thread #0 :: Refreshing access token
[02-Apr-22 23:11:31] :: [INFO] - Thread #3 ::
[02-Apr-22 23:11:31] :: [INFO] - Thread #1 ::
[02-Apr-22 23:11:31] :: [INFO] - Thread #1 :: Refreshing access token
[02-Apr-22 23:11:31] :: [INFO] - Thread #3 :: Refreshing access token
[02-Apr-22 23:11:31] :: [INFO] - Thread #2 ::
[02-Apr-22 23:11:31] :: [INFO] - Thread #4 ::
[02-Apr-22 23:11:31] :: [INFO] - Thread #2 :: Refreshing access token
[02-Apr-22 23:11:31] :: [INFO] - Thread #4 :: Refreshing access token
[02-Apr-22 23:11:32] :: [INFO] - Received new access token: 16820************
An error occured. Make sure you have the correct credentials. Response data: {'error_description': 'Only script apps may use password auth', 'error': 'unauthorized_client'}[02-Apr-22 23:11:32] :: [INFO] - Getting board

[02-Apr-22 23:11:32] :: [INFO] - Received new access token: 16819************
[02-Apr-22 23:11:32] :: [INFO] - Getting board
[02-Apr-22 23:11:32] :: [INFO] - Received new access token: 16820************
[02-Apr-22 23:11:32] :: [INFO] - Getting board
[02-Apr-22 23:11:32] :: [INFO] - Received new access token: 16818************
Got image:[02-Apr-22 23:11:33] :: [INFO] - Thread #0 ::
Got image:

Got image:
Exception in thread Exception in thread Thread-5 (task)Thread-4 (task):
Exception in thread Traceback (most recent call last):
Thread-2 (task)  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
:
:
Traceback (most recent call last):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
        self.run()self.run()

  File "C:\Python310\lib\threading.py", line 946, in run
  File "C:\Python310\lib\threading.py", line 946, in run
        self.run()self._target(*self._args, **self._kwargs)

  File "C:\Python310\lib\threading.py", line 946, in run
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
        self._target(*self._args, **self._kwargs)self._target(*self._args, **self._kwargs)

  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
        current_r, current_c, new_rgb = self.get_unset_pixel(current_r, current_c, new_rgb = self.get_unset_pixel(

  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
        current_r, current_c, new_rgb = self.get_unset_pixel(target_rgb = self.pix[x, y][:3]

  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
IndexError    : target_rgb = self.pix[x, y][:3]image index out of range

IndexError    : target_rgb = self.pix[x, y][:3]image index out of range

IndexError: image index out of range

KingWifi avatar Apr 03 '22 03:04 KingWifi

Hello, do you get the same error when using the image provided in the repo?

rdeepak2002 avatar Apr 03 '22 03:04 rdeepak2002

Also which position on the r/place canvas are you attempting to draw the image?

rdeepak2002 avatar Apr 03 '22 03:04 rdeepak2002

An error occured. Make sure you have the correct credentials. Response data: {'error_description': 'Only script apps may use password auth', 'error': 'unauthorized_client'} You didn't set up your Reddit API app correctly. Make sure it's set as a script.

Randomblock1 avatar Apr 03 '22 03:04 Randomblock1

@Randomblock1 @rdeepak2002 I fixed one of the IDs, but I am still getting the image index out of range error. I have 5 accounts, and for each one, it shows an error and then tries the next account until it stops running:

D:\reddit-place-script-2022-main\reddit-place-script-2022-main>python main.py
[03-Apr-22 00:15:30] :: [INFO] - place-script started
[03-Apr-22 00:15:30] :: [INFO] - Loaded image size: (48, 34)
[03-Apr-22 00:15:31] :: [INFO] - Thread #0 ::
[03-Apr-22 00:15:31] :: [INFO] - Thread #0 :: Refreshing access token
[03-Apr-22 00:15:32] :: [INFO] - Received new access token: 16818************
[03-Apr-22 00:15:32] :: [INFO] - Getting board
Got image:
Exception in thread Thread-1 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
    current_r, current_c, new_rgb = self.get_unset_pixel(
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
    target_rgb = self.pix[x, y][:3]
IndexError: image index out of range
[03-Apr-22 00:15:33] :: [INFO] - Thread #1 ::
[03-Apr-22 00:15:33] :: [INFO] - Thread #1 :: Refreshing access token
[03-Apr-22 00:15:34] :: [INFO] - Received new access token: 16819************
[03-Apr-22 00:15:34] :: [INFO] - Getting board
Got image:
Exception in thread Thread-2 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
    current_r, current_c, new_rgb = self.get_unset_pixel(
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
    target_rgb = self.pix[x, y][:3]
IndexError: image index out of range
[03-Apr-22 00:15:35] :: [INFO] - Thread #2 ::
[03-Apr-22 00:15:35] :: [INFO] - Thread #2 :: Refreshing access token
[03-Apr-22 00:15:36] :: [INFO] - Received new access token: 16819************
[03-Apr-22 00:15:36] :: [INFO] - Getting board
Got image:
Exception in thread Thread-3 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
    current_r, current_c, new_rgb = self.get_unset_pixel(
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
    target_rgb = self.pix[x, y][:3]
IndexError: image index out of range
[03-Apr-22 00:15:37] :: [INFO] - Thread #3 ::
[03-Apr-22 00:15:37] :: [INFO] - Thread #3 :: Refreshing access token
[03-Apr-22 00:15:38] :: [INFO] - Received new access token: 16820************
[03-Apr-22 00:15:38] :: [INFO] - Getting board
Got image:
Exception in thread Thread-4 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
    current_r, current_c, new_rgb = self.get_unset_pixel(
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
    target_rgb = self.pix[x, y][:3]
IndexError: image index out of range
[03-Apr-22 00:15:39] :: [INFO] - Thread #4 ::
[03-Apr-22 00:15:39] :: [INFO] - Thread #4 :: Refreshing access token
[03-Apr-22 00:15:40] :: [INFO] - Received new access token: 16820************
[03-Apr-22 00:15:40] :: [INFO] - Getting board
Got image:
Exception in thread Thread-5 (task):
Traceback (most recent call last):
  File "C:\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 484, in task
    current_r, current_c, new_rgb = self.get_unset_pixel(
  File "D:\reddit-place-script-2022-main\reddit-place-script-2022-main\main.py", line 337, in get_unset_pixel
    target_rgb = self.pix[x, y][:3]
IndexError: image index out of range

KingWifi avatar Apr 03 '22 04:04 KingWifi

Are you trying to place in an x-coordinate over 1000? If so, the script version you have is not set up to deal with x>1000. Please try using the updated script.

PopcornPlant avatar Apr 03 '22 05:04 PopcornPlant

Are you trying to place in an x-coordinate over 1000? If so, the script version you have is not set up to deal with x>1000. Please try using the updated script.

I am having this same issue as well. I just re-downloaded everything from the repo and doesnt work, Can you link me a version of the script that fixes this if it exists?

Benjamin5678 avatar Apr 03 '22 06:04 Benjamin5678

@Randomblock1 My x coordinate is not above 1000. Any ideas what might be the problem?

KingWifi avatar Apr 03 '22 09:04 KingWifi

Are you using a JPEG or PNG file ? Sometimes PNG files cause issues. One way to resolve it is to open the file in MS Paint, then save it as a new PNG file and try again with the new file.

RomainL972 avatar Apr 03 '22 11:04 RomainL972

Are you trying to place in an x-coordinate over 1000? If so, the script version you have is not set up to deal with x>1000. Please try using the updated script.

There's no version yet which supports placement for coordinate with x over 1000

smith558 avatar Apr 03 '22 12:04 smith558

2022-04-03 11:45:56.906 | INFO | main:task:542 - Obtaining access token... Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\bestg\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\bestg\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "main.py", line 590, in task current_r, current_c, new_rgb = self.get_unset_pixel( File "main.py", line 395, in get_unset_pixel if pix2[x + self.pixel_x_start, y + self.pixel_y_start] != new_rgb: IndexError: image index out of range

Getting similar errors, tried both png and jpg

bestgio avatar Apr 03 '22 15:04 bestgio