Sep-17-2024, 03:07 AM
Thank you for the code.
I did try it. Parts of it work. I do see it handing off the channel number, but then I get an internal server error on the browser, and then command line I get the following error:
I did try it. Parts of it work. I do see it handing off the channel number, but then I get an internal server error on the browser, and then command line I get the following error:
Quote:E:\Python>flask --app tv runThe image it's looking for it's in the same folder that the script is, and it worked before.
* Serving Flask app 'tv'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
12
[2024-09-16 19:53:39,005] ERROR in app: Exception on /channel/12 [GET]
Traceback (most recent call last):
File "E:\Python\Lib\site-packages\pyautogui\__init__.py", line 172, in wrapper
return wrappedFunction(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyautogui\__init__.py", line 210, in locateOnScreen
return pyscreeze.locateOnScreen(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyscreeze\__init__.py", line 405, in locateOnScreen
retVal = locate(image, screenshotIm, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyscreeze\__init__.py", line 383, in locate
points = tuple(locateAll(needleImage, haystackImage, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyscreeze\__init__.py", line 371, in _locateAll_pillow
raise ImageNotFoundException('Could not locate the image.')
pyscreeze.ImageNotFoundException: Could not locate the image.
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Python\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\tv.py", line 24, in channel_name
change_channel(number)
File "E:\Python\tv.py", line 13, in change_channel
pyautogui.click('HDHR-live.png')
File "E:\Python\Lib\site-packages\pyautogui\__init__.py", line 594, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyautogui\__init__.py", line 985, in click
x, y = _normalizeXYArgs(x, y)
^^^^^^^^^^^^^^^^^^^^^^
File "E:\Python\Lib\site-packages\pyautogui\__init__.py", line 663, in _normalizeXYArgs
location = locateOnScreen(firstArg)
^^^^^^^^^^^^^^^^^^^^^^^^
pyautogui.ImageNotFoundException
127.0.0.1 - - [16/Sep/2024 19:53:39] "GET /channel/12 HTTP/1.1" 500 -