file open default location

kyosohma at gmail.com kyosohma at gmail.com
Tue Jun 12 09:46:25 EDT 2007


On Jun 12, 8:42 am, "T. Crane" <tcr... at REMOVETHISuiuc.edu> wrote:
> Hi,
>
> How is the default path chosen in this instance:
>
> myFile = file('test.txt','w')
>
> Here I'm opening/creating a file but I have not specified the exact path, so
> how does Python determine where to 'put' this file?  More to the point, how
> do I change what the default path is?  Right now it's a networked drive that
> should not be getting my Python clutter.
>
> Interestingly, this network drive is also where I can find my _ipython
> folder from my ipython install as well as my .matplotlib folder.  Can anyone
> tell me how to change where these folders and files go by default?
>
> thanks for any help,
> trevis

When you don't specify where you want to save a file, it saves the
file to the directory the script itself is run from. As far as I know,
you have to specify where you want the file saved if you don't want it
with the script.py

Mike




More information about the Python-list mailing list