# FXRuby & erb -- problems together?

**URL:** <https://www.ruby-forum.com/t/fxruby-erb-problems-together/160935>\
**Category:** Ruby\
**Created:** [February 21, 2009, 3:21am UTC](https://www.ruby-forum.com/t/fxruby-erb-problems-together/160935 "2009-02-21T03:21:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![drlelon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee59a6/32.png) [@drlelon](https://www.ruby-forum.com/u/drlelon)\
**Post date:** [February 21, 2009, 3:21am UTC](https://www.ruby-forum.com/t/fxruby-erb-problems-together/160935/1 "2009-02-21T03:21:18Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![drlelon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee59a6/32.png) [@drlelon](https://www.ruby-forum.com/u/drlelon)\
**Post date:** [February 21, 2009, 7:47pm UTC](https://www.ruby-forum.com/t/fxruby-erb-problems-together/160935/2 "2009-02-21T19:47:49Z")

</div>

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
