On Jul 9, 6:42 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Fri, 06 Jul 2007 17:15:22 -0300, Benjamin <[EMAIL PROTECTED]>  
> escribió:
>
> >> > > > How does one get the path to the file currently executing (not the
> >> > > > cwd). Thank you
> > So:
> > if __name__ == "main":
> >     currentDir = os.path.dirname(sys.argv[0])
> > else:
> >     currentDir = os.path.dirname(__file__)
>
> I think you meant to test for "__main__", but anyway, this should be  
Yes
> enough:
> currentDir = os.path.dirname(__file__)
> or perhaps os.path.dirname(os.path.abspath(__file__)). Try to determine  
> that early in your program because __file__ may contain a relative path  
> (and will give a wrong result after changing the current directory).
I do it right at the top of the first module. Thanks for the help.
>
> --
> Gabriel Genellina


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

Reply via email to