papunag209 Posted September 13 Share Posted September 13 Hi My first post on any forum hope it goes well, I am trying to make a workflow to help me use git for my job, I am trying to make a script filter which lists remote branches, I need to import git from GitPython. I have installed script inside workflow directory using pip3 ran this in my workflow root. pip install --target . gitpython file system looks like this in my workflow folder: . gitdb-4.0.10.dist-info .. info.plist GitPython-3.1.36.dist-info smmap git smmap-5.0.0.dist-info gitdb my script filter looks like this import sys import json from git import git r = Repo('~/Workspaces/apollo') remote_refs = r.remote().refs for refs in remote_refs: print(refs.name) subtitle = ' '.join(refs) query = sys.argv[1] out = {"items": [ { "uid": "desktop", "type": "file", "title": query, "subtitle": "sub" + subtitle, "arg": "123", "autocomplete": "Desktop", "icon": { "type": "fileicon", "path": "~/Desktop" } } ]} sys.stdout.write(json.dumps(out)) when I debug my flow I get this error: line 3, in <module> from git import git ModuleNotFoundError: No module named 'git' also one question I have because I am not very proficient with python, if anyone can inform me why does alfred's script filter not import modules installed globally, like any other script on my machine. Thanks in advance Link to comment
vitor Posted September 14 Share Posted September 14 Welcome @papunag209, You also need to set PYTHONPATH to include the new folder where you installed the script. 6 hours ago, papunag209 said: why does alfred's script filter not import modules installed globally, like any other script on my machine. It’s your shell that knows where those are, not the scripts. Alfred by design does not load your shell environment. See Understanding the Scripting Environment. 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