Unexpected kRESCUE, expecting kEND

Rather a newbie to Ruby code, so hopefully this error should be easy
to spot…can anyone please tell me why I’m getting ‘syntax error,
unexpected kRESCUE, expecting kEND’ with the line that says ‘rescue
Exception’ in the code section below?

Much appreciate any help…
Thx,
mr noob

begin
row_count = 0
FasterCSV.foreach([:csv_import][:file], :headers => :first_row)
do |row|

    @gr =

Genotype_runs.create(:genotype_date_1=>row[4],:genotype_date_2=>row[5],:genotype_date_3=>row[6])
# use the id of the Genotype_runs record to link to
Genotype_data rec.

Genotype_data.create(:genotype_run_id=>:gr.id, :box=>row[0],
:subjectid=>row[1], :labid=>row[2], :well=>row[4],
:created_at=>Time.now,:updated_at=>Time.now)
# print message showing import
$stderr.print “\r%5d …” % csv.lineno
$stderr.flush
row_count++

  end

  flash[:notice] = "Successfully imported #{row_count} rows from

file."
redirect_to :action => :index

rescue Exception

  # If an exception is thrown, the transaction rolls back and we

end up in this rescue block
error = ERB::Util.h(exception.to_s) # get the error and HTML
escape it
flash[:error] = “Error adding logs. (some #{error}). Please
try again.”
redirect_to :action => :index

end

On Jan 25, 11:03pm, rixter [email protected] wrote:

Rather a newbie to Ruby code, so hopefully this error should be easy
to spot…can anyone please tell me why I’m getting ‘syntax error,
unexpected kRESCUE, expecting kEND’ with the line that says ‘rescue
Exception’ in the code section below?

ruby doesn’t have a ++ operator, and so gets very confused trying to
parse the bit where you increment row_count (I suspect that :gr.id is
a typo, although it’s not syntactically incorrect)

Fred