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 Attachments: http://www.ruby-forum.com/attachment/2182/random.xrc -- Posted via http://www.ruby-forum.com/.
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 Steele On Fri, Jun 13, 2008 at 5:20 PM, Joseph Edelstein <lists at ruby-forum.com> wrote:> 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 > > Attachments: > http://www.ruby-forum.com/attachment/2182/random.xrc > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20080613/0e02d9aa/attachment.html>
Joseph Edelstein
2008-Jun-13 22:47 UTC
[wxruby-users] Rubyscript2exe undefined ''run'' method
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 Steele wrote: -- Posted via http://www.ruby-forum.com/.
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 Steele On Fri, Jun 13, 2008 at 5:47 PM, Joseph Edelstein <lists at ruby-forum.com> wrote:> 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 Steele wrote: > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20080613/c1ab013f/attachment.html>
Joseph Edelstein
2008-Jun-13 23:17 UTC
[wxruby-users] Rubyscript2exe undefined ''run'' method
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 Steele 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 Steele > > On Fri, Jun 13, 2008 at 5:47 PM, Joseph Edelstein <lists at ruby-forum.com>Attachments: http://www.ruby-forum.com/attachment/2183/random.xrc -- Posted via http://www.ruby-forum.com/.
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 Edelstein <lists at ruby-forum.com> wrote:> 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 Steele 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 Steele > > > > On Fri, Jun 13, 2008 at 5:47 PM, Joseph Edelstein <lists at ruby-forum.com> > > > Attachments: > http://www.ruby-forum.com/attachment/2183/random.xrc > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20080613/f2493bbd/attachment.html>
Joseph Edelstein
2008-Jun-16 15:53 UTC
[wxruby-users] Rubyscript2exe undefined ''run'' method
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 Steele 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 Edelstein <lists at ruby-forum.com>-- Posted via http://www.ruby-forum.com/.
Joseph Edelstein 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