import os print('Absolute path of file: ', os.path.abspath(__file__)) print('Absolute directoryname: ', os.path.dirname(os.path.abspath(__file__)))