I'm having vexing problems with some erb templates I use to generate html. The templates used to work just great in a gui-less program. But when I embedded the template generation code inside a FXRuby interface, it started giving random mysterious, intermittent errors during actual generation, the outf.write statement... template = ERB.new( IO.read( proto_company_index)) out_file = out_folder + @company + " indx.html" outf = File.new( out_file, "w") outf.write( template.result(binding)) I disabled the FXRuby interface entirely and drove it programmatically through exactly the same code, and it goes back to working fine. So, it's only circumstantial evidence, but it looks like erb and FXRuby are not getting along, generating random errors in erb. Anybody else run into this? Here are three (different) errors from three different runs of exactly the same code with FXruby going. So you see how random it is. (And these errors do not arise when FXRuby is out of the picture.) > Uncaught exception: compile error > (erb):19: syntax error, unexpected tSTRING_BEG, expecting $end > Uncaught exception: compile error > (erb):18: syntax error, unexpected tIDENTIFIER, expecting $end > Uncaught exception: compile error > (erb):18: Invalid char `\250' in expression > (erb):19: syntax error, unexpected tCONSTANT, expecting $end I'd show you the erb template, but trust me, there's nothing near those lines that could cause this. PS: Other than perhaps not working together, FXRuby and erb are each great on their own!
on 2009-02-21 03:21
on 2009-02-21 19:47
I switched to Erubis (in place of erb -- need to change only the class name and it works just fine.) So it looks like erb and FXRuby are indeed incompatible. --David