[Ironruby-core] Where is open-uri and why it does not work?

Jim Deville jdeville at microsoft.com
Mon Jun 22 11:30:52 EDT 2009


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
>>> exit


Thanks,

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



More information about the Ironruby-core mailing list