From: "Kristian Sørensen" Date: 2004-03-16T12:19:25+09:00 Subject: Re: Ruby 1.8.1 write to file? Chad Fowler wrote: > > On Mar 14, 2004, at 8:04 PM, Kristian S�rensen wrote: > >> Hi! >> >> I have upgraded to ruby 1.8.1 .. and suddenly now my file-writing does >> not work. I get an error like: >> >> script:line:in `close': uninitialized stream (IOError) >> >> The code looks like this: >> >> File.open("e_macs.txt", "a") { |f| >> f << Time.new.to_s >> f << "\n" >> } >> >> What happend in writing to files from 1.6 to 1.8? I tried my way >> through rubycentral.com .. but apparently the API is not updated. >> >> How do I handle file writing (or reading) in Ruby 1.8? >> >> > > Can you show us your ruby -v output? I'm on "ruby 1.8.1 (2003-12-25) > [powerpc-darwin]" and it works without a problem. Just now I figured the problem: error 40! (40 cm away from the screen) I made a class myselv, which was called "File" ... :) Then naturally, the intended, default methods did not exist. Cheers, KS.