K
Kurt Euler
Hi all.
Could someone please help me diagnose what might be wrong with this code snippet (taken from within a program) that cropped up after I upgraded from Ruby 1.68 to 1.8. The problem is that the Ruby crashes with this message:
autogen.rb:301:in `initialize': Permission denied - ./boiler_install_notes/ (Errno::EACCES)
from autogen.rb:301:in `open'
from autogen.rb:301
from autogen.rb:92:in `foreach'
from autogen.rb:92
What's weird is that the crash happens when field[5] should be nil -- the entire if/end should be skipped. (If I insert a line # 297 puts field[5], console just shows does a line space as all puts do. No space or tab appears there.)
298 if field[5] != ""
299 if FileTest.exist?("./boiler_install_notes/#{field[5]}" )
300 install_note = ""
301 File.open("./boiler_install_notes/#{field[5]}") { |f| install_note = f.read.strip }
302 content2.gsub!(/<start_note_2>/, install_note)
303 puts "start_note_2: #{field[5]} added."
304 outf.puts "start_note_2: #{field[5]} added."
305 else
306 # Warn if note file specified in field[5] doesn't exist.
307 puts "start_note_2: #{field[5]} doesn't exist"
308 outf.puts "start_note_2: #{field[5]} doesn't exist"
309 end
310 end
Thanks!
Kurt Euler
Could someone please help me diagnose what might be wrong with this code snippet (taken from within a program) that cropped up after I upgraded from Ruby 1.68 to 1.8. The problem is that the Ruby crashes with this message:
autogen.rb:301:in `initialize': Permission denied - ./boiler_install_notes/ (Errno::EACCES)
from autogen.rb:301:in `open'
from autogen.rb:301
from autogen.rb:92:in `foreach'
from autogen.rb:92
Exit code: 1
What's weird is that the crash happens when field[5] should be nil -- the entire if/end should be skipped. (If I insert a line # 297 puts field[5], console just shows does a line space as all puts do. No space or tab appears there.)
298 if field[5] != ""
299 if FileTest.exist?("./boiler_install_notes/#{field[5]}" )
300 install_note = ""
301 File.open("./boiler_install_notes/#{field[5]}") { |f| install_note = f.read.strip }
302 content2.gsub!(/<start_note_2>/, install_note)
303 puts "start_note_2: #{field[5]} added."
304 outf.puts "start_note_2: #{field[5]} added."
305 else
306 # Warn if note file specified in field[5] doesn't exist.
307 puts "start_note_2: #{field[5]} doesn't exist"
308 outf.puts "start_note_2: #{field[5]} doesn't exist"
309 end
310 end
Thanks!
Kurt Euler