alanhe421 / alfred-workflows

Save time, Improve life.🚀 ☕️ 💻
https://alfred.1991421.cn
MIT License
659 stars 63 forks source link

[BUG Solution] Img not found "An unexpected error occurred. Activate Alfred workflow debug mode for more information" #405

Closed esseti closed 9 months ago

esseti commented 9 months ago

In the debug there's this:

[09:37:19.105] STDERR: Open Chrome Profile[Script Filter] Traceback (most recent call last):
  File "/Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.F094128D-75E3-4588-952E-0198284BB1D1/main.py", line 31, in <module>
    urllib.request.urlretrieve(profil[str(item)]['last_downloaded_gaia_picture_url_with_size'], filename)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  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 501, in open
    req = Request(fullurl, data)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 320, in __init__
    self.full_url = url
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 346, in full_url
    self._parse()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 375, in _parse
    raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: ''

SOLUTION:

At this line: https://github.com/alanhg/alfred-workflows/blob/62d2758d67c4fe9c0760a4050cf80cd29de4991f/open-chrome-profile/src/main.py#L32

change to except (urllib.error.HTTPError, ValueError) as e:

alanhe421 commented 9 months ago

@esseti thank you , I have released the new version.

your code is right.