# Re: Trouble with Marshal

**URL:** <https://www.ruby-forum.com/t/re-trouble-with-marshal/73780>\
**Category:** Ruby\
**Created:** [October 26, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/re-trouble-with-marshal/73780 "2006-10-26T23:51:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 26, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/re-trouble-with-marshal/73780/1 "2006-10-26T23:51:03Z")

</div>

From: Gavin K.

> p s2 = Marshal.load( IO.read( ‘desc.marshal’ ) )
> 
> #=\> foo.rb:13:in `load’: marshal data too short (ArgumentError)

Bah, my stupid fault. It was binary mode at stake, but on reading, not  
writing. Mauricio Fernández kindly pointed out my error. Changing the  
above to…  
File.open( ‘desc.marshal’, ‘rb’ ){ |f| @s2 = Marshal.load( f.read ) }  
…fixed my problem.

Thanks for the help, sorry for the noise.
