Following up on my own post, for future reference:
On Jan 20, 2013 2:24 PM, "Don Dwiggins"
<[email protected]
<mailto:[email protected]>> wrote:
I'm just getting started on my first pyjs app, and am enjoying it
so far. I've run into a problem, though:
My app will be getting CSV data from an HTTP request. For now,
I'm testing it with local CSV data that I've wrapped as a string
in a .py module, so I can import it (I can't read it from a local
file, natch, and I don't want to tackle AJAX until I have to).
So, what I have on import is a CSV string that I want to parse
into a list of lists with the csv.reader() method. That method,
though, takes a "file-like object", which I can create using
StringIO. The problem, though, is that, when I do "rdr =
reader(StringIO(csvdata))", I get the following error:
*JavaScript Error: * TypeError: self is undefined at line number
12087. Please inform webmaster.
TrackerSucker.py, line 89:
rdr = reader(sio)
("sio" is the StringIO object.)
After some reading, I found that csv.reader will accept a list of
strings as being "file-like" enough. So, "rdr =
reader(csvdata.split('\n'))" did the job for me.
Don
--
---
You received this message because you are subscribed to the Google Groups "Pyjs.org Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.