File ended while scanning use of \@dtl@trim

I am trying to compile latex code that imports CSV into a longtable (ltxtable). The code has been compiled successfully in windows while it makes error in Mac OS X.

\documentclass{article}
\usepackage{datatool}
\usepackage{filecontents}
\usepackage{ltxtable}

\begin{document}

\DTLsort{abbr}{abbreviations}%

%% Write CSV into LaTex file (ltxtable)
\begin{filecontents}{abbreviations.tex}
\begin{longtable}{>{\bfseries}l X}
\DTLforeach{abbreviations}{%
\abbr=abbr,\desc=desc}{%
\\
\abbr& \desc%
}
\end{longtable}
\end{filecontents}

%% Include the LaTex file (ltxtable)
\LTXtable{\textwidth}{abbreviations.tex}

\end{document}


Error:

Runaway argument?
\@nil \let \@dtl@line =\@dtl@trmstr \ifx \@dtl@line \@longempty \else \ETC.
! File ended while scanning use of \@dtl@trim.


The CSV file has two columns like:

%% Abbreviations List
CRLB,"Cram\'{e}r-Rao Lower Bound"

-
It is possible that the two computers have different versions of datatool or some other relevant package. You can test this by putting \listfiles in the preamble and comparing the end of the .log for each computer (the command prints the versions of each loaded package). Barring that, unless you get lucky, someone is going to ask for a complete, but minimal example file that demonstrates the problem. Search for 'MWE' if you aren't sure what I'm referring to. –  jon Sep 26 '12 at 19:51
Thanks jon, I do not have acces to the Windows machine to compare package versions. I will include the MWE now. I figured out that if I change the CSV into a short simple file it works, but not on the actual one. So I go to investigate the problem by working on the CSV file. –  Aydin Sep 26 '12 at 20:18
I am getting the same error message when processing a CSV that has a LaTeX macro in the last column. Seems \DTLforeach gets confused if the column entry doesn't quite fit what is expected; maybe the subsequent newline is gobbled? In my case I worked around this by adding a bogus final column to the CSV, so the line ends with a column separator. –  Arend Jan 22 '13 at 23:25
Removing the "header" %% Abbreviations List seems to solve the problem.
@egreg: Could be. I created (from a copy-and-paste) abbreviations.csv on ScribTeX and it reproduced the error. Removing the comment also removed the error. –  Werner Sep 26 '12 at 20:37
I got a similar error with a comment line starting with % in a csv file when used by datatool. On removing the % the problem disappeared. –  Faheem Mitha Jan 6 at 22:17