Python 2.7.3 on OSX 10.8.2
I am currently writing a script that imports a markdown module. I used #!/usr/bin/env pythonshebang for portability. The script works fine when I run it directly in the shell via./myscript.py arg1
When I run a script due to a shell (login), for example, through AppleScript do shell script "/path/to/myscript.py " & quoted form of arg1, it does not work with
myscript.py", line 8, in <module>
import markdown
ImportError: No module named markdown
I assume this might be a problem for shebang, so I changed the shebang to my python location #!/usr/local/bin/pythonand of course the script worked fine.
So my question is twofold:
- Why
/usr/bin/env pythondoes use interrupt my import? - How can I avoid this problem without using
/usr/local/bin/python?