[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

simple File.open error

Peter Bailey

4/12/2007 5:43:00 PM

Hello,
I'm going nuts with a simple error. All I want to do is open a file and
stick a number in it. The error is referring to this line below. In the
error, it's picking up all the variable names correctly.

...

File.open("E:/pagecounts/#{$budget}/tmports}/#{pstxtfile}", "w") { |f|
f.print "#{$pages.to_i}\n" }

...

I get this error:

C:/Users/pb4072.INTDOM/Documents/scripts/RUBY/tmports.rb:70:in
`initialize': No
such file or directory -
E:/pagecounts/budget4/tmports}/TMEGT_April_30_2007.pstxt (Errno::ENOENT)
from
C:/Users/pb4072.INTDOM/Documents/scripts/RUBY/tmports.rb:70:in `open'
from C:/Users/pb4072.INTDOM/Documents/scripts/RUBY/tmports.rb:70

Thanks,
Peter

--
Posted via http://www.ruby-....

2 Answers

Alex Young

4/12/2007 5:46:00 PM

0

Peter Bailey wrote:
> Hello,
> I'm going nuts with a simple error. All I want to do is open a file and
> stick a number in it. The error is referring to this line below. In the
> error, it's picking up all the variable names correctly.
>
> ...
>
> File.open("E:/pagecounts/#{$budget}/tmports}/#{pstxtfile}", "w") { |f|
> f.print "#{$pages.to_i}\n" }
>
> ...
>
> I get this error:
>
> C:/Users/pb4072.INTDOM/Documents/scripts/RUBY/tmports.rb:70:in
> `initialize': No
> such file or directory -
> E:/pagecounts/budget4/tmports}/TMEGT_April_30_2007.pstxt (Errno::ENOENT)
^
|
Is '}' a legal character in Windows paths?

--
Alex

Peter Bailey

4/12/2007 5:54:00 PM

0

Alex Young wrote:
> Peter Bailey wrote:
>> ...
>>
>> I get this error:
>>
>> C:/Users/pb4072.INTDOM/Documents/scripts/RUBY/tmports.rb:70:in
>> `initialize': No
>> such file or directory -
>> E:/pagecounts/budget4/tmports}/TMEGT_April_30_2007.pstxt (Errno::ENOENT)
> ^
> |
> Is '}' a legal character in Windows paths?

That's my problem. No, it isn't. It's just a typo there. Thanks for the
quick response, Alex!

--
Posted via http://www.ruby-....