From: youngung on
Hello pythoners!

I just dived into ipython since I'd like to make use of matplotlib.
Over the trials, I came across a problem.
One of the scripts that I have is not working with ipython, while it
has been and still is working well with Python GUI.

The problem is, even though I have the file in the c:\python26 folder,
IPython can't fine it.

One of the many things I tried, is as below.

*************************************************


f=open('od.txt','w')
---------------------------------------------------------------------------
IOError Traceback (most recent call
last)

C:\Windows\system32\<ipython console> in <module>()

IOError: [Errno 13] Permission denied: 'od.txt'



What should I do further to solve this problem?
From: Eli Bendersky on
> One of the many things I tried, is as below.
>
> *************************************************
>
>
> f=open('od.txt','w')
> ---------------------------------------------------------------------------
> IOError                                   Traceback (most recent call
> last)
>
> C:\Windows\system32\<ipython console> in <module>()
>
> IOError: [Errno 13] Permission denied: 'od.txt'
>
>

It appears that your ipython runs in C:\Windows\system32
You can find it out for sure by executing "os.getcwd()" after
importing the "os" module.

You may not have permissions in C:\Windows\system32, which is why the
error is printed.

Eli
From: Eli Bendersky on
On Fri, Jul 9, 2010 at 16:07, Youngung Jeong <youngung.jeong(a)gmail.com> wrote:
> Thank you for your kindness.
> I found you're right. It's running in that folder.
> What should I do for making this work?
> Could you please tell me a bit more...
>
> Youngung

You can change the "current directory" ipython executes in, by either
executing it directly (from the command line) in the directory of your
choice, or calling the os.chdir function with the path of your choice.

Eli