RogerioBlanco / PixelCanvasBot

A bot to pixelcanvas.io
63 stars 24 forks source link

Errors and exceptions #112

Open Romybron opened 4 years ago

Romybron commented 4 years ago

Hello I have been using your program for 2 days now and it works really well.

But I keep getting errors and exceptions which I bypass with cmd loop

:a
python ./main.py -i XXXX.png -x XXXX -y XXXX --draw_strategy linear
goto a
C:\Users\Laptop\PixelCanvasBot>python ./main.py -i XXXX.png -x XXXX -y XXXX --draw_strategy linear
>> 13:05:56 ->Load cached image
>> 13:06:16 ->Websocket open
>> 13:06:19 ->You painted grey at XXXX,XXXX
>> 13:06:19 ->Waiting 7.983 seconds
>> 13:06:19 ->Somebody updated XXXX,XXXX with grey
[++++++++++++++++++++++++++++++++++++++++++++++++++]
Traceback (most recent call last):
  File "C:\Users\Laptop\PixelCanvasBot\src\pixelcanvasio.py", line 79, in send_pixel
    return response.json()
  File "C:\Users\Laptop\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Laptop\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Laptop\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Laptop\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./main.py", line 139, in <module>
    main()
  File "./main.py", line 134, in main
    run()
  File "./main.py", line 124, in run
    bot.run()
  File "C:\Users\Laptop\PixelCanvasBot\src\bot.py", line 44, in run
    self.strategy.apply()
  File "C:\Users\Laptop\PixelCanvasBot\src\strategy.py", line 72, in apply
    self.bot.paint(self.bot.start_x + x, self.bot.start_y + y, color)
  File "C:\Users\Laptop\PixelCanvasBot\src\bot.py", line 51, in paint
    response = self.pixelio.send_pixel(x, y, color)
  File "C:\Users\Laptop\PixelCanvasBot\src\pixelcanvasio.py", line 81, in send_pixel
    raise Exception(I18n.get('only_time') + str(response.text) + '-' + str(response.status_code))
Exception: >> 13:06:28 ->Error: could not handle the request
-500

C:\Users\Laptop\PixelCanvasBot>goto a

C:\Users\Laptop\PixelCanvasBot>python ./main.py -i XXXX.png -x XXXX -y XXXX --draw_strategy linear
>> 10:51:57 ->Load cached image
>> 10:52:19 ->Websocket open
>> 10:52:21 ->You painted grey at XXXX,XXXX
>> 10:52:21 ->Waiting 7.984 seconds
>> 10:52:21 ->Somebody updated XXXX,XXXX with grey
[++++++++++++++++++++++++++++++++++++++++++++++++++]
>> 10:52:37 ->You painted grey at XXXX,XXXX
>> 10:52:37 ->Waiting 7.984 seconds
>> 10:52:37 ->Somebody updated XXXX,XXXX with grey
[++++++++++++++++++++++++++++++++++++++++++++++++++]
>> 10:52:46 ->You painted grey at XXXX,XXXX
>> 10:52:46 ->Waiting 7.984 seconds
>> 10:52:46 ->Somebody updated XXXX,XXXX with grey
[++++++++++++++++++++++++++++++++++++++++++++++++++]

Then error again and image reload etc. and it takes long time What could be a solution to this problem ? Thank you very much Romy

LiamDavisonGates commented 4 years ago

I keep encountering the same error

ZinRicky commented 4 years ago

I know it isn't the best answer ever, but try and install Python and the required components from the beginning: don't use the setup.py to download the modules, but direclty use pip.