< Back to IRCAM Forum

Omloop unbound variable exception

Hi -

Probably a novice error, but… I’m trying to do a really simple thing of importing data from a .CSV file in the way suggested in the manual but with this basic patch below I keep getting the variable unbound error shown. I’ve tried saving the file in different encodings from excel but no luck. Is this a bug or am I being particularly thick?



TestCSV.csv (78.9 KB)

Using OM7.0

Dear Graham,

First of all i believe (not sure) you should use these inside a file-box and not an omloop.
However, i tried the help example and apparently it is not really working.

A pretty simple and easy way to import a text data from a text sis by using the textfile object (see classes) and right-click+import text.

I will ask Jean (the author of file-box) for further details.


Dear Graham,

I confirm the above. Jean kindly answered my doubts:
In the text-file example, you should remove the once-eval mode on the on the read-line function. HOWEVER, using your file, this will not work. I think because of line formating.

So let us take the problem backwards. What do you want to do with your file. I imagine you want to build something out from it as lists. So is it each table line, each element etc… We can find a simple solution for this.


Thank you Karim - Much appreciated as always!

I think it might have to do with the commas(?) in a CSV or maybe as you say, the carriage return (as well?).

I tried the file reader in the OMTristan library and it didn’t like just reading the file either. But when I changed the file format to be space delimited the OMTristan one worked but with no carriage returns. (Still no luck the file streamer.)

So I have a way of working with these kinds of files when you know the number of ‘columns’.

  • Take in the whole file which gives a long flat list of values
  • Use list-explode with the number of columns to create a list of lists that is effectively the rows of the spreadhseet
  • Use mat-trans to transform to a list of columns rather than a list of rows

Works fine and seems efficient but maybe there’s a better way.

Thanks for looking into it, Karim!

All the best,