cannot open file in write mode, no such file or directory

Kartic kartic.krishnamurthy at gmail.com
Mon Feb 28 14:41:47 EST 2005


> I'm having a problem where when trying to open a file in write mode,
I
> get an IOError stating no such file or directory.  I'm calling an
> external program which takes an input file and produces an output
file
> repeatedly, simulating the input file separately for each replicate.
> The error occurs when trying to open the input file to write out the
> new data.  The problem is difficult to reproduce since it only shows
up
> once every few thousand replicates.  I've tried using both os.system

I am afraid you need to give more information that just IOError,
calling an external program.

Please post the exact message including the input filename at the time
the program went down. If you don't print the filename, please modify
your program to do so.

A shot in the dark solution to your problem might be that you are
dynamically  generating a filename and that filename probably contains
characters not allowed by the local file system OR you generate a path
that does not exist. For open() to work with the 'w' flag, the path
where the file you say should be created should exist.

Thanks,
-Kartic




More information about the Python-list mailing list