Closed netnothing closed 2 years ago
So it looks like the only change that needs to happen is in the print statement.
In Python 3, you can only print as: print("STRING")
So adding the parentheses makes the script work with python3.
So adding the parentheses makes the script work with python3.
The only mention of "print" in changecase.py is line 39
print """<?xml version="1.0"?>
But changing that to print("STRING") """<?xml version="1.0"?>
Doesn't fix it. Am I doing this wrong?
You need to add parentheses in two places:
Line 39 original:
print """<?xml version="1.0"?>
Line 39 new:
print("""<?xml version="1.0"?>
Line 72 original:
</items>""" % variations
Line 72 new:
</items>""" % variations)
That's it!
@netnothing Still not working for me.
print("""<?xml version="1.0"?>
<items>
<item arg="%(lower)s">
<title>"%(lower)s"</title>
<subtitle>Transform text to `lowercase`</subtitle>
<icon>lowercase.png</icon>
</item>
<item arg="%(upper)s">
<title>"%(upper)s"</title>
<subtitle>Transform text to `UPPERCASE`</subtitle>
<icon>uppercase.png</icon>
</item>
<item arg="%(title)s">
<title>"%(title)s"</title>
<subtitle>Transform text to `Title Case`</subtitle>
<icon>titlecase.png</icon>
</item>
<item arg="%(camel)s">
<title>"%(camel)s"</title>
<subtitle>Transform text to `CamelCase`</subtitle>
<icon>camelcase.png</icon>
</item>
<item arg="%(kebab)s">
<title>"%(kebab)s"</title>
<subtitle>Transform text to hyphenated `kebab-case`</subtitle>
<icon>kebabcase.png</icon>
</item>
<item arg="%(snake)s">
<title>"%(snake)s"</title>
<subtitle>Transform text to `snake_case`</subtitle>
<icon>snakecase.png</icon>
</item>
</items>""" % variations)
Hmmm odd.
Python3 is installed and it is working correct? What's it showing you when you try to run the workflow?
Also make sure in the workflow itself in Alfred, double click on each of the 3 Script Filters (tt, case, transform). This will open the actual call.
Depending on how you installed python, the script might need to be updated.
The original script would be something like:
pbpaste | python changecase.py "{query}"
For me, I had to change each to:
pbpaste | python3 changecase.py "{query}"
Because I just did a standard python3 install, and didn't update any paths.
@netnothing Right you are! I installed Python with Homebrew, so I had to update the path.
pbpaste | /opt/homebrew/opt/python/bin/python3 changecase.py "{query}"
Thanks!
@netnothing Right you are! I installed Python with Homebrew, so I had to update the path.
pbpaste | /opt/homebrew/opt/python/bin/python3 changecase.py "{query}"
Thanks!
Awesome to hear!!
@netnothing @petebocken Thanks for your interest in this. I've ignored it for too long, but finally made some updates. The version here on github should work with python3 and plain python now if you want to try that.
Also make sure in the workflow itself in Alfred
Thanks so much. Just updated in Alfred with the new version and everything is working good with python3!
Really appreciate this workflow - use it all the time.
Will you be updating this script to work with python3, since the latest macOS release 12.3 removes python2?