Mohammad Azam
2009-Jun-22 14:51 UTC
[Ironruby-core] Where is open-uri and why it does not work?
I have been trying this for weeks now and still no answer. The open-uri is messed up in IronRuby. Why does it always keep opening a file and not the URL? -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 14:53 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Here is the error messages: C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\r uby\1.8>ir IronRuby 0.5.0.0 on .NET 2.0.50727.3053 Copyright (c) Microsoft Corporation. All rights reserved.>>> require ''open-uri'':0:in `require'': no such file to load -- stringio (LoadError) from ./open-uri.rb:2 from :0 from :0:in `require'' -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 14:57 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Why stringio is not present in the same folder as ''open-uri''? -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 15:15 UTC
[Ironruby-core] Where is open-uri and why it does not work?
StringIO is written in C#, so it is part of IronRuby.Libraries.dll. This is because Ruby''s StringIO has C extensions. JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 7:58 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > Why stringio is not present in the same folder as ''open-uri''? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 15:18 UTC
[Ironruby-core] Where is open-uri and why it does not work?
What????? I am talking about ''open-uri'' and when I run this: ir myapp.rb It throws the exception that it is missing uri and stringio. Why all the libraries are not put in the same folder why are they distributed in many different folders? And there is a file called ''stringio.rb'' Jim Deville wrote:> StringIO is written in C#, so it is part of IronRuby.Libraries.dll. This > is because Ruby''s StringIO has C extensions. > > JD > > ...there is no try-- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 15:23 UTC
[Ironruby-core] Where is open-uri and why it does not work?
The libraries required by open-uri to function properly are spread up in two different folders: paths.Add(@"C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs"); paths.Add(@"C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\1.8"); WHY? -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 15:30 UTC
[Ironruby-core] Where is open-uri and why it does not work?
The file stringio.rb (the correct one) has the following in it: # **************************************************************************** # # Copyright (c) Microsoft Corporation. # # This source code is subject to terms and conditions of the Microsoft Public License. A # copy of the license can be found in the License.html file at the root of this distribution. If # you cannot locate the Microsoft Public License, please send an email to # ironruby at microsoft.com. By using this source code in any fashion, you are agreeing to be bound # by the terms of the Microsoft Public License. # # You must not remove this notice, or any other, from this software. # # # **************************************************************************** load_assembly ''IronRuby.Libraries'', ''IronRuby.StandardLibrary.StringIO'' There are two library paths in IronRuby. One is the redistribution of most of the Ruby Standard library. This is the C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\1.8 folder. The other is IronRuby specific files to load C-based standard libraries (such as stringio.rb) and stub files to make .NET specific assemblies easier to load (such as System.Windows.Forms.rb). For me, the following works from the IronRuby console. Can you send me the output of it when you try to run it from ir.exe? C:\vsl\m1\Merlin\Main\Bin\Debug [26] > ir.exe IronRuby 0.5.0.0 on .NET 2.0.50727.4908 Copyright (c) Microsoft Corporation. All rights reserved.>>> puts $:c:/vsl/m1/Merlin/Main/Languages/Ruby/libs/ c:/vsl/m1/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/site_ruby/1.8/ c:/vsl/m1/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/ . => nil>>> require ''open-uri''=> true>>> u = open("http://www.google.com")=> #<StringIO:0x00000a6 @base_uri=#<URI::HTTP:0x0000096 URL:http://www.google.com>, @meta={"proxy-connection"=>"Keep-Ali ve", "connection"=>"Keep-Alive", "transfer-encoding"=>"chunked", "via"=>"1.1 RED-PRXY-27", "expires"=>"-1", "date"=>"Mon , 22 Jun 2009 15:30:20 GMT", "content-type"=>"text/html; charset=ISO-8859-1", "server"=>"gws", "cache-control"=>"private , max-age=0", "set-cookie"=>"PREF=ID=eb7ab68a47c1cfc2:TM=1245684620:LM=1245684620:S=NVRnVXhGZ3bM1DuD; expires=Wed, 22-Ju n-2011 15:30:20 GMT; path=/; domain=.google.com"}, @status=["200", "OK"]>>>> puts u#<StringIO:0x00000a6> => nil>>> u.close=> nil>>> exitThanks, JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 8:24 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > The libraries required by open-uri to function properly are spread up in two > different folders: > > paths.Add(@"C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs"); > > paths.Add(@"C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Langu > ages\Ruby\redist-libs\ruby\1.8"); > > > WHY? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 15:37 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Thanks for the detailed explanation! The steps that you have provided worked! But the main question is that if I am using my project from a different directory like C:\RubyProject\ and I am also running IR.exe from C:\RubyProject then how will it find open-uri. It always says ''not able to locate open-uri'' file. If I manually add ''open-uri'' to c:\rubyproject\libs then it complains not able to find ''uri'' -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 15:48 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Does it work if you copy open-uri.rb, uri.rb and the uri directory to C:\rubyproject\libs? JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 8:37 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > Thanks for the detailed explanation! > > The steps that you have provided worked! > > But the main question is that if I am using my project from a different > directory like C:\RubyProject\ and I am also running IR.exe from > C:\RubyProject then how will it find open-uri. > > It always says ''not able to locate open-uri'' file. If I manually add ''open-uri'' to > c:\rubyproject\libs then it complains not able to find ''uri'' > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 15:53 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Nope it does not work: Here is the code: require ''libs/System.Windows.Forms'' require ''libs/System.Drawing'' require ''libs/open-uri'' The libs folder contains uri.rb which is taken from C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p287\lib\ruby\1.8 folder. And here is the error: C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb :0:in `require'': no such file to load -- uri (LoadError) from ./libs/open-uri.rb:1 from rss_reader_form.rb:3 from :0:in `require'' -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 15:57 UTC
[Ironruby-core] Where is open-uri and why it does not work?
What does puts $: output in that situation? I''m wondering why you have "require ''libs/open-uri''" instead of "require ''open-uri''" JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 8:53 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > Nope it does not work: > > Here is the code: > > require ''libs/System.Windows.Forms'' > require ''libs/System.Drawing'' > require ''libs/open-uri'' > > The libs folder contains uri.rb which is taken from > > C:\ironruby\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ru > by-1.8.6p287\lib\ruby\1.8 > > folder. > > And here is the error: > > C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb :0:in > `require'': no such file to load -- uri (LoadError) > from ./libs/open-uri.rb:1 > from rss_reader_form.rb:3 > from :0:in `require'' > > > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 16:00 UTC
[Ironruby-core] Where is open-uri and why it does not work?
It is outputing the following:>>> puts $:C:/WINDOWS/system32 -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 16:04 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Is this one of our releases? Or is it a build from the git sources? In both cases you should have an ir.exe.config that sets both the libs folder and the redist-libs folder into your load path. Any idea why yours doesn''t? JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 9:00 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > It is outputing the following: > > > >>> puts $: > C:/WINDOWS/system32 > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 16:09 UTC
[Ironruby-core] Where is open-uri and why it does not work?
This is downloaded from Git! I have the ir.exe.config file with the following path setup: <options> <set language="Ruby" option="LibraryPaths" value="..\..\Languages\Ruby\libs\;..\..\..\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\site_ruby\1.8\;..\..\..\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\1.8\" /> </options> The location of this file is: C:\ironruby\ironruby\Merlin\Main\bin\Debug My project location is C:\IronRubyProjects\IronRubyTaskListApplication. I am running the IR.EXX from C:\IronRubyProjects\IronRubyTaskListApplication and then it complains about the open-uri file. I put the open-uri file in the libs folder then is complains about uri file. I put the uri file and uri folder in the libs folder but it still complains about the uri file. -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 16:10 UTC
[Ironruby-core] Where is open-uri and why it does not work?
I have even tried running ir.exe from my projects folder: C:\IronRubyProjects\IronRubyTaskListApplication>ir IronRuby 0.5.0.0 on .NET 2.0.50727.3053 Copyright (c) Microsoft Corporation. All rights reserved.>>> require ''open-uri'':0:in `require'': no such file to load -- open-uri (LoadError) from :0 -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 16:13 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Can you run c:\ironruby\ironruby\Merlin\Main\bin\debug\ir.exe C:\IronRubyProjects\IronRubyTasksApplication\foo.rb (where foo is the startup file for your program)? JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 9:10 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > This is downloaded from Git! > > I have the ir.exe.config file with the following path setup: > > <options> > <set language="Ruby" option="LibraryPaths" > value="..\..\Languages\Ruby\libs\;..\..\..\External.LCA_RESTRICTED\Languag > es\Ruby\redist- > libs\ruby\site_ruby\1.8\;..\..\..\External.LCA_RESTRICTED\Languages\Ruby\r > edist-libs\ruby\1.8\" > /> > </options> > > The location of this file is: > > C:\ironruby\ironruby\Merlin\Main\bin\Debug > > My project location is C:\IronRubyProjects\IronRubyTaskListApplication. > > I am running the IR.EXX from > C:\IronRubyProjects\IronRubyTaskListApplication and then it complains > about the open-uri file. I put the open-uri file in the libs folder then is > complains about uri file. I put the uri file and uri folder in the libs folder but it > still complains about the uri file. > > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 16:16 UTC
[Ironruby-core] Where is open-uri and why it does not work?
I should also mention one thing which is that I placed my ir.exe and some other files that are required by ir.exe in System32 folder so that I can access it from anywhere in the directory. -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 16:18 UTC
[Ironruby-core] Where is open-uri and why it does not work?
A better way to do that, in this case, is to just add c:\ironruby\ironruby\Merlin\Main\bin\debug to your %PATH% JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 9:16 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > I should also mention one thing which is that I placed my ir.exe and some > other files that are required by ir.exe in System32 folder so that I can access it > from anywhere in the directory. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 16:18 UTC
[Ironruby-core] Where is open-uri and why it does not work?
No I cannot run it because it require Windows.Forms and Windows.Drawing modules. If I add those modules then it will work: C:\ironruby\ironruby\Merlin\Main\bin\Debug>ir.exe C:\IronRubyProjects\IronRubyTa skListApplication\main_form.rb C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtin s\KernelOps.cs:423:in `require'': no such file to load -- libs/System.Windows.For ms (LoadError) from C:/IronRubyProjects/IronRubyTaskListApplication/main_form.rb:2 -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 16:21 UTC
[Ironruby-core] Where is open-uri and why it does not work?
How do I do that? -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 16:21 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Should I also remove ir.exe from System32? -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 16:26 UTC
[Ironruby-core] Where is open-uri and why it does not work?
I have added the path to System Variables. The name of RUBYLIBS and the value is c:\ironruby\ironruby\Merlin\Main\bin\debug. Here is the code: require ''libs/System.Windows.Forms'' require ''libs/System.Drawing'' require ''open-uri'' And still giving the same issues: C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb :0:in `require'': no such file to load -- open-uri (LoadError) from rss_reader_form.rb:3 -- Posted via http://www.ruby-forum.com/.
Mohammad Azam
2009-Jun-22 16:31 UTC
[Ironruby-core] Where is open-uri and why it does not work?
I have set up the PATH variable in System Variables to C:\ironruby\ironruby\Merlin\Main\bin\Debug But now windows command prompt is not picking up the ir.exe file! -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 16:33 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Remove the RUBYLIBS variable, and then change require ''libs/System.Windows.Forms'' to require ''System.Windows.Form''. Do the same for System.Drawing, then let me know how it goes. You shouldn''t need to set any Ruby environment variables, since ir.exe.config should set everything up for you right now. JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 9:27 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > I have added the path to System Variables. The name of RUBYLIBS and the > value is c:\ironruby\ironruby\Merlin\Main\bin\debug. > > Here is the code: > > require ''libs/System.Windows.Forms'' > require ''libs/System.Drawing'' > require ''open-uri'' > > And still giving the same issues: > > > > C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb > > C:\IronRubyProjects\IronRubyTaskListApplication>ir rss_reader_form.rb :0:in > `require'': no such file to load -- open-uri (LoadError) > from rss_reader_form.rb:3 > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core
Mohammad Azam
2009-Jun-22 16:34 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Finally I got it! I closed the command prompt and ran it again and now everything is working. Even the open-uri started working. Thanks for all your help! The PATH was a good solution to go :) -- Posted via http://www.ruby-forum.com/.
Jim Deville
2009-Jun-22 16:38 UTC
[Ironruby-core] Where is open-uri and why it does not work?
Glad that it worked :) JD ...there is no try> -----Original Message----- > From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core- > bounces at rubyforge.org] On Behalf Of Mohammad Azam > Sent: Monday, June 22, 2009 9:34 AM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Where is open-uri and why it does not work? > > Finally I got it! > > I closed the command prompt and ran it again and now everything is > working. Even the open-uri started working. > > Thanks for all your help! > > The PATH was a good solution to go :) > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core