|
[ruby-list:42400] open-uriに対してfile:を与えるとEINVALなどになる: msg#00054lang.ruby.japanese
artonです。 ruby -v ruby 1.8.4 (2005-12-24) [i386-mswin32] で、 require 'open-uri' open(ARGV[0]) {|f| f.each_line {|line| p line} } というスクリプト(以下ではou.rb)に対してfile:を与えると ruby ou.rb file:///c:/windows/desktop.ini c:/progra~1/ruby-1.8/lib/ruby/1.8/open-uri.rb:88:in `initialize': Invalid argument - file:///c:/windows/desktop.ini (Errno::EINVAL) from c:/progra~1/ruby-1.8/lib/ruby/1.8/open-uri.rb:88:in `open' from ou.rb:2 となります。 Firefoxで試すと、パスセパレータに/ではなく\を与えても表示できるため、 Windowsなので\を与える必要があるのかと、以下のように実行すると ruby ou.rb file:///c:\windows\desktop.ini c:/progra~1/ruby-1.8/lib/ruby/1.8/uri/common.rb:432:in `split': bad URI(is not URI?): file:///c:\windows\desktop.ini (URI::InvalidURIError) from c:/progra~1/ruby-1.8/lib/ruby/1.8/uri/common.rb:481:in `parse' from c:/progra~1/ruby-1.8/lib/ruby/1.8/open-uri.rb:85:in `open' from ou.rb:2 今度は、URIでエラーになります。 ブラウザー(Firefox 1.5.0.4およびIE6SP2で動作を確認。ただしIEの場合はini のヘルパアプリケーションのメモ帳が起動)と同様にfile:についても動作して 欲しいです。 -- arton <artonx-/E1597aS9LR3+QwDJ9on6Q@xxxxxxxxxxxxxxxx> -------------------------------------- Let's start Yahoo! Auction - Free Campaign Now! http://pr.mail.yahoo.co.jp/auction/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ruby-list:42399] Re: ruby -Ks -rjcode -e"p('|%5.5s|'%'泣き別れ')" #=> "|泣き怖", take_tk |
|---|---|
| Next by Date: | [ruby-list:42401] Re: コミュニティと宗教の分離について, Beyond |
| Previous by Thread: | [ruby-list:42394] eachはなぜ元々のオブジェクトが返るのか?, Fujioka |
| Next by Thread: | [ruby-list:42404] Re: open-uriに対してfile:を与えるとEINVALなどになる, Tanaka Akira |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |