From: Robert Klemme Date: 2009-09-05T21:10:33+09:00 Subject: Re: End of file error when trying to Marshal.load Please do not top post. On 05.09.2009 13:45, Vahagn Hayrapetyan wrote: > Tim, I'm on Mac OS X (Leopard). Now I have: > > Marshal.dump(o, File.open("output.txt", "wb")) > data = File.open("output.txt", "rb") > obj = Marshal.load(data) > > But I get the exact same error. > > / Vahagn > > Tim Hunter wrote: >> Vahagn Hayrapetyan wrote: >>> file. What's wrong? >> I'm guessing you're on Windows. You need to open the file in binary >> mode. That is, with "wb" and "rb". You also need to make sure you write the complete file which you don't because you're not closing the File properly. http://blog.rubybestpractices.com/posts/rklemme/001-Using_blocks_for_Robustness.html Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/