Initialize : permission denied

Hi,
Tryin to create a file that I’ll write in. The error I get is:
initialize : permission denied
I’ve tried all of the following
File.new(“a151noplus.txt”,“w”)
g=File.new(“a151noplus.txt”,“w”)
File.new(‘a151noplus.txt’,‘w’)
g=File.new(‘a151noplus.txt’,‘w’)

Single quotes, double quotes, hit enter while swinging a dead chicken
over my head and chanting…no luck.

Bob M. wrote:

over my head and chanting…no luck.
Typically “permission denied” means you don’t have write-access to the
directory or file. Nothing to do with quoting.

Never mind…I got it.

I needed to specify a directory, and use “/” forward slashes.

Bob M. wrote:

Tryin to create a file that I’ll write in. Â The error I get is:
initialize : permission denied

I know this is a crazy idea, but would it by any chance be possible that
you
don’t have permission to write to the file?
On Windows that could be the result of the file already being opened. Or
just
by you not having the required permissions on the file.

HTH,
Sebastian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs