elsatch Posted August 13, 2019 Share Posted August 13, 2019 Thanks @deanishe for your advice! I will post my workflow once it works as expected! Link to comment
Hattrick Posted November 25, 2019 Share Posted November 25, 2019 Thanks for your work, your library has been very helpful to me so far. Can I suggest moving workflow settings from alfred_workflow_data to alfred_preferences instead? This way, the workflow settings would sync in the cloud with alfredpreferences. Link to comment
deanishe Posted November 25, 2019 Author Share Posted November 25, 2019 8 hours ago, Hattrick said: Can I suggest moving workflow settings from alfred_workflow_data to alfred_preferences instead? It can't really be done for implementation reasons (the library stores machine-specific data in the settings file). It would also break the API, which is a no-go. Finally, it's not clear that syncing the data are better than not syncing them. In some cases, sure. But not in all. It's likely that I'll add a separate API for writing to a folder within the prefs bundle at some point in the future. Link to comment
xilopaint Posted January 14, 2020 Share Posted January 14, 2020 (edited) Is there anything in Alfred-Workflow like the `Requests.iter_lines()` method? Edited January 14, 2020 by xilopaint Link to comment
deanishe Posted January 15, 2020 Author Share Posted January 15, 2020 No, but you could wrap Response.iter_content() with another generator that yields lines fairly easily. Link to comment
xilopaint Posted January 15, 2020 Share Posted January 15, 2020 Any chance to get the method added to the library? Link to comment
deanishe Posted January 15, 2020 Author Share Posted January 15, 2020 Not any time soon, no. I won’t be adding any more features to v1. Link to comment
xilopaint Posted January 15, 2020 Share Posted January 15, 2020 Is v2 already in the road map with Python 3 support? 😁 Link to comment
deanishe Posted January 15, 2020 Author Share Posted January 15, 2020 (edited) V2 will be a Python 3-only rewrite. The question is when I'll get round to writing it. Motivation is currently zero. I'm one of the many people who looked at the catastrophic Py2 to Py3 transition and moved to Go instead. I still use Python, but rarely for workflows: Go is just so much better-suited to Alfred workflows (and a lot of other stuff I would have normally used Py2 for). I also don't have Catalina (the only version of macOS with Python 3), and don't see myself installing it any time soon. I'm planning to buy a new Mac, but when I do, I'll be installing Mavericks on it. I will try to do it sometime this year, but that's literally my time horizon: "sometime this year". And I make no promises on that. Py3 is, in my eyes, largely stupid. Edited January 15, 2020 by deanishe xilopaint 1 Link to comment
xilopaint Posted March 3, 2020 Share Posted March 3, 2020 (edited) @deanishe I need something like `Wofklow3.cache_data()` and `Workflow3.cached_data()` in a Python 3 workflow. Would it be easy to adapt alfred-workflow to work with Python 3 for those methods or you recommend me to simply write and read the cache files using Python 3? Edited March 3, 2020 by xilopaint Link to comment
deanishe Posted March 3, 2020 Author Share Posted March 3, 2020 32 minutes ago, xilopaint said: Would be easy to adapt alfred-workflow to work with Python 3 for those methods Don’t know, tbh. The library is Unicode-only, so there’s a lot of encoding/deciding code that’d need removing or rewriting. If I were you, I’d probably just reimplement those bits. They’re not very complicated, but the current implementation is quite heavily tied to the rest of the API. Link to comment
xilopaint Posted March 3, 2020 Share Posted March 3, 2020 16 minutes ago, deanishe said: Don’t know, tbh. The library is Unicode-only, so there’s a lot of encoding/deciding code that’d need removing or rewriting. If I were you, I’d probably just reimplement those bits. They’re not very complicated, but the current implementation is quite heavily tied to the rest of the API. Well, at the moment I'm getting `ModuleNotFoundError: No module named 'util'`. I should be missing something very basic. I have no clue why I'm getting this error. Link to comment
xilopaint Posted March 3, 2020 Share Posted March 3, 2020 Nah, I just realised it's an import issue. Python 3 doesn't support implicit relative imports. Link to comment
xilopaint Posted March 3, 2020 Share Posted March 3, 2020 Hey @deanishe, after fixing a lot of issues in the attempt of adapting the library for Python 3 I came across this: 10:01:18 workflow.py:2061 DEBUG ---------- Alfred PDF Tools (2.16.0) ---------- 10:01:18 workflow.py:1468 DEBUG reading settings from /Users/xxxx/Library/Application Support/Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/settings.json 10:01:18 workflow.py:2338 INFO checking for update ... 10:01:18 background.py:233 DEBUG [__workflow_update_check] command cached: /Users/xxxx/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/__workflow_update_check.argcache 10:01:18 background.py:237 DEBUG [__workflow_update_check] passing job to background runner: ['/usr/bin/python', '/Users/xxxx/Developer/Alfred Workflows/Alfred PDF Tools/alfred-pdf-tools/src/workflow/background.py', '__workflow_update_check'] Traceback (most recent call last): File "/Users/xxxx/Developer/Alfred Workflows/Alfred PDF Tools/alfred-pdf-tools/src/workflow/background.py", line 28, in <module> from .workflow import Workflow ValueError: Attempted relative import in non-package 10:01:18 background.py:241 ERROR [__workflow_update_check] background runner failed with 1 10:01:18 workflow.py:2103 DEBUG ---------- finished in 0.071s ---------- As you can see I changed `from workflow import Workflow` in background.py to `from .workflow import Workflow` but it doesn't work. What's the problem? Link to comment
deanishe Posted March 3, 2020 Author Share Posted March 3, 2020 The background API also runs background.py as a script, which is why you're getting the error. Have you tried not changing the import path? Link to comment
xilopaint Posted March 4, 2020 Share Posted March 4, 2020 (edited) 2 hours ago, deanishe said: The background API also runs background.py as a script, which is why you're getting the error. Have you tried not changing the import path? If I keep `from workflow import Workflow` in background.py I get this: 21:25:53 workflow.py:2061 DEBUG ---------- Alfred PDF Tools (2.16.0) ---------- 21:25:53 workflow.py:1468 DEBUG reading settings from /Users/****/Library/Application Support/Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/settings.json 21:25:53 workflow.py:2338 INFO checking for update ... 21:25:53 background.py:233 DEBUG [__workflow_update_check] command cached: /Users/****/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.xilopaint.alfredapp.pdftools/__workflow_update_check.argcache 21:25:53 background.py:237 DEBUG [__workflow_update_check] passing job to background runner: ['/usr/bin/python', '/Users/****/Developer/Alfred Workflows/Alfred PDF Tools/alfred-pdf-tools/src/workflow/background.py', '__workflow_update_check'] Traceback (most recent call last): File "/Users/****/Developer/Alfred Workflows/Alfred PDF Tools/alfred-pdf-tools/src/workflow/background.py", line 28, in <module> from workflow import Workflow File "/Users/****/Developer/Alfred Workflows/Alfred PDF Tools/alfred-pdf-tools/src/workflow/workflow.py", line 47, in <module> from .util import AcquisitionError # noqa: F401 ValueError: Attempted relative import in non-package 21:25:53 background.py:241 ERROR [__workflow_update_check] background runner failed with 1 21:25:53 workflow.py:2103 DEBUG ---------- finished in 0.353s ---------- Edited March 4, 2020 by xilopaint Link to comment
deanishe Posted March 4, 2020 Author Share Posted March 4, 2020 I don't know. You're asking me questions about an altered version I've never seen. I can't help you. Link to comment
xilopaint Posted March 4, 2020 Share Posted March 4, 2020 4 hours ago, deanishe said: I don't know. You're asking me questions about an altered version I've never seen. I can't help you. Here it is: https://jmp.sh/Trr37D3 Link to comment
deanishe Posted March 4, 2020 Author Share Posted March 4, 2020 I'm not interested, tbh. I'm not going to waste my time trying to fix v1 for Python 3. It needs to be completely rewritten. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now