cannot open file in write mode, no such file or directory
Steve Holden
steve at holdenweb.com
Mon Feb 28 14:46:57 EST 2005
Kartic wrote:
>>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.
>
Another low-probability cause is that you are trying to create files in
a non-existent directory.
regards
Steve
More information about the Python-list
mailing list