I completely forgot the paths that I need to setup to use open-uri in IronRuby when using with C#. I need to put those paths in my App.config to work with open-uri. Can anyone please paste those sections here? I keep forgetting those sections that I need to include in my App.config. -- Posted via http://www.ruby-forum.com/.
I guess you''re talking about that: <options> <set language=''Ruby'' option=''LibraryPaths'' value=''..\lib\IronRuby;..\lib\ruby\site_ruby\1.8;..\lib\ruby\site_ruby;..\lib\ruby\1.8''/> </options> Shay. -------------------------------------------------------- Shay Friedman | .NET Technologies Expert | Author of IronRuby Unleashed | Sela Technology Center Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay On Mon, Mar 1, 2010 at 3:21 AM, Mohammad Azam <lists at ruby-forum.com> wrote:> I completely forgot the paths that I need to setup to use open-uri in > IronRuby when using with C#. I need to put those paths in my App.config > to work with open-uri. Can anyone please paste those sections here? I > keep forgetting those sections that I need to include in my App.config. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100301/5b008bd0/attachment.html>
Is this still an issue? Provide a config file like this: <?xml version=''1.0'' encoding=''UTF-8''?> <configuration> <configSections> <section name=''microsoft.scripting'' requirePermission=''false'' type=''Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null''/> </configSections> <microsoft.scripting> <languages> <language extensions=''.py'' displayName=''IronPython 2.6.1'' type=''IronPython.Runtime.PythonContext, IronPython, Version=2.6.10920.0, Culture=neutral, PublicKeyToken=null'' names=''IronPython;Python;py''/> <language extensions=''.rb'' displayName=''IronRuby'' type=''IronRuby.Runtime.RubyContext, IronRuby, Version=0.9.4.0, Culture=neutral, PublicKeyToken=null'' names=''IronRuby;Ruby;rb''/> </languages> <options> <set language=''Ruby'' option=''LibraryPaths'' value=''C:\ironruby\lib\IronRuby;C:\ironruby\lib\ruby\site_ruby\1.8;C:\ironruby\lib\ruby\site_ruby;C:\ironruby\lib\ruby\1.8''/> </options> </microsoft.scripting> </configuration> Host IronRuby like this: var setup = ScriptRuntimeSetup.ReadConfiguration(); scriptRuntime = Ruby.CreateRuntime(setup); Engine = Ruby.GetEngine(Runtime); Context = Ruby.GetExecutionContext(Engine); // You can use Context.Loader.SetLoadPaths(IEnumerable<string> paths) to replace the load paths at run-time On Mon, Mar 1, 2010 at 2:21 AM, Mohammad Azam <lists at ruby-forum.com> wrote:> I completely forgot the paths that I need to setup to use open-uri in > IronRuby when using with C#. I need to put those paths in my App.config > to work with open-uri. Can anyone please paste those sections here? I > keep forgetting those sections that I need to include in my App.config. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100301/6a3f58cc/attachment.html>
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/.
you might want to move the executefile method var url = "http://www.google.com.com"; var engine = IronRuby.Ruby.CreateEngine(); 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"); engine.ExecuteFile("../../screenscraper.rb"); var screenScraper = engine.Operations.CreateInstance(obj); var html = engine.Operations.InvokeMember(screenScraper, "scrape", url); Console.WriteLine(html); --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero - Mob: +32.486.787.582 Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Mon, Mar 1, 2010 at 3:25 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> 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/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100301/d3e6d76c/attachment.html>
Here is my implementation: static void Main(string[] args) { var url = "http://www.google.com"; var engine = IronRuby.Ruby.CreateEngine(); 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); engine.ExecuteFile("../../screenscraper.rb"); var obj = engine.Runtime.Globals.GetVariable("ScreenScraper"); var screenScraper = engine.Operations.CreateInstance(obj); var html = engine.Operations.InvokeMember(screenScraper, "scrape", url); Console.WriteLine(html); } And now it throws the following error: Unhandled Exception: IronRuby.Builtins.LoadError: no such file to load -- string io 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 25 Press any key to continue . . . Ivan Porto Carrero wrote:> you might want to move the executefile method > > var url = "http://www.google.com.com"; > > var engine = IronRuby.Ruby.CreateEngine(); > > > 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"); > engine.ExecuteFile("../../screenscraper.rb"); > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero - Mob: +32.486.787.582 > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP-- Posted via http://www.ruby-forum.com/.
here''s an idea maybe buy my book. All this is explained in there replace: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib"); with: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ironruby"); That''s the location that contains stringio.rb. It was like this when I sent the email earlier: <set language=''Ruby'' option=''LibraryPaths'' value=''*C:\ironruby\lib\IronRuby* ;C:\ironruby\lib\ruby\site_ruby\1.8;C:\ironruby\lib\ruby\site_ruby;C:\ironruby\lib\ruby\1.8''/> --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Mon, Mar 1, 2010 at 4:21 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> Here is my implementation: > > static void Main(string[] args) > { > var url = "http://www.google.com"; > > var engine = IronRuby.Ruby.CreateEngine(); > > 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); > > engine.ExecuteFile("../../screenscraper.rb"); > var obj > engine.Runtime.Globals.GetVariable("ScreenScraper"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > > } > > > And now it throws the following error: > > > Unhandled Exception: IronRuby.Builtins.LoadError: no such file to load > -- string > io > 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 25 > Press any key to continue . . . > > > > > > Ivan Porto Carrero wrote: > > you might want to move the executefile method > > > > var url = "http://www.google.com.com"; > > > > var engine = IronRuby.Ruby.CreateEngine(); > > > > > > 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"); > > engine.ExecuteFile("../../screenscraper.rb"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > > > var html = engine.Operations.InvokeMember(screenScraper, > > "scrape", url); > > > > Console.WriteLine(html); > > --- > > Met vriendelijke groeten - Best regards - Salutations > > Ivan Porto Carrero - Mob: +32.486.787.582 > > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > > Twitter: http://twitter.com/casualjim > > Author of IronRuby in Action (http://manning.com/carrero) > > Microsoft IronRuby/C# MVP > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100301/d1c2d128/attachment-0001.html>
You need to include the rest of the ironruby search paths. For example. "C:\devtools\ironruby-1.0-rc1\lib\ironruby" Also, the ir.exe.config from c:\devtools\ironruby-1.0-rc1\bin should be setup exactly like you want. If you provide that to your app it should just work. That''s why we install that config file. JD -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam Sent: Monday, March 01, 2010 7:22 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Open-Uri Path in App.Config Here is my implementation: static void Main(string[] args) { var url = "http://www.google.com"; var engine = IronRuby.Ruby.CreateEngine(); 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); engine.ExecuteFile("../../screenscraper.rb"); var obj engine.Runtime.Globals.GetVariable("ScreenScraper"); var screenScraper = engine.Operations.CreateInstance(obj); var html = engine.Operations.InvokeMember(screenScraper, "scrape", url); Console.WriteLine(html); } And now it throws the following error: Unhandled Exception: IronRuby.Builtins.LoadError: no such file to load -- string io 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 25 Press any key to continue . . . Ivan Porto Carrero wrote:> you might want to move the executefile method > > var url = "http://www.google.com.com"; > > var engine = IronRuby.Ruby.CreateEngine(); > > > 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"); > engine.ExecuteFile("../../screenscraper.rb"); > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > --- > Met vriendelijke groeten - Best regards - Salutations Ivan Porto > Carrero - Mob: +32.486.787.582 > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) Microsoft > IronRuby/C# MVP-- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
I copied the ironruby config file into my application''s config file and removed all the path variables from my application but it did not work. Then I added the "C:\devtools\ironruby-1.0-rc1\lib\ironruby" path and removed the app.config and then it worked out. Any ideas that why even copy pasting the app.config from ironruby to my application app.config did not work? Jim Deville wrote:> You need to include the rest of the ironruby search paths. For example. > "C:\devtools\ironruby-1.0-rc1\lib\ironruby" > > Also, the ir.exe.config from c:\devtools\ironruby-1.0-rc1\bin should be > setup exactly like you want. If you provide that to your app it should > just work. That''s why we install that config file. > > JD-- Posted via http://www.ruby-forum.com/.
I will definitely buy your book when IronRuby is publicly released! I don''t want to consult the book and find out that opps that has now changed in the final release. Ivan Porto Carrero wrote:> here''s an idea maybe buy my book. All this is explained in there > > replace: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib"); > with: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ironruby"); > > That''s the location that contains stringio.rb. > > It was like this when I sent the email earlier: <set language=''Ruby'' > option=''LibraryPaths'' value=''*C:\ironruby\lib\IronRuby* > ;C:\ironruby\lib\ruby\site_ruby\1.8;C:\ironruby\lib\ruby\site_ruby;C:\ironruby\lib\ruby\1.8''/> > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP-- Posted via http://www.ruby-forum.com/.
a)IronRuby is in the home stretch. b)Ivan''s book is keeping up with the development, and if you buy the Manning EAP beta, you will get the updates and have the option to get the final copy. JD -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam Sent: Monday, March 01, 2010 7:54 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Open-Uri Path in App.Config I will definitely buy your book when IronRuby is publicly released! I don''t want to consult the book and find out that opps that has now changed in the final release. Ivan Porto Carrero wrote:> here''s an idea maybe buy my book. All this is explained in there > > replace: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib"); > with: paths.Add(@"C:\DevTools\ironruby-1.0-rc1\lib\ironruby"); > > That''s the location that contains stringio.rb. > > It was like this when I sent the email earlier: <set language=''Ruby'' > option=''LibraryPaths'' value=''*C:\ironruby\lib\IronRuby* > ;C:\ironruby\lib\ruby\site_ruby\1.8;C:\ironruby\lib\ruby\site_ruby;C:\ > ironruby\lib\ruby\1.8''/> > > --- > Met vriendelijke groeten - Best regards - Salutations Ivan Porto > Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) Microsoft > IronRuby/C# MVP-- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Probably because your app config is in a different location than ir.exe. Try this. Replace: static void Main(string[] args) { var url = "http://www.google.com"; var engine = IronRuby.Ruby.CreateEngine(); 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); engine.ExecuteFile("../../screenscraper.rb"); var obj engine.Runtime.Globals.GetVariable("ScreenScraper"); var screenScraper = engine.Operations.CreateInstance(obj); var html = engine.Operations.InvokeMember(screenScraper, "scrape", url); Console.WriteLine(html); } With: static void Main(string[] args) { var url = "http://www.google.com"; var setup = ScriptRuntimeSetup.ReadConfiguration(); var scriptRuntime = Ruby.CreateRuntime(setup); var engine = Ruby.GetEngine(Runtime); //the following line might not be needed in this case var context = Ruby.GetExecutionContext(Engine); engine.ExecuteFile("../../screenscraper.rb"); var obj engine.Runtime.Globals.GetVariable("ScreenScraper"); var screenScraper = engine.Operations.CreateInstance(obj); var html = engine.Operations.InvokeMember(screenScraper, "scrape", url); Console.WriteLine(html); } -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam Sent: Monday, March 01, 2010 7:52 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Open-Uri Path in App.Config I copied the ironruby config file into my application''s config file and removed all the path variables from my application but it did not work. Then I added the "C:\devtools\ironruby-1.0-rc1\lib\ironruby" path and removed the app.config and then it worked out. Any ideas that why even copy pasting the app.config from ironruby to my application app.config did not work? Jim Deville wrote:> You need to include the rest of the ironruby search paths. For example. > "C:\devtools\ironruby-1.0-rc1\lib\ironruby" > > Also, the ir.exe.config from c:\devtools\ironruby-1.0-rc1\bin should be > setup exactly like you want. If you provide that to your app it should > just work. That''s why we install that config file. > > JD-- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Hi,>> Probably because your app config is in a different location than ir.exe.Do you mean the ironruby app config or my application app config? My application config is in my application directory. The question is that why it is not reading my application config automatically. Thanks, Azam Jim Deville wrote:> Probably because your app config is in a different location than ir.exe. > > Try this. Replace: > > static void Main(string[] args) > { > var url = "http://www.google.com"; > > var engine = IronRuby.Ruby.CreateEngine(); > > 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); > > engine.ExecuteFile("../../screenscraper.rb"); > var obj > engine.Runtime.Globals.GetVariable("ScreenScraper"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > > } > With: > > static void Main(string[] args) > { > var url = "http://www.google.com"; > var setup = ScriptRuntimeSetup.ReadConfiguration(); > var scriptRuntime = Ruby.CreateRuntime(setup); > var engine = Ruby.GetEngine(Runtime); > //the following line might not be needed in this case > var context = Ruby.GetExecutionContext(Engine); > > engine.ExecuteFile("../../screenscraper.rb"); > var obj > engine.Runtime.Globals.GetVariable("ScreenScraper"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > > }-- Posted via http://www.ruby-forum.com/.
Is app.config in the same directory as c:\path\to\ir.exe? I''m guessing no. I''m NOT saying it should be. I''m saying use the other hosting method I told you to. I believe that will use IronRuby''s exe.config for IronRuby. If you don''t want to use my suggestion, then you need to modify the relative paths in your app.config to point to the right location. JD -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mohammad Azam Sent: Monday, March 01, 2010 8:38 AM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Open-Uri Path in App.Config Hi,>> Probably because your app config is in a different location than ir.exe.Do you mean the ironruby app config or my application app config? My application config is in my application directory. The question is that why it is not reading my application config automatically. Thanks, Azam Jim Deville wrote:> Probably because your app config is in a different location than ir.exe. > > Try this. Replace: > > static void Main(string[] args) > { > var url = "http://www.google.com"; > > var engine = IronRuby.Ruby.CreateEngine(); > > 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); > > engine.ExecuteFile("../../screenscraper.rb"); > var obj > engine.Runtime.Globals.GetVariable("ScreenScraper"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > > } > With: > > static void Main(string[] args) > { > var url = "http://www.google.com"; > var setup = ScriptRuntimeSetup.ReadConfiguration(); > var scriptRuntime = Ruby.CreateRuntime(setup); > var engine = Ruby.GetEngine(Runtime); > //the following line might not be needed in this case > var context = Ruby.GetExecutionContext(Engine); > > engine.ExecuteFile("../../screenscraper.rb"); > var obj > engine.Runtime.Globals.GetVariable("ScreenScraper"); > > var screenScraper = engine.Operations.CreateInstance(obj); > > var html = engine.Operations.InvokeMember(screenScraper, > "scrape", url); > > Console.WriteLine(html); > > }-- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
I used the above code that you provided but it is throwing exceptions: static void Main(string[] args) { var setup = ScriptRuntimeSetup.ReadConfiguration(); var runtime = Ruby.CreateRuntime(setup); // error is thrown here var engine = Ruby.GetEngine(runtime); And the exception is: Unhandled Exception: System.ArgumentException: Invalid argument value Parameter name: ScriptRuntimeSetup must have at least one LanguageSetup at Microsoft.Scripting.Hosting.ScriptRuntimeSetup.ToConfiguration() at Microsoft.Scripting.Hosting.ScriptRuntime..ctor(ScriptRuntimeSetup setup) at IronRuby.Ruby.CreateRuntime(ScriptRuntimeSetup setup) at IronRubyConsoleApp.Program.Main(String[] args) in C:\Projects\ILoveIronRub y\ILoveIronRuby\IronRubyConsoleApp\Program.cs:line 16 Press any key to continue . . . Jim Deville wrote:> Is app.config in the same directory as c:\path\to\ir.exe? I''m guessing > no. I''m NOT saying it should be. I''m saying use the other hosting method > I told you to. I believe that will use IronRuby''s exe.config for > IronRuby. If you don''t want to use my suggestion, then you need to > modify the relative paths in your app.config to point to the right > location. > > JD-- Posted via http://www.ruby-forum.com/.
My fault I did not include the App.config settings. So, now I have copied everything from ir.exe.config into my App.config and I run the application and 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 30 Press any key to continue . . . Mohammad Azam wrote:> I used the above code that you provided but it is throwing exceptions: > > static void Main(string[] args) > { > var setup = ScriptRuntimeSetup.ReadConfiguration(); > > var runtime = Ruby.CreateRuntime(setup); // error is thrown > here > var engine = Ruby.GetEngine(runtime); > > And the exception is: > > > Unhandled Exception: System.ArgumentException: Invalid argument value > Parameter name: ScriptRuntimeSetup must have at least one LanguageSetup > at Microsoft.Scripting.Hosting.ScriptRuntimeSetup.ToConfiguration() > at Microsoft.Scripting.Hosting.ScriptRuntime..ctor(ScriptRuntimeSetup > setup) > at IronRuby.Ruby.CreateRuntime(ScriptRuntimeSetup setup) > at IronRubyConsoleApp.Program.Main(String[] args) in > C:\Projects\ILoveIronRub > y\ILoveIronRuby\IronRubyConsoleApp\Program.cs:line 16 > Press any key to continue . . . > > > Jim Deville wrote: >> Is app.config in the same directory as c:\path\to\ir.exe? I''m guessing >> no. I''m NOT saying it should be. I''m saying use the other hosting method >> I told you to. I believe that will use IronRuby''s exe.config for >> IronRuby. If you don''t want to use my suggestion, then you need to >> modify the relative paths in your app.config to point to the right >> location. >> >> JD-- Posted via http://www.ruby-forum.com/.
Did you change the paths in the app.config file to be absolute? --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Web: http://whiterabbitconsulting.eu - http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) Microsoft IronRuby/C# MVP On Mon, Mar 1, 2010 at 8:04 PM, Mohammad Azam <lists at ruby-forum.com> wrote:> My fault I did not include the App.config settings. So, now I have > copied everything from ir.exe.config into my App.config and I run the > application and 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 30 > Press any key to continue . . . > > > > Mohammad Azam wrote: > > I used the above code that you provided but it is throwing exceptions: > > > > static void Main(string[] args) > > { > > var setup = ScriptRuntimeSetup.ReadConfiguration(); > > > > var runtime = Ruby.CreateRuntime(setup); // error is thrown > > here > > var engine = Ruby.GetEngine(runtime); > > > > And the exception is: > > > > > > Unhandled Exception: System.ArgumentException: Invalid argument value > > Parameter name: ScriptRuntimeSetup must have at least one LanguageSetup > > at Microsoft.Scripting.Hosting.ScriptRuntimeSetup.ToConfiguration() > > at Microsoft.Scripting.Hosting.ScriptRuntime..ctor(ScriptRuntimeSetup > > setup) > > at IronRuby.Ruby.CreateRuntime(ScriptRuntimeSetup setup) > > at IronRubyConsoleApp.Program.Main(String[] args) in > > C:\Projects\ILoveIronRub > > y\ILoveIronRuby\IronRubyConsoleApp\Program.cs:line 16 > > Press any key to continue . . . > > > > > > Jim Deville wrote: > >> Is app.config in the same directory as c:\path\to\ir.exe? I''m guessing > >> no. I''m NOT saying it should be. I''m saying use the other hosting method > >> I told you to. I believe that will use IronRuby''s exe.config for > >> IronRuby. If you don''t want to use my suggestion, then you need to > >> modify the relative paths in your app.config to point to the right > >> location. > >> > >> JD > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100301/e3046a46/attachment.html>
Ahh I did not do that!! I think I will just use path collection and List<String> this is just too much work. Ivan Porto Carrero wrote:> Did you change the paths in the app.config file to be absolute? > > --- > Met vriendelijke groeten - Best regards - Salutations > Ivan Porto Carrero > Web: http://whiterabbitconsulting.eu - http://flanders.co.nz > Twitter: http://twitter.com/casualjim > Author of IronRuby in Action (http://manning.com/carrero) > Microsoft IronRuby/C# MVP-- Posted via http://www.ruby-forum.com/.