alfred-datetime-format-converter icon indicating copy to clipboard operation
alfred-datetime-format-converter copied to clipboard

For anyone still using this after macOS 12.3

Open 0x-2a opened this issue 2 years ago • 5 comments

Apple removed the system python 2. I use this workflow all the time and needed to bring it back. Here's what I did.

First get python 2 back

# Download/run the legacy macOS installer (pick which one for your sys)
https://www.python.org/downloads/release/python-2716/

# Add pip for python2.7
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip2.py
python2 get-pip2.py

# Add the missing macos plist lib alfred uses
curl https://raw.githubusercontent.com/python/cpython/2.7/Lib/plistlib.py -o /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py

# Add missing pip for this workflow
python2 -m pip install delorean

# Optionally add the helpers like easy_install back onto your path
# In your ~/.zprofile or whatever bash/shell profile equivalent
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

Now open alfred preferences > Workflows > double click on the script filter square in the workflow GUI Update the script filter to one of the two below.

If which python shows 2.7

/usr/local/bin/python process.py "{query}"

If which python shows 3...

/usr/local/bin/python2 process.py "{query}"

For more legacy python2 help I wrote an SO post: https://stackoverflow.com/a/71513250/786389

0x-2a avatar Mar 17 '22 16:03 0x-2a

I used pyenv to install python 2.7 now using: /Users/username/.pyenv/versions/2.7.18/bin/python2.7 process.py "{query}"

works. Before I linked to a python2 version which was installed with MAMP, but that did not work.

Anyway, thanks for the tip!

philotas avatar Apr 22 '22 10:04 philotas

@philotas thx, it works. More details are below:

  1. Install pyenv and python2.7
brew install pyenv
pyenv install 2.7.18
  1. Change the script to
$HOME/.pyenv/versions/2.7.18/bin/python2.7 process.py "{query}"

polym avatar May 18 '22 07:05 polym

I created a Python 3 compatible fork here: https://github.com/alexmerkel/alfred-datetime-format-converter

alexmerkel avatar May 26 '22 15:05 alexmerkel

I created a Python 3 compatible fork here: https://github.com/alexmerkel/alfred-datetime-format-converter

Can you supported millisecond level and add a default date time about UTC time zone when used other time zones? Thank you so much

HQCND avatar Jul 14 '22 11:07 HQCND

Thanks to a pull request by @fg6a5gf this functionality is added now.

alexmerkel avatar Jul 31 '22 10:07 alexmerkel