Simple File.open error

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-forum.com/.

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

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-forum.com/\.