[Ironruby-core] Open-Uri Path in App.Config

Mohammad Azam lists at ruby-forum.com
Mon Mar 1 09:25:42 EST 2010


So, I added the paths that you provided in my C# code since I am trying 
to execute the .rb file from C#. Here is the complete code:

  static void Main(string[] args)
        {
            var url = "http://www.google.com.com";

            var engine = IronRuby.Ruby.CreateEngine();
            var scope = engine.ExecuteFile("../../screenscraper.rb");

            var paths = new List<String>();
            paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib");
            paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby\1.8");
            paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\site_ruby");
            paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ruby\1.8");


            engine.SetSearchPaths(paths);


            var obj = 
engine.Runtime.Globals.GetVariable("ScreenScraper");

            var screenScraper = engine.Operations.CreateInstance(obj);

            var html = engine.Operations.InvokeMember(screenScraper, 
"scrape", url);

            Console.WriteLine(html);

        }


When I run the application I get the following error:


Unhandled Exception: IronRuby.Builtins.LoadError: no such file to load 
-- open-u
ri
   at 
Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame 
fram
e)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame 
frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 
arg0, T1 a
rg1)
   at IronRuby.Runtime.RubyScriptCode.Run(Scope scope, Boolean 
bindGlobals)
   at IronRuby.Runtime.RubyScriptCode.Run(Scope scope)
   at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink 
errorSink)
   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope 
scope)
   at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path)
   at IronRubyConsoleApp.Program.Main(String[] args) in 
C:\Projects\ILoveIronRub
y\ILoveIronRuby\IronRubyConsoleApp\Program.cs:line 15
Press any key to continue . . .



-- 
Posted via http://www.ruby-forum.com/.


More information about the Ironruby-core mailing list