ardamavi / Game-Bot

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

unknown file extension+ValueError: <Key.space: ' '> is not in list #11

Closed claudetheboof closed 5 years ago

claudetheboof commented 5 years ago

ok so I got like 2 errors when I attempt to run the create_dataset.py, apparently the Keys list doesnt really match up, and also unknown file extension when it tried to save the file into readable training dataset. here are the full traceback

`Unhandled exception in listener callback Traceback (most recent call last): File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util__init.py", line 157, in inner return f(self, *args, kwargs) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput\keyboard_win32.py", line 240, in _process self.on_press(key) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util__init.py", line 78, in inner if f(*args) is False: File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 60, in on_press save_event_keyboard(data_path, 1, key) File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 25, in save_event_keyboard key = get_id(key) File "C:\Users\Claude\Downloads\Game-Bot-master\game_control.py", line 13, in get_id return get_keys().index(key) ValueError: <Key.space: ' '> is not in list Traceback (most recent call last): File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 79, in main() File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 75, in main listen_keyboard() File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 66, in listen_keyboard listener.join() File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util__init__.py", line 205, in join six.reraise(exc_type, exc_value, exc_traceback) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\six.py", line 692, in reraise raise value.with_traceback(tb) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util\init__.py", line 157, in inner return f(self, *args, kwargs) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput\keyboard_win32.py", line 240, in _process self.on_press(key) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util\init__.py", line 78, in inner if f(*args) is False: File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 60, in on_press save_event_keyboard(data_path, 1, key) File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 25, in save_event_keyboard key = get_id(key) File "C:\Users\Claude\Downloads\Game-Bot-master\game_control.py", line 13, in get_id return get_keys().index(key) ValueError: <Key.space: ' '> is not in list Unhandled exception in listener callback Traceback (most recent call last): File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util\win32.py", line 375, in _handler converted = self._convert(code, msg, lpdata) File "C:\Users\Claude\AppData\Local\Programs\Python\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:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 1987, in save format = EXTENSION[ext] KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util__init.py", line 157, in inner return f(self, *args, **kwargs) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util\win32.py", line 379, in _handler self._handle(code, msg, lpdata) File "C:\Users\Claude\AppData\Local\Programs\Python\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:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\pynput_util\init__.py", line 78, in inner if f(args) is False: File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 43, in on_click save_event_mouse(data_path, x, y) File "C:\Users\Claude\Downloads\Game-Bot-master\create_dataset.py", line 34, in save_event_mouse save_img(data_path, screenshot) File "C:\Users\Claude\Downloads\Game-Bot-master\get_dataset.py", line 15, in save_img imsave(img, path) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\lib\utils.py", line 101, in newfunc return func(args, **kwds) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\misc\pilutil.py", line 219, in imsave im.save(name) File "C:\Users\Claude\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 1989, in save raise ValueError('unknown file extension: {}'.format(ext)) ValueError: unknown file extension: Process Process-1:`

claudetheboof commented 5 years ago

I am running this on python 3.7.3 btw , I also have tried installed python ver 3.6.0 but still pretty much the same thing

justkawal commented 5 years ago

Open and see the code to be replaced in the get_id function of game_control.py

https://github.com/ardamavi/Game-Bot/issues/10#issuecomment-486270778

claudetheboof commented 5 years ago

Thank you for replying. I will try this right away when I get home and report back if there is any more issue. In the mean time , keep up doing what you're doing!