How to execute a python script on export?

I configured my export settings to execute a py file on export.

This is my py file:

#!/usr/bin/env python
import sys
import os

with open('out.txt', 'w') as f:
    print >> f, os.getcwd()
    print >> f, 'Number of arguments:', len(sys.argv), 'arguments.'
    print >> f, 'Argument List:', str(sys.argv)

However, it won't run my script. This is on Mac OSX.

Nvm, I found the error.log, it cannot create the file due to permission reason.

@marty you have to make your python script an executable file. windows users can follow instructions here: py to exe it is much easy to make a python script executable in mac and other unix linux type operating systems just with chmod and path commands (make a search).