Trouble with webppl-csv

15 views
Skip to first unread message

Isaac Davis

unread,
Mar 23, 2020, 5:11:48 PM3/23/20
to webppl-dev
Hi folks. I am new to webppl and trying to get the webppl-csv package to work.

I wrote a simple test file that generates a data table and outputs it using the command

csv.write(d, 'test/test-file-copy.csv');


I ran the file using the command

webppl h22_code.txt --require webppl-csv



(h22_code.txt is the name of the test file)

I get the following error message, and I have no idea what this means.

Any advice or suggestions would be greatly appreciated, thanks!
-Isaac

/usr/local/lib/node_modules/webppl/webppl:47

          throw error;

          ^

exception: Unable to serialize unrecognized input

(Use `node --trace-uncaught ...` to show where the exception was thrown)



null-a

unread,
Mar 23, 2020, 5:22:50 PM3/23/20
to webppl-dev
Hi. I'm not sure what's happening here, but if you can make a stand alone program that I can run locally to easily reproduce the problem I'll happily take a closer look for you.

Cheers,
Paul

Isaac Davis

unread,
Mar 23, 2020, 5:32:10 PM3/23/20
to webppl-dev
Hi Paul. I've attached the file here. I tried to keep it as simple as humanly possible- it creates an array and writes it to a csv file in the same directory.

Thanks! 
h22_code.txt

null-a

unread,
Mar 23, 2020, 5:50:31 PM3/23/20
to webppl-dev
Thanks. It seems to work if you make the thing you're serializing a nested array. e.g. This works for me:

var test=[0,1,1,2,1];

csv
.write([test,test], 'test-file.csv');



Isaac Davis

unread,
Mar 23, 2020, 5:53:34 PM3/23/20
to webppl-dev
Yes that seemed to work! I think I need to play around with the array formatting.

Thanks so much!
-Isaac
Reply all
Reply to author
Forward
0 new messages