import os basedir = os.path.abspath(os.path.dirname(__file__)) print(basedir)