rubyscript2exe.rb issue

ruby

    Sponsored Links

    Next

  • 1. rescue clause
    [Note: parts of this message were removed to make it a legal post.] I have been looking at the source code for rake (as you can probably tell from my previous questions), in an attempt to study a reasonable sized Ruby application and see what I can learn from the exercise. I've come across something that looks like it could be an innocuous typo in the code, or it could be doing something that I just don't understand. Here is the code snippet: def standard_exception_handling begin yield rescue SystemExit => ex # Exit silently with current status exit(ex.status) rescue SystemExit, OptionParser::InvalidOption => ex # Exit silently exit(1) end end I am curious as to why SystemExit shows up in 2 different rescue clauses. Is that a typo? Or is something else going on? --wpd

rubyscript2exe.rb issue

Postby vinod » Sat, 10 Feb 2007 01:51:21 GMT

I have created some script which runs fine when i ran it from the
command promt ruby file.rb.
but when i conver it to exe using rubyscript2exe & tried to ran the
exe it gave me following error
I didnt find WINDOWS-1252.rb file on my machine. so question
1)how it running from command prompt without this file

I also tried packing the iconv.rb file into exe package but still no
luck
Can anybody please help me on this?

Vinod
----------------------------------------------------------------------------------------------------------------------
no such file to load -- rexml/encodings/WINDOWS-1252.rb
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/treeparser.rb:89:in `parse': #<ArgumentError: No decoder found
for encodin
g WINDOWS-1252.  Please install iconv.> (REXML::ParseException)
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
encoding.rb:42:in `encoding='
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
source.rb:47:in `encoding='
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/baseparser.rb:203:in `pull'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/treeparser.rb:21:in `parse'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
document.rb:190:in `build'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
document.rb:45:in `initialize'
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\app
\solutionfile.rb:25
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\app
\solutionfile.rb:20
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\bootstrap.rb:
50
...
No decoder found for encoding WINDOWS-1252.  Please install iconv.
Line: 1
Position: 47
Last 80 unconsumed characters:
        from C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/
lib/rexml/document.rb:190:in `build'
        from C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/
lib/rexml/document.rb:45:in `initialize'
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
2\app\solutionfile.rb:25
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
2\app\solutionfile.rb:20
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
2\bootstrap.rb:50


Similar Threads:

1.rubyscript2exe.rb question

anybody seen this:

   jib:ahoward > ruby rubyscript2exe.rb rq q create
   Tracing rq ...
   Gathering files...
   Copying files...
   Stripping...
   Creating rq_linux ...


   jib:ahoward > rq_linux q list
   /tmp/eee.rq_linux.2/bin/ruby: warning: Insecure world writable dir /tmp in LOAD_PATH, mode 041777
   /tmp/eee.rq_linux.2/bin/ruby: loading from unsafe file /tmp/eee.rq_linux.2/bootstrap.rb (SecurityError)


   jib:ahoward > echo $?
   1

workaround?

-a
-- 
be kind whenever possible... it is always possible.
- the dalai lama

2.resolv.rb issues with metasploit3.1 on OSX 10.5.4 ruby 1.8.6

3.wsdl2ruby.rb issue - part: value cannot be resolved (RuntimeError)

4.Newbie Question. eval.rb variable scope issue

From: "Rishel,Wes" < XXXX@XXXXX.COM >
> 
> I am a Python duffer who got interested in Rails an decided to check out
> Ruby.
> 
> This dandy little Ruby script illustrates the issue
> 
> a = ['word = 2', 'word']
> 
> a.each do | line |
>        begin
>               print eval(line).inspect, "\n"
>        rescue ScriptError, StandardError
>               print line + "\n"   # WJR change
>               printf "ERR: %s\n", $! || 'exception raised'
>        end
> end
> 
> After some perusing the available on-line manuals I have not been able
> to find a way to fix eval.rb to remember the scope of variables created
> in the input to it. Perhaps I am missing something obvious?

Welcome !

I don't know the exact reason, but it seems you'll need to
obtain a binding context from outside the iterator block.
E.g.

  a = ['word = 2', 'word']
  b = binding
  a.each {|line| p( eval(line, b) ) }


Incidentally, have you found `irb` yet?  There should be an irb.bat
in the bin directory next to your ruby.exe.  IRB is "interactive
ruby", similar to invoking python with no arguments.

A couple tips:

  p(expr) is a shortcut for puts(expr.inspect)

So,

  print eval(line).inspect, "\n"

can be written as:

  p line

Also, puts is like print, but adds the "\n" for you.
So,

  print line + "\n"

can be:

  puts line



Hope this helps,

Regards,

Bill

  

5.soap4r wsdl2ruby.rb issue - part: value cannot be resolved (RuntimeError)

6. Package, a future replacement for setup.rb and mkmf.rb

7. [BUG/PATCH] cgi/session.rb, cgi/session/pstore.rb

8. "ruby myscript.rb" Works, "./myscript.rb" Doesn't



Return to ruby

 

Who is online

Users browsing this forum: No registered users and 90 guest