code
macname@MacdeMBP Desktop % python3 test.py /Users/macname/Desktop/test.py /Users/macname/Desktop macname@MacdeMBP Desktop % cat test.py #coding=utf-8 import os print(os.path.abspath(__file__)) print(os.path.dirname((os.path.abspath(__file__)))) macname@MacdeMBP Desktop %