From: Timothy Hunter Date: 2006-01-04T22:12:59+09:00 Subject: Re: File.new error Kai Vermehr wrote: > Hi Forum, > > I'm trying to create a file but I'm getting an error and can't find the > problem: > > ------------------------- > aFile = File.new("rubytestfile") > > puts "hello" > > aFile.close > ------------------------- > > I get this error. I'm working on Mac OS X: > > Errno::ENOENT: No such file or directory - rubytestfile > > thanks for any help! > Try aFile = File.new("rubytestfile", "w") If you don't specify the 2nd argument (the open mode) Ruby assumes you want to open the file for reading only. If the file doesn't exist, you can't read it.