tmcknight / Movie-and-TV-Show-Search-Alfred-Workflow

An Alfred workflow to search for a movie (or TV show) and get a few ratings
MIT License
95 stars 7 forks source link

Invalid Escape sequence when searching #43

Closed pageb018 closed 5 months ago

pageb018 commented 5 months ago

I cannot see to get the workflow to return any results. Please see the output of the debugger below:

[12:27:34.978] Movie and TV Show Search[Script Filter] Queuing argument 'batman' [12:27:35.023] Movie and TV Show Search[Script Filter] Script with argv 'batman' finished [12:27:35.024] ERROR: Movie and TV Show Search[Script Filter] Code 1: /Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.937EF7CF-5D48-48FE-85E1-E693C3CB5C3C/media.py:49: SyntaxWarning: invalid escape sequence '\:' m = re.match('([m|t])\:([0-9]*)', query) Traceback (most recent call last): File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.937EF7CF-5D48-48FE-85E1-E693C3CB5C3C/media.py", line 3, in <module> from distutils.util import strtobool ModuleNotFoundError: No module named 'distutils' [12:29:59.954] Logging Started...

I tried to manually install distutils, but it doesn't seem to be supported on the latest version of python.

vitorgalvao commented 5 months ago

You don’t need to install anything to use the workflow. Please provide your version of Alfred, macOS, and the Workflow, without which it’s extremely hard to diagnose what could be going on.

pageb018 commented 5 months ago

Ah ok. Was just trying to follow the logs.

Versions below:

Alfred: 5.1.4 macOS: 14.3 Workflow: 2.19.0 Python: 3.11.4

vitorgalvao commented 5 months ago

Did you install Python yourself? How?

Also, see if this version works for you.

pageb018 commented 5 months ago

The version you attached is better. I now can see search results. However I get the following error when trying to get ratings:

[13:20:51.921] Movie and TV Show Search[Script Filter] Queuing argument 'm:414906' [13:20:52.289] Movie and TV Show Search[Script Filter] Script with argv 'm:414906' finished [13:20:52.300] ERROR: Movie and TV Show Search[Script Filter] Code 1: https://api.themoviedb.org/3/movie/414906?api_key=0ebad901a16d3bf7f947b0a8d1808c44&language=en&append_to_response=videos%2Cexternal_ids%2Cwatch%2Fproviders%2Creleases%2Ccontent_ratings TMDb info retrieved. https://www.omdbapi.com/?i=tt1877830&tomatoes=True&apikey=97f94d17 Traceback (most recent call last): File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.3E6D706A-7352-4D67-A69F-3D876CC93831/media.py", line 430, in <module> sys.exit(main(args.t, args.q)) File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.3E6D706A-7352-4D67-A69F-3D876CC93831/media.py", line 55, in main show_item_info(item, media_type) File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.3E6D706A-7352-4D67-A69F-3D876CC93831/media.py", line 143, in show_item_info omdb_info = get_omdb_info(imdb_id) File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.3E6D706A-7352-4D67-A69F-3D876CC93831/media.py", line 130, in get_omdb_info return get_json(url, params) File "/Users/bpage/Library/Mobile Documents/com~apple~CloudDocs/Alfred Sync/Alfred.alfredpreferences/workflows/user.workflow.3E6D706A-7352-4D67-A69F-3D876CC93831/media.py", line 416, in get_json with urllib.request.urlopen(url) as url_return: File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 523, in open response = meth(req, response) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 632, in http_response response = self.parent.error( File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 561, in error return self._call_chain(*args) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 641, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 401: Unauthorized

pageb018 commented 5 months ago

Python I did install manually. I used the macOS installer direct from

https://www.python.org/downloads/macos/

vitorgalvao commented 5 months ago

When installing Python from their website (as opposed to using the Homebrew version), you have to install the certificates too. Installing from their website causes more problems than it solves, that’s always the cause on something like this (which is why I asked; but at the same time, how could you know?).

pageb018 commented 5 months ago

Unfortunately, I had already followed those steps and ran the .command. I just tried it again and no luck...still errors.

vitorgalvao commented 5 months ago

Looking further at the error, that looks like you changed the OMDB API key in the configuration and whatever you set is invalid.

pageb018 commented 5 months ago

Strange. I signed up and used what they sent me in the email. Should I be using the one that came with the workflow?

pageb018 commented 5 months ago

ah. I got it. The key activation never went through.

We are up and working now!

Much appreciated.

vitorgalvao commented 5 months ago

Glad you’re sorted!