# Rubyscript2exe undefined 'run' method

**URL:** <https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010>\
**Category:** wxRuby\
**Created:** [June 14, 2008, 12:20am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010 "2008-06-14T00:20:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 12:20am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/1 "2008-06-14T00:20:14Z")

</div>

After I ran my program through Rubyscript2exe, the Random.exe file that  
it created is causing the following error:  
D:\Ruby projects\>random.exe  
C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:59: undefined  
method ‘ru  
n’ for Wxruby2::App (NoMethodError)  
from  
C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\bootstrap.rb:77:in `load’

```
    from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\bootstrap.rb:77

```

The program runs fine when run from the Random.rb file. I want to  
create an exe for others that do not have Ruby installed on their  
Computer.

I am attaching my Ruby code:

begin  
require ‘rubygems’  
rescue LoadError  
end

require ‘rubyscript2exe’  
require ‘Wx’  
include Wx  
require ‘random\_frame.rb’  
RUBYSCRIPT2EXE.bin = [“random.xrc”]  
RUBYSCRIPT2EXE.bin = [“random\_frame.rb”]  
def random\_process  
file = @file\_path.split("\")  
@file\_path = file.join("\\")  
@file\_path \<\< “\Random.txt”  
random\_file = File.new(@file\_path , “w”)  
i = 0  
max = @max\_number.to\_i  
b = 10 \*\* (@number\_of\_digits.to\_i - 1)  
random\_seed = 10 \*\* (@number\_of\_digits.to\_i)  
g = 0  
g\_max =100  
@progress\_guage.set\_value(0)  
while i \< max  
a = rand(random\_seed)  
if (a \> b) then  
random\_file.puts a  
i = i + 1  
while ((i/max) \* 100) \> (@progress\_guage.get\_value())

```
    @progress_guage.pulse()
    sleep(0.08)
  end#gauge while

```

end #if  
end #while  
end#def

class RandomFrame \< RandomBase  
def initialize  
super  
evt\_button(start\_button) {|event| on\_start(event)}  
end  
def on\_start(event)  
path = @dirtree.get\_path()  
if location\_textbox.get\_value().length == 0 then  
@location\_textbox.clear  
@location\_textbox.append\_text(path)  
end  
@max\_number = number\_of\_random\_textbox.get\_value()  
@number\_of\_digits = number\_of\_digits\_textbox.get\_value()  
@file\_path = location\_textbox.get\_value()  
if (@number\_of\_digits.to\_i == 0) or (@max\_number.to\_i == 0) then  
elsif path.length == 0 then  
else  
random\_process  
end#if  
end  
end  
App.run do  
RandomFrame.new.show  
end

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 12:28am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/2 "2008-06-14T00:28:02Z")

</div>

Hello Joesph,

Yeah, Rubyscript2exe has this problem, the only thing that we can  
suggest,  
is to change the code:

App.run do  
RandomFrame.new.show  
end

Into:

class RandomApp \< App  
def on\_init()  
RandomFrame.new.show  
end  
end

RandomApp.new.main\_loop()

RubyScript2EXE does not like the App.run method for some reason, and I  
can’t  
personally figure out why, Alex may know, but that will allow your app  
to  
run.

L8ers,

Mario S.

On Fri, Jun 13, 2008 at 5:20 PM, Joseph E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 12:47am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/3 "2008-06-14T00:47:29Z")

</div>

Mario,

That code fixed the problem with load. However it shows a problem know  
with Gauge.

Does it also not like a gauge?

C:/DOCUME~1/JEDELS~1/eee/eee.Random.exe.2/lib/random\_frame.rb:26:in  
`find_window _by_id': Error wrapping object; class`wxGauge95’ is not supported in  
wxRuby (No  
tImplementedError)  
from  
C:/DOCUME~1/JEDELS~1/eee/eee.Random.exe.2/lib/random\_frame.rb:26:in  
`initialize' from C:/DOCUME~1/JEDELS~1/eee/eee.Random.exe.2/lib/random_frame.rb:39:in`call’  
from  
C:/DOCUME~1/JEDELS~1/eee/eee.Random.exe.2/lib/random\_frame.rb:39:in  
`initialize' from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:39:in`init  
ialize’  
from  
C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:60:in `new’

```
    from 

```

C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:60:in `on_i nit' from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:64:in`main  
\_loop’  
from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\app\Random.rb:64  
from  
C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\bootstrap.rb:77:in `load’

```
    from C:\DOCUME~1\JEDELS~1\eee\eee.Random.exe.2\bootstrap.rb:77

```

Mario S. wrote:

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 1:03am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/4 "2008-06-14T01:03:11Z")

</div>

Hey Joesph,

I knew I had seen this error before. The problem lies with XRC being  
genereated by what I belive is Dialog Blocks that your using. It  
attempts  
to create the Guage that is “Platform” specific. What you need to do,  
is go  
into your generated XRC file, change any instances of wxGuage95, into  
just  
wxGuage, that will allow Ruby to correctly create the guage, without the  
trouble.

Hope this helps,

Mario S.

On Fri, Jun 13, 2008 at 5:47 PM, Joseph E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 1:17am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/5 "2008-06-14T01:17:38Z")

</div>

I just checked my XRC file. The file had wxGuage listed already with no  
mention of wxGuage95. I did create the XRC with Dialog Blocks however.

Mario S. wrote:

> Hey Joesph,
> 
> I knew I had seen this error before. The problem lies with XRC being  
> genereated by what I belive is Dialog Blocks that your using. It  
> attempts  
> to create the Guage that is “Platform” specific. What you need to do,  
> is go  
> into your generated XRC file, change any instances of wxGuage95, into  
> just  
> wxGuage, that will allow Ruby to correctly create the guage, without the  
> trouble.
> 
> Hope this helps,
> 
> Mario S.
> 
> On Fri, Jun 13, 2008 at 5:47 PM, Joseph E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 16, 2008, 5:53pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/6 "2008-06-16T17:53:49Z")

</div>

First, Thank you for all the research you have done.

I double-checked and I am using the 1.9.7 version of WxRuby. I also did  
a little research and found that if I comment out everything about the  
gauge I get another NoMethodError, this time for the ‘acquire\_id’ for  
the button. Seems to me that something is not getting added to the  
Random.exe that I am trying to create.

Any idea on what I am doing wrong?

Joe

Mario S. wrote:

> Okay,
> 
> After doing some research, and digging up some of the old bugs, I found  
> this  
> to be a bug that we use to have in the 1.9.3 → 1.9.4 releases of  
> wxRuby.  
> Are you using a version of wxRuby previous to 1.9.4/1.9.5? It’s  
> recommended  
> that you be using 1.9.7 of wxRuby, as that is the most recent, and most  
> stable version of wxRuby.
> 
> On Fri, Jun 13, 2008 at 6:17 PM, Joseph E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 14, 2008, 1:52am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/7 "2008-06-14T01:52:25Z")

</div>

Okay,

After doing some research, and digging up some of the old bugs, I found  
this  
to be a bug that we use to have in the 1.9.3 → 1.9.4 releases of  
wxRuby.  
Are you using a version of wxRuby previous to 1.9.4/1.9.5? It’s  
recommended  
that you be using 1.9.7 of wxRuby, as that is the most recent, and most  
stable version of wxRuby.

On Fri, Jun 13, 2008 at 6:17 PM, Joseph E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joseph\_edelstein](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@joseph\_edelstein](https://www.ruby-forum.com/u/joseph_edelstein)\
**Post date:** [June 17, 2008, 10:22am UTC](https://www.ruby-forum.com/t/rubyscript2exe-undefined-run-method/226010/8 "2008-06-17T10:22:09Z")

</div>

Joseph E. wrote:

> First, Thank you for all the research you have done.
> 
> I double-checked and I am using the 1.9.7 version of WxRuby. I also did  
> a little research and found that if I comment out everything about the  
> gauge I get another NoMethodError, this time for the ‘acquire\_id’ for  
> the button. Seems to me that something is not getting added to the  
> Random.exe that I am trying to create.

The errors about “wxGauge95” and “acquire\_id” would both occur if some  
parts of the wxRuby library written in Ruby weren’t included. The  
relevant parts should be in lib/wx/classes - in this case,  
lib/wx/classes/gauge.rb and lib/wx/classes/evthandler.rb.

The rubyscript2exe pages have info about unpacking and examining the  
contents of an executable. Could you try unpacking the generated  
executable and see if those components are there in the right place  
please? The structure should be something like

lib/wx.rb  
…  
lib/wx/classes/gauge.rb

alex
