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

haynesc at gmail.com haynesc at gmail.com
Mon Feb 28 14:50:12 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.
>
> Thanks,
> -Kartic

Sorry, here is the exact error:

Traceback (most recent call last):
 File "hapSim.py", line 415, in ?
   run(REPLICATES, dsSelection, permuteStatus, sigThreshold
 File "hapSim.py", line 354, in run
   createInput(dt)
 File "hapSim.py", line 178, in createInput
   inF = open(IN_FNAME, "w")
IOError: [Errno 2] No such file or directory: 'prog.input'

I am using the same file name repeatedly, it works fine the first few
thousand times, but eventually gives this error.




More information about the Python-list mailing list