# Frozen string

**URL:** <https://www.ruby-forum.com/t/frozen-string/168928>\
**Category:** Ruby\
**Created:** [May 27, 2009, 1:35pm UTC](https://www.ruby-forum.com/t/frozen-string/168928 "2009-05-27T13:35:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [May 27, 2009, 1:35pm UTC](https://www.ruby-forum.com/t/frozen-string/168928/1 "2009-05-27T13:35:19Z")

</div>

Hi,

Am trying to get rubyscript2exe to work and get the error shown below.

I’ve read the posts about this before (changing a line rubyscript2exe  
etc) but none of the answers work for me. Can someone suggest what I’m  
doing wrong? New to Ruby, by the way…

D:\rubyplay\>ruby -v  
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

D:\rubyplay\>helloworld.rb  
Hello World!

D:\rubyplay\>ruby rubyscript2exe-0.5.3.rb helloworld.rb  
rubyscript2exe-0.5.3.rb:621:in `replace': can't modify frozen string (TypeError) from rubyscript2exe-0.5.3.rb:621 from rubyscript2exe-0.5.3.rb:577:in`newlocation’  
from rubyscript2exe-0.5.3.rb:505:in `newlocation' from rubyscript2exe-0.5.3.rb:472:in`newlocation’  
from rubyscript2exe-0.5.3.rb:505:in `newlocation' from rubyscript2exe-0.5.3.rb:577:in`newlocation’  
from rubyscript2exe-0.5.3.rb:619

Many thanks,  
Rowantree

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [May 27, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/frozen-string/168928/2 "2009-05-27T17:02:48Z")

</div>

Look at rubyscript2exe-0.5.3.rb line 612 perhaps?

At a guess, maybe it’s doing something with $0. At some stage after  
1.8.6p114, $0 was changed from a regular string to a frozen string. If  
that’s your problem, try changing

$0.replace(“foo”)

to

$0 = “foo”

---

<div class="post-metadata">

**Author:** ![crucoba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Post date:** [May 27, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/frozen-string/168928/3 "2009-05-27T17:20:37Z")

</div>

Brian C. wrote:

> Look at rubyscript2exe-0.5.3.rb line 612 perhaps?
> 
> At a guess, maybe it’s doing something with $0. At some stage after  
> 1.8.6p114, $0 was changed from a regular string to a frozen string. If  
> that’s your problem, try changing
> 
> $0.replace(“foo”)
> 
> to
> 
> $0 = “foo”

Hi,

No… 'twasn’t that unfortunately… thanks though.

Cheers,  
David
