python get the path of current script code example Example 1: get path to current directory python import os os.path.abspath(os.getcwd()) Example 2: python get script path os.getcwd()