On Sat, Feb 7, 2009 at 9:09 AM, Wayne Watson
<sierra_mtnv...@sbcglobal.net>wrote:

>  Yes, amazingly enough, I'm quite familiar with basic file operations. :-)
> I'm certainly no expert at all variations of it.
> <snip>
> Now for a related question. I'm using Win XP. One of the arguments is the
> default_path. I would like it to be the same folder the program is in. How
> do I do that? "c:/.", "./",  or some variation?
>

IIRC you would use "."

In [4]: import os

In [5]: os.curdir
Out[5]: '.'

or of course, os.curdir would probably be more portable.

And just a little tidbit I discovered while working with a program that
would change directories, but I was running from inside Ipython, if you add
this to the beginning of your file:

import os
startpath = os.path.abspath(os.curdir)

and then this to the end:
os.chdir(startpath)

then it will keep your ipython environment in the directory you run the file
from.

HTH,
Wayne
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to