alfred-pwgen icon indicating copy to clipboard operation
alfred-pwgen copied to clipboard

Workflow broken on Monterey 12.3

Open AntZoo opened this issue 3 years ago β€’ 23 comments

Apple removed Python 2 support in Monterey 12.3, and the workflow is no longer functional. A rewrite into Python 3 is needed.

AntZoo avatar Feb 01 '22 13:02 AntZoo

Is there any progress?

ValeryP avatar Mar 18 '22 09:03 ValeryP

Mark, I hope it can be resolved soon.

liwmj avatar Mar 21 '22 13:03 liwmj

I have the same issue, when trying to change the python path to another python2 executable that doesn't seem to fix it either.

I've tried setting all the workflow script paths to /usr/local/bin/python2 but that doesn't work either.

image

davidawad avatar Mar 22 '22 16:03 davidawad

It's time to fully migrate to python3.

Anebrithien avatar Mar 25 '22 05:03 Anebrithien

Manually running pwgen.py gives this error ./pwgen.py", line 200 os.makedirs(user_generator_dir, 0700) ^ SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

stacksjb avatar Mar 25 '22 16:03 stacksjb

We can still install python 2 as explained here:

https://www.alfredapp.com/help/kb/python-2-monterey/

miguelpuyol avatar Mar 30 '22 09:03 miguelpuyol

We can still install python 2 as explained here:

https://www.alfredapp.com/help/kb/python-2-monterey/

Yes but it doesn’t work unfortunately πŸ€”

teziovsky avatar Mar 30 '22 19:03 teziovsky

Is there any update on this? or a solution being worked on?

VijendraMalhotra avatar Apr 04 '22 12:04 VijendraMalhotra

I got it to work by installing py27 as described here on stackoverflow (Im on m1 and using conda, other ways to get py27 working should be fine, too).

Then, all the occurences of /usr/bin/python in the workflow need to be replaced with the path to your python2 exectuable (in terminal, which python2 should give you the path). This includes:

  • the script filters
  • the bin/bash run script actions
  • the hardcoded string that is located in the workflow directory: rightlick the workflow, show in finder, open the file ./workflow/background.py and search for /usr/bin/python. There should only be one occurence.

If I find a free weekend, I might add this as a workflow-wide variable that can be set, but for now this is a quick and dirty way to get it running again.

pSpitzner avatar Apr 04 '22 13:04 pSpitzner

I think it's great that a workaround exists, but a rewrite of the workflow is probably what we need. Having to install a somewhat outdated Python version just for this workflow is not really what I want to be doing.

chrisspiegl avatar Apr 05 '22 08:04 chrisspiegl

It's hard to believe there is not even one maintainer who might be able to migrate this to python3. As I remember, the difference is not so huge for pyhton2 and python3. Unfortunately, I'm not familiar with this kind of development. Otherwise, I'd do it even by myself.

ValeryP avatar Apr 05 '22 08:04 ValeryP

It's hard to believe there is not even one maintainer who might be able to migrate this to python3. As I remember, the difference is not so huge for pyhton2 and python3. Unfortunately, I'm not familiar with this kind of development. Otherwise, I'd do it even by myself.

Hey, chill. The maintainer has worked on this package for years completely free, they have no real obligation to continue working on it if they do not wish to do so, or perhaps they have just not had the time yet. I'm sure you might find someone who's willing to fork it and/or submit a PR to update it to Python 3 if they're compensated πŸ™‚

Anyhow, I'm also a great fan of this package and needed a substitute, so I made somewhat of a port to Node (olssonm/alfred-password-generator) albeit much simpler with fewer features if anyone's interested.

olssonm avatar Apr 09 '22 21:04 olssonm

@olssonm sorry if I was too direct, but I didn't mean the repo owner by "maintainer". I meant anyone who is able to make a fix (even me if I will figure out how, hehe).

By the way, your workflow works great for me, thank you!

ValeryP avatar Apr 10 '22 06:04 ValeryP

I found a project replaced it, I hope it is useful to you. alfred-password-generator

FreoFreo avatar Apr 19 '22 05:04 FreoFreo

I found a project replaced it, I hope it is useful to you. alfred-password-generator

I tried it and it works as expected. The script itself is very simple, I like it a lot.

gabriel-r avatar Apr 19 '22 13:04 gabriel-r

@olssonm your Node.js workflow is quite nice, and very tidy. Well done! πŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌ

ryanblock avatar Apr 29 '22 02:04 ryanblock

Thanks @ryanblock !

(Huge fan since the gdgt-days btw!)

olssonm avatar Apr 29 '22 06:04 olssonm

I got the workflow running again on 12.3:

  • Installed Python 2.7.18 on Homebrew/pyenv (https://www.alfredapp.com/help/kb/python-2-monterey/)
  • Installed the PyObjC-package: python -m pip install pyobjc==5.2. The latest version for Python 2.7 of PyObjC (5.3) produced a bus error on my 12.3 installation, so I installed version 5.2, which works fine. This package is used for copying the password to the clipboard using NSPasteboard (pasteboard.py), I think this is a missing part in pSpitzners solution (https://github.com/deanishe/alfred-pwgen/issues/12#issuecomment-1087593024)
  • Changed the Python-paths in the Script Filters and Run Scripts to /usr/local/bin/python (in my case)

Works fine.

purpltentacle avatar May 04 '22 06:05 purpltentacle

What if we add a custom env var that sets Python binary directory? This way, I could just add the var in the workflow config, and it'd be used at run time, WDYT?

image

πŸ’‘

cristopher-rodrigues avatar May 21 '22 04:05 cristopher-rodrigues

What if we add a custom env var that sets Python binary directory? This way, I could just add the var in the workflow config, and it'd be used at run time, WDYT?

I did something similar in my ProxmoxControl-Workflow. Before running a Python-script, I export the PYTHON_PATH variable. Seems to be working fine.

python_path

script_filter

purpltentacle avatar May 22 '22 08:05 purpltentacle

I found a project replaced it, I hope it is useful to you. alfred-password-generator

This is great, super simple and straightforward. Thanks for creating this!

danielhanold avatar May 24 '22 18:05 danielhanold

Manually running pwgen.py gives this error ./pwgen.py", line 200 os.makedirs(user_generator_dir, 0700) ^ SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

change : os.makedirs(user_generator_dir, int('0700',8))

fast01 avatar Jul 06 '23 08:07 fast01

https://github.com/alfred-workflow-collections/password

chenyk1219 avatar Dec 18 '23 07:12 chenyk1219