# Uri to absolute/relative path

**URL:** <https://www.ruby-forum.com/t/uri-to-absolute-relative-path/72806>\
**Category:** Ruby\
**Created:** [October 19, 2006, 1:50am UTC](https://www.ruby-forum.com/t/uri-to-absolute-relative-path/72806 "2006-10-19T01:50:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apparna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@apparna](https://www.ruby-forum.com/u/apparna)\
**Post date:** [October 19, 2006, 1:50am UTC](https://www.ruby-forum.com/t/uri-to-absolute-relative-path/72806/1 "2006-10-19T01:50:39Z")

</div>

Hello, I’m new to ruby but so far my experience with Ruby has been  
great. I’m unable to open an uri based on the file path.

This works  
require ‘open-uri’  
open(“[http://www.ruby-lang.org/](http://www.ruby-lang.org/)”) {|f|  
f.each\_line {|line| p line}  
}

but this doesn’t

require ‘open-uri’  
open(“file:c://test/test.txt”) {|f|  
f.each\_line {|line| p line}  
}

Can Ruby uri class open up a file schema?

Thanks,  
apparna

---

<div class="post-metadata">

**Author:** ![apparna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@apparna](https://www.ruby-forum.com/u/apparna)\
**Post date:** [October 19, 2006, 9:06am UTC](https://www.ruby-forum.com/t/uri-to-absolute-relative-path/72806/2 "2006-10-19T09:06:10Z")

</div>

App Ra wrote:

> but this doesn’t
> 
> require ‘open-uri’  
> open(“file:c://test/test.txt”) {|f|  
> f.each\_line {|line| p line}  
> }
> 
> Can Ruby uri class open up a file schema?

Make a test without a drive letter. IOW try a simpler case first. Then,  
if  
this succeeds, try this syntax:

“file:///C:/test/test.txt”

URI paths involving drive letters must be handled very carefully. And  
IMHO,  
drive letters should be banished from the world of computing as soon as  
possible.
