3

I have a service in Automator that I pass a folder and it runs on every file in the folder. It uses a python script to read the album field from an mp3's id3 tags and write it to the Finder comment field:

enter image description here

This worked fine in Mojave, with each file's album being written to its comment. Now with Catalina when I run the service, every comment gets set to the following:

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/thompcha/Documents/Scripts/album.py': [Errno 1] Operation not permitted
  • The script works fine if I run it manually from the terminal
  • I granted Automator, Terminal, and Python full disk access in System Preferences
  • I installed python via Homebrew as suggested in responses to similar questions
  • I made the script chmod 777 and changed the owner to myself

The answer found here does not work for me because I need to pass the output of the python script to the rest of the shell script for further execution.

What can I do to make automator successfully execute my python script?

2
  • Please add the content of album.py (or share a link)!
    – klanomath
    Jan 15, 2020 at 2:49
  • You're not running your script with a Homebrew python, so anything Homebrew might have done to break things is not relevant. Which python interpreter did you give permissions to? The system python 2.7 is saying it can't open the script. If you move the script out of your Documents folder, does it now work? Mar 9, 2021 at 22:58

1 Answer 1

0

I ended up in-lining my python script. The finished product looked like this:

for f in "$1"/*.mp3;
do

    updated=$(python -c "import eyed3; import sys; eyed3.log.setLevel(\"ERROR\"); filename = '$f'; from eyed3 import mp3; f = mp3.Mp3AudioFile(filename); album = f.tag.album; f.tag.comments.set(album); f.tag.save(); print(album); exit(album);")

    comment=$(mdls -r -nullMarker "" -n kMDItemFinderComment "$f")

    printf "%s ( comment ): %s\n" "${1##*/}" "$comment"

    /usr/bin/osascript -e "set filepath to POSIX file \"$f\"" \
    -e "set the_File to filepath as alias" \
    -e "tell application \"Finder\" to set the comment of the_File to \"$updated\""

done
3
  • This answer doesn't solve actual problem. Feb 23, 2021 at 2:49
  • Actually, it does. It does what the OP needed done. It exposes another issue, though. Mar 9, 2021 at 23:00
  • Yeah, I'm not gonna write up a whole new question, but if you want to, feel free to link to it here.
    – Keyslinger
    Mar 11, 2021 at 0:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .