Jump to content

LeifJP

Member
  • Posts

    5
  • Joined

  • Last visited

Everything posted by LeifJP

  1. Hi, I encountered an issue with a workflow I use that creates small preview tiles and saves them into a Markdown file for Obsidian. Suddenly, the script was unable to load the external libraries I had been using. Attempting to reinstall them via pip3 on the command line (I'm using a Mac M1 running macOS 14.4 with Python installed via Homebrew) resulted in the error message: 'error: externally-managed-environment.' However, I was able to resolve the issue by creating a virtual environment and installing the libraries there. Since I couldn't find a solution through Google, I developed a workaround. Here's how I did it: Inside the Workflow folder (e.g., ~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow....), create a virtual environment via the terminal. Install the necessary libraries using pip. Call my script using a zsh script action within the workflow, like this: # Get the URL from the previous action url={query} # activate the virtual environment source env/bin/activate # run the python script and put the result into the variable markdown markdown=$(python3 script.py "$url") # deactivate the virtual environment deactivate # output of the result for the next action echo "$markdown" Do you think there might be another way to approach this issue? I'm aware that one potential solution could involve calling pip with the option --break-system-packages, but ultimately, using a virtual environment seems like the better solution to me. If you can read german, I wrote something more detailed in my blog https://bit.ly/48PRTwe.
  2. Thanks Vitor, seem to be a good way to handle more input parameter for a script.
  3. Hi. I was stuggling with a python script, that runs as external script (with the brew installed version of python) very well, but not when switch back to python3 (and the default old version installed on Venture) in the script menu. How can I use the newer (brew)-version as well. Also putting in shebang on top of the with the path to the brew version of python work. The funny thing, in the script popup I could choose the brew installed version of php. Is the a work around or any possiblity to customize the script menu or creating in python environment for running a script in Alfred? Thanks, Leif
  4. Hi Vitor, sorry if i offended you. But the question was serious meant. Maybe my English is not so good. But you answered my question, so I'm fine. Never the less maybe you should add that explanation to your workflow page in Alfred.app. So sorry again and thanx for your work, Leif
  5. Hi, just for my understanding, why I should use this workflow? I didn't test every keyword but all I test I just can access these preference pane without this workflow. As an example (the result direct result from Alfred is shown in german on a german OS, but it's the same): What is the point I didn't got. Thanks, Leif
×
×
  • Create New...