Jump to content

Recommended Posts

@Mr Pennyworth After running that command:

 

No matching processes belonging to you were found
No matching processes belonging to you were found
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 4111266682
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 4111266682
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 4111266682
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3818306133
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3818306133
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3818306133
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3818306133
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3077976816
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3077976816
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3077976816
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 3077976816
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open

 

Unlike before, I also saw:

image.png.bc126f44d14ba2cdbf4ff312f919e51f.png

image.png.73172c913a60e598cc58435b111aa7a7.png

After a bit that window went away.

Edited by evanfuchs
Link to comment

@evanfuchs aw man that's the worst.
A bug that goes away when run from terminal.

That's a known bug with no solution yet https://github.com/pyinstaller/pyinstaller/issues/5109

But in my trials that bug wasn't getting triggered.
I have tested this workflow only on Catalina by the way. Are you on Catalina or some other version?

While I think about how I could go about debugging / diagnosing this, you could manually import a dictionary. By running the same command as above, but using  '/Users/<your username here>/Library/Application Support/Alfred/Workflow Data/mr.pennyworth.betterDicts' instead of /tmp/.

That's hoping that even though the bug affects the import, maybe it won't affect the lookup 🤞🏼

Edited by Mr Pennyworth
Link to comment
1 hour ago, Mr Pennyworth said:

While I think about how I could go about debugging / diagnosing this, you could manually import a dictionary. By running the same command as above, but using  '/Users/<your username here>/Library/Application Support/Alfred/Workflow Data/mr.pennyworth.betterDicts' instead of /tmp/.

 

Not sure if I followed you correctly, but I tried that (with the correct username) and:

 

No matching processes belonging to you were found
Traceback (most recent call last):
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/__boot__.py", line 411, in <module>
    _run()
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/__boot__.py", line 394, in _run
    exec(compile(source, path, "exec"), globals(), globals())
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/BetterDict.py", line 380, in <module>
    import_dict(dict_path, base_dir)
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/BetterDict.py", line 276, in import_dict
    info = dict_info(dict_path)
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/BetterDict.py", line 207, in dict_info
    return readPlist(f'{dict_path}/Contents/Info.plist')
  File "/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/BetterDict.py", line 65, in readPlist
    with open(plist_path, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/xxx/Dropbox/applications/Alfred-app/Alfred.alfredpreferences/workflows/user.workflow.E0E103F2-208F-48F7-B4DF-C096F6FDD948/BetterDict.app/Contents/Resources/System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/4094df88727a054b658681dfb74f23702d3c985e.asset/AssetData/New Oxford American Dictionary.dictionary/Contents/Info.plist'
2020-12-03 06:56:54.727 BetterDict[2600:44830] BetterDict Error
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 2988954240
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 2988954240
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 2988954240
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open
UpdateRecents: about to call HIS_XPC_GetApplicationPolicyForURLs with seed 2988954240
UpdateRecents: received results from HIS_XPC_GetApplicationPolicyForURLs
UpdateRecents: ignoring results because menu isn't open

 

Link to comment
9 minutes ago, Mr Pennyworth said:

Can you share the command you ran before (the one with tmp) and the command you ran now? Just want to make sure that the tmp part is the only thing that changed and nothing else got unintentionally changed...

From the output, it appears that something else also changed apart from tmp...

 

Yes. Thanks for sticking with me. I had started over so I ran the first import command to tmp, then run it again with '/Users/<your username here>/Library/Application Support/Alfred/Workflow Data/mr.pennyworth.betterDicts'

 

I ended up with two keys. Removed one of them and I can get to the lookup, but it's botched:

 

image.png.ee384e42df17d42a4a37e4975f0ff986.png

 

Oh this is what I ran with my username:

 

killall alfred-dict-server; killall BetterDict; ./BetterDict.app/Contents/MacOS/BetterDict import '/System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/4094df88727a054b658681dfb74f23702d3c985e.asset/AssetData/New Oxford American Dictionary.dictionary' '/Users/xxx/Library/Application Support/Alfred/Workflow Data/mr.pennyworth.betterDicts'

 

Edited by evanfuchs
Link to comment

Ah! the theming looks unfortunate :(

While I figure out how best to fix it, here are your two options:

  1. Change Alfred's theme to one where color of Alfred's window is different from color of the text in search bar (right now, in your theme, both of those colors are white)

    If you don't want to change the these, alternatively:


     
  2. open this file '/Users/<username>/Library/Application Support/Alfred/Workflow Data/mr.pennyworth.betterDicts/<dict-ID>/html/dict-entry.css'
    (by using appropriate <username> and <dict-ID>)
    At the top, you'll find some code like this:
    :root
    {
        --secondary-label: var(--result-subtext-color, #eee);
        --text: var(--search-text-color, #eee);
        --link: var(--result-text-colorSelected, var(--link));
    }
    
    html
    {
        background-color: var(--window-color, #1d1e28);
        color: var(--search-text-color, #eee);
    }

     

     

    in the html part, change the background-color from --window-color to --search-background
    After that, run killall AlfredExtraPane in terminal (so that the viewer would be restarted and would pick up changes we made)

Edited by Mr Pennyworth
Link to comment
16 minutes ago, Mr Pennyworth said:

 

  1. Change Alfred's theme to one where color of Alfred's window is different from color of the text in search bar (right now, in your theme, both of those colors are white)

Yep. Changed the theme. All good.

 

On another note, as I mentioned earlier, the only had one dictionary option. Should I have seen others, including thesaurus?

 

Thanks!

 

Link to comment

It only lists dictionaries that are installed/available on your system. They are in /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/

 

And not all of them are importable. To get a list of all the importable ones, run these in terminal:

  • cd '/System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/'

  • python -c 'import glob; print("\n".join(glob.glob("*.asset/AssetData/*.dictionary")))'

If the above shows multiple dictionaries, but still not the .dict-import command in Alfred, I believe it might still be because of the bug I mentioned earlier.

 

In that case, I'm afraid you'll have to import them manually just like you imported this oxford one.

 

OTOH, if the dictionaries aren't present at all on your system, you can download/enable them by opening Dictionary.app, and then going to preferences.

Link to comment
21 minutes ago, Mr Pennyworth said:

OTOH, if the dictionaries aren't present at all on your system, you can download/enable them by opening Dictionary.app, and then going to preferences

 

Odd. I have several Dictionaries (Thesaurus, Wikipedia, Terminology) enabled as shown in Dictionary.app Preferences, which work fine in the app, but there is only the one in '/System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/'

 

The "Open Dictionaries Folder" under File menu takes me to /Users/xxx/Library/Dictionaries/, where I have Terminology.

 

Anyway I feel like I've taken a lot of your time! Thanks for getting me going and for sharing the workflow.

Link to comment

@evanfuchs Interesting...
Given that the GUI import isn't working anyway and you had to import using the command line, here's something you can try:

 

Look at the command you used for importing the oxford dictionary. In that command, after the word 'import', you had to provide the path to the '.dictionary' file, right? Run the same command, but this time, change that path to the appropriate path from '/Users/xxx/Library'...

Also if you could tell me what such a path looks like, I can add it to the workflow so that the dictionaries in this library folder are also detected by the workflow.

Link to comment
3 hours ago, Mr Pennyworth said:

Look at the command you used for importing the oxford dictionary. In that command, after the word 'import', you had to provide the path to the '.dictionary' file, right? Run the same command, but this time, change that path to the appropriate path from '/Users/xxx/Library'...

 

Can't tell you how many times I tried this. At one point I got the thesaurus partially imported with a bunch of errors, then I tried to manually complete it in the workflow, until I ran up again the db entries. I deleted everything and tried once more, then it installed. 

 

3 hours ago, Mr Pennyworth said:

Also if you could tell me what such a path looks like, I can add it to the workflow so that the dictionaries in this library folder are also detected by the workflow.

 

  • As I mentioned earlier, I only had one dictionary (New Oxford American Dictionary) in the "default" folder: 
  • Terminology (Did not import this) here:  /Users/<username>/Library/Dictionaries/ 
  • And this might be helpful. I found the Thesaurus and other dictionaries here: /System/Library/AssetsV2/PreinstalledAssetsV2/InstallWithOs/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/

Thanks again for all your help!

 

 

 

selected.gif

selected.gif

Edited by evanfuchs
Link to comment
  • 2 months later...

Hi, really interested in this workflow but I keep getting an error pop up every time I try to import dictionary. I get the following errors:

 

[Fault] Transform 'MT_com.apple.automation.do_shell_script' hit unrecoverable error with reason='<private>' and context='<private>' with event='<private>!

 

attempted to call TCCAccessRequest without the com.apple.private.tcc.manage-bby-mn

 

and a few apple webkit errors. Would appreciate any help. Thanks!

Screenshot 2021-02-19 at 12.05.32.png

Link to comment
  • 4 weeks later...
  • 3 weeks later...

Sorry folks for all the errors and failures you keep running into!

 

The workflow is way too hacky with no good logging, error reporting and very poor debugging... I started working on a revamped version with detailed logging, less moving parts and a consolidated code base in a single swift binary, but work at my day job has gotten way too hectic and the revamping of workflows and bugfixes have taken a backseat :(

 

I'd gladly merge pull requests though!

Thanks and apologies!

Link to comment
  • 2 months later...
  • 1 month later...

Hi there

 

I encounter a problem that when I type in a word there is no result below.

I've set up the dictionary and imported those I want to use.

Did I forget to do something? And also I'm not sure which key words to use to simply find a word in all dictionaries.

 

截圖 2021-07-17 上午1.21.08.png

Link to comment

If you could upload the logs somewhere / paste here, I can take a look :)

 

8 hours ago, Steven Hsieh said:

And also I'm not sure which key words to use to simply find a word in all dictionaries.

The way the workflow is structured, it's not possible to do this :(

Link to comment
4 hours ago, Mr Pennyworth said:

If you could upload the logs somewhere / paste here, I can take a look :)

 

The way the workflow is structured, it's not possible to do this :(

Here is the log. I think maybe the failure is due to the appearance of Alfred?

Quote

[14:05:10.051] Better Dictionaries[Script Filter] Queuing argument '(null)'

[14:05:10.125] Better Dictionaries[Script Filter] Script with argv '(null)' finished

[14:05:10.133] Better Dictionaries[Script Filter] {

  "items": [

    {

      "title": "\u8b6f\u5178\u901a\u82f1\u6f22\u96d9\u5411\u5b57\u5178",

      "arg": "com-apple-dictionary-zh_TW-en-DrEye"

    }

  ]

}

[14:05:11.875] Better Dictionaries[Script Filter] Processing complete

[14:05:11.880] Better Dictionaries[Script Filter] Passing output 'com-apple-dictionary-zh_TW-en-DrEye' to Arg and Vars

[14:05:11.881] Better Dictionaries[Arg and Vars] Processing complete

[14:05:11.882] Better Dictionaries[Arg and Vars] Passing output '' to Conditional

[14:05:11.883] Better Dictionaries[Conditional] Processing complete

[14:05:11.884] Better Dictionaries[Conditional] Passing output '' to Junction

[14:05:11.885] Better Dictionaries[Junction] Processing complete

[14:05:11.885] Better Dictionaries[Junction] Passing output '' to Script Filter

[14:05:12.681] Better Dictionaries[Script Filter] Queuing argument 'a'

[14:05:12.926] Better Dictionaries[Script Filter] Script with argv 'a' finished

[14:05:12.937] ERROR: Better Dictionaries[Script Filter] Code 1: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  3889  100  3865  100    24  46566    289 --:--:-- --:--:-- --:--:-- 46855

Traceback (most recent call last):

  File "AlfredExtraPane.app/Contents/Resources/scripts/alfred-extra-pane", line 48, in <module>

    with open(cssfilepath, 'w') as tmpfile: tmpfile.write(alfred.theme_css())

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 165, in theme_css

    for varname, val in theme().items()

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 27, in cached_func

    cache[args] = func(*args)

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 183, in theme

    theme_path = '%s/%s' % (DEFAULT_THEMES_DIR, bundled_theme_filename[theme_id])

KeyError: 'theme.bundled.moderndark'

[14:05:13.284] Better Dictionaries[Script Filter] Queuing argument 'ap'

[14:05:13.402] Better Dictionaries[Script Filter] Queuing argument 'app'

[14:05:13.608] Better Dictionaries[Script Filter] Queuing argument 'appl'

[14:05:13.669] Better Dictionaries[Script Filter] Script with argv 'app' finished

[14:05:13.692] ERROR: Better Dictionaries[Script Filter] Code 1: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  4282  100  4256  100    26   692k   4333 --:--:-- --:--:-- --:--:--  696k

Traceback (most recent call last):

  File "AlfredExtraPane.app/Contents/Resources/scripts/alfred-extra-pane", line 48, in <module>

    with open(cssfilepath, 'w') as tmpfile: tmpfile.write(alfred.theme_css())

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 165, in theme_css

    for varname, val in theme().items()

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 27, in cached_func

    cache[args] = func(*args)

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 183, in theme

    theme_path = '%s/%s' % (DEFAULT_THEMES_DIR, bundled_theme_filename[theme_id])

KeyError: 'theme.bundled.moderndark'

[14:05:13.695] Better Dictionaries[Script Filter] Queuing argument 'apple'

[14:05:13.961] Better Dictionaries[Script Filter] Script with argv 'apple' finished

[14:05:13.990] ERROR: Better Dictionaries[Script Filter] Code 1: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100  4168  100  4140  100    28  1010k   7000 --:--:-- --:--:-- --:--:-- 1017k

Traceback (most recent call last):

  File "AlfredExtraPane.app/Contents/Resources/scripts/alfred-extra-pane", line 48, in <module>

    with open(cssfilepath, 'w') as tmpfile: tmpfile.write(alfred.theme_css())

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 165, in theme_css

    for varname, val in theme().items()

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 27, in cached_func

    cache[args] = func(*args)

  File "/Users/xiechufan/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.2A67BCCA-A04D-4D24-B784-C202296DD72B/AlfredExtraPane.app/Contents/Resources/scripts/alfred.py", line 183, in theme

    theme_path = '%s/%s' % (DEFAULT_THEMES_DIR, bundled_theme_filename[theme_id])

KeyError: 'theme.bundled.moderndark'

 

Link to comment
  • 3 weeks later...
  • 1 month later...

Mr Pennyworth,

 

Thank you for the excellent workflow. I installed it today and working fine. Well, almost!

 

The issue I am facing is with the Play Pronunciation audio script. I am unable to get it running - don't hear any audio. The Run script is failing. Alfred debugging mode displays the message pasted below. Could you please help and advise?

 

Thank you.

+++++++++++++++++++++

dictionary-OTE/html/61726D30.html' to Run Script

[17:16:11.596] ERROR: Better Dictionaries[Run Script] % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0

curl: (60) SSL certificate problem: certificate has expired

More details here: https://curl.haxx.se/docs/sslcerts.html

 

curl failed to verify the legitimacy of the server and therefore could not

establish a secure connection to it. To learn more about this situation and

how to fix it, please visit the web page mentioned above.

Error: AudioFileOpen failed ('dta?')

+++++++++++++++++++++    

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...