python get the path of a script code example Example 1: python get script path os.getcwd() Example 2: get pyhton file path python import os os.path.realpath(__file__)