Cannot create a new file

John johng2001 at
Mon Jun 21 21:57:37 EDT 2004

Peter Hansen wrote:

> Eric Belanger wrote:
>> Ive created a little script which, at the end of it, deals with 
>> copying two files. All the script works fine except when its at the 
>> copy line(s). Nothing gets copied, it crashes at the first open() line.
>> Before using open() I made it the lazy way first and wrote system("cp 
>> "+file1+" "+file2), but gaves me that message:
>> IOError: [Errno 2] No such file or directory: 
>> '/home/bilange/.hnb-backup/1087861694'
> Could you please include the full traceback, cut and pasted from
> the console, so that we can see the parts just before what you
> show above?
> Also it would probably be a good idea to include a code snippet
> showing the previous ten-or-so commands just before the failing
> line.
> -Peter

Use copyfile from shutil module instead. More Pythonic and you can debug 
better. I think you are not in the right directory. Including abit more 
code in the posting helps.

More information about the Python-list mailing list