On 1/20/13 1:56 PM, Lex Berezhny wrote:

Can't you turn the csv into json on the server side?


That's one option, and I might wind up doing something like that. As I implied, though, my app is purely browser-based right now. The HTTP request I mentioned is to a Google Docs document, requesting output=csv. I haven't found any good way to get Google to output a json format.

I'm hoping for more information on the JS error trying to read from the StringIO object; if I can get that to work, it'll be the shortest and cleanest path.

Thanks,
Don

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.)

    Is this something I can fix or easily work around, or am I going
    to need to find a different approach?

    Thanks,
    Don Dwiggins


--


--




--



Reply via email to