0
votes

I'm not new to programming, but I am new to Python and Mac OSX. I have written a program that I then want to encapsulate with the Mac Automator (as a shell command task). I've done this before with other Python scripts (without any trouble) and know enough that I need:

chmod +x mypythonscript.py 

I have another Python script but I cannot get this one going under Automator at all. The primary difference is that this program relies on text files. It needs to be able to read, write and delete text files when it runs. So I think that my Automator problem is rooted in the permissions for these files.

What permissions do I need to set on my text files in order for Automator to run properly? Please keep in mind that I'm new to Mac OSX, so please send any permissions commands (I'm assuming terminal commands here) in very step-by-step instructions.

2

2 Answers

2
votes

To read and write files, you need to ensure file permissions are at least equivalent to those set by the following command (I am assuming the files are in the "current directory" -- i.e. you used cd to select the current directory):

chmod +rw *.txt

To delete files, you need to be able to modify the directory they are in:

chmod +w .
0
votes

This is the hard way.

In Automator select Run Shell Script, then /usr/bin/python as the shell. Paste your Python code in the body.