Re: Getting original working directory

rave247 rave247 rave247 at seznam.cz
Thu Sep 6 14:50:09 EDT 2007


> One of the best portable ones that I've seen used is this:
> 
> os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'.'))

This is not working. Please look at this code:


import os
import sys

x = os.getcwd()

os.chdir("\whatever")

y = #here I don't know. This code is not working: os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'.'))

if x == y: print 'This is what I need'





> 
> I've used it myself and it works for my needs.
> 
> Mike
> 



More information about the Python-list mailing list