On Aug 21, 4:10 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> How do I find out what folder a script is in while it is executing?
>
> For example, for the file "C:/folder/script.py" contain the following
> two lines of code -
>
> myLocation = GetMyLocation()
> print myLocation
def GetMyLocation():
    runningFile = sys.argv[0] if __name__ == "__main__" else __file__
    return os.path.dirname(runningFile)
>
> >> C:/folder
>
> Thanks,
>
> Aine.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to