ardamavi / Game-Bot

Artificial intelligence learn playing any game with watching you.
Apache License 2.0
439 stars 115 forks source link

ValueError: 'arr' does not have a suitable array shape for any mode. #9

Open ghost opened 5 years ago

ghost commented 5 years ago
$ python create_dataset.py
Using TensorFlow backend.
Unhandled exception in listener callback
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 375, in _handler
    converted = self._convert(code, msg, lpdata)
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 390, in _convert
    raise NotImplementedError()
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pynput\_util\__init__.py", line 157, in inner
    return f(self, *args, **kwargs)
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 379, in _handler
    self._handle(code, msg, lpdata)
  File "C:\Python37\lib\site-packages\pynput\mouse\_win32.py", line 190, in _handle
    self.on_click(data.pt.x, data.pt.y, button, pressed)
  File "C:\Python37\lib\site-packages\pynput\_util\__init__.py", line 78, in inner
    if f(*args) is False:
  File "C:\Users\yawik\Downloads\Game-Bot\create_dataset.py", line 43, in on_click
    save_event_mouse(data_path, x, y)
  File "C:\Users\yawik\Downloads\Game-Bot\create_dataset.py", line 34, in save_event_mouse
    save_img(data_path, screenshot)
  File "C:\Users\yawik\Downloads\Game-Bot\get_dataset.py", line 15, in save_img
    imsave(path, img)
  File "C:\Python37\lib\site-packages\numpy\lib\utils.py", line 101, in newfunc
    return func(*args, **kwds)
  File "C:\Python37\lib\site-packages\scipy\misc\pilutil.py", line 217, in imsave
    im = toimage(arr, channel_axis=2)
  File "C:\Python37\lib\site-packages\numpy\lib\utils.py", line 101, in newfunc
    return func(*args, **kwds)
  File "C:\Python37\lib\site-packages\scipy\misc\pilutil.py", line 327, in toimage
    raise ValueError("'arr' does not have a suitable array shape for "
ValueError: 'arr' does not have a suitable array shape for any mode.
Process Process-1:
Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 375, in _handler
    converted = self._convert(code, msg, lpdata)
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 390, in _convert
    raise NotImplementedError()
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Python37\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\yawik\Downloads\Game-Bot\create_dataset.py", line 52, in listen_mouse
    listener.join()
  File "C:\Python37\lib\site-packages\pynput\_util\__init__.py", line 205, in join
    six.reraise(exc_type, exc_value, exc_traceback)
  File "C:\Python37\lib\site-packages\six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "C:\Python37\lib\site-packages\pynput\_util\__init__.py", line 157, in inner
    return f(self, *args, **kwargs)
  File "C:\Python37\lib\site-packages\pynput\_util\win32.py", line 379, in _handler
    self._handle(code, msg, lpdata)
  File "C:\Python37\lib\site-packages\pynput\mouse\_win32.py", line 190, in _handle
    self.on_click(data.pt.x, data.pt.y, button, pressed)
  File "C:\Python37\lib\site-packages\pynput\_util\__init__.py", line 78, in inner
    if f(*args) is False:
  File "C:\Users\yawik\Downloads\Game-Bot\create_dataset.py", line 43, in on_click
    save_event_mouse(data_path, x, y)
  File "C:\Users\yawik\Downloads\Game-Bot\create_dataset.py", line 34, in save_event_mouse
    save_img(data_path, screenshot)
  File "C:\Users\yawik\Downloads\Game-Bot\get_dataset.py", line 15, in save_img
    imsave(path, img)
  File "C:\Python37\lib\site-packages\numpy\lib\utils.py", line 101, in newfunc
    return func(*args, **kwds)
  File "C:\Python37\lib\site-packages\scipy\misc\pilutil.py", line 217, in imsave
    im = toimage(arr, channel_axis=2)
  File "C:\Python37\lib\site-packages\numpy\lib\utils.py", line 101, in newfunc
    return func(*args, **kwds)
  File "C:\Python37\lib\site-packages\scipy\misc\pilutil.py", line 327, in toimage
    raise ValueError("'arr' does not have a suitable array shape for "
ValueError: 'arr' does not have a suitable array shape for any mode.

tried running it after the last fix...getting this now :/ i really want this to work!

ardamavi commented 5 years ago

Can you check 'save_img' function's 'screensshot' input?

ghost commented 5 years ago

you mean debug the program? not sure how i can check the input 😅 we can discord(like skype) if you'd like so you can see exactly what i'm doing... if you have time this weekend or something..

On Thu, Apr 4, 2019 at 6:30 PM Arda Mavi notifications@github.com wrote:

Can you check 'save_img' function's 'screensshot' input?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ardamavi/Game-Bot/issues/9#issuecomment-479946184, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPeZFF8VeaCkLdWK11ogNJHyAH_Ww_Gks5vdhp5gaJpZM4cbINR .

justkawal commented 5 years ago

I know what is the error:

Open file get_dataset.py and go to line 15

change from imsave(path, img) to imsave(img, path)

My discord account is kawal.52925#2272

ghost commented 5 years ago

added you on discord. now getting this error: https://pastebin.com/c0E23EWJ

cheers, yawik

On Fri, Apr 5, 2019 at 5:32 AM kawal7415 notifications@github.com wrote:

I know what is the error:

Open file get_dataset.py and go to line 15

change from imsave(path, img) to imsave(img, path)

My discord account is kawal.52925#2272

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ardamavi/Game-Bot/issues/9#issuecomment-480128377, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPeZE-098emzHjQY6gjS1iXGWuAMtozks5vdrW_gaJpZM4cbINR .

Remie9 commented 5 years ago

change the imsave but got this error now:

File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\PIL\Image.py", line 1989, in save raise ValueError('unknown file extension: {}'.format(ext)) ValueError: unknown file extension:

rodizipa commented 5 years ago

I would suggest replacing imsave and imread to imageio lib correspondent functions as suggested by scipy docs as the scipy.misc image related functions are deprecated. (It also gives a suggestion to replace imageresize)

lvchp commented 5 years ago

I have the same problem. Do you have new updates on this issue?

ardamavi commented 5 years ago

I am too busy at these times, I cannot support this project.

lvchp commented 5 years ago

I am too busy at these times, I cannot support this project.

This is a good project, I hope it will be updated soon

caretbay47 commented 4 years ago

Um so when u change the imsave(path, img) to imsave(img, path) it now doesnt know what format u want the img to be... as im currently debugging this code... i used imsave(img + '.jpg', path) and that seems to work but im not sure if this is the proper fix...ive also resorted to using imageio.imsave(img + '.jpg', path)