Python Forum
trying to change channels with python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
trying to change channels with python
#3
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:
Quote:E:\Python>flask --app tv run
* 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 -
The image it's looking for it's in the same folder that the script is, and it worked before.
Reply


Messages In This Thread
trying to change channels with python - by greggk1 - Sep-16-2024, 08:06 PM
RE: trying to change channels with python - by greggk1 - Sep-17-2024, 03:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding MIDI Channels to each Input zach1234 6 2,627 Apr-20-2023, 11:51 AM
Last Post: jefsummers
  mapping joystick axis to specific 'channels' in python DashOrion 1 3,846 Jul-07-2020, 04:26 PM
Last Post: DashOrion
  [split] building a transition matrix for ion channels satyam2007 1 2,128 Jul-31-2019, 04:20 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020