Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Using loadTable() returns an empty Table object for URLs not ending in ".csv" or ".tsv" #1696

Closed
fish2000 opened this Issue · 2 comments

3 participants

@fish2000

Prior to Processing 2.0b7, remote tabular data URLs with arbitrary semantics would load and work fine, as long as they contained properly parseable CSV or TSV data. As of 2.0b7 the suffixes must be appended.

I encountered this problem while trying to pull data from a Django web app that looked like this:

http://localhost:8000/spreadsheets/worksheet/csv/1?header=true

... which yielded the empty set. It worked after the URL in the web app was changed to this form:

http://localhost:8000/spreadsheets/documents/worksheet-1.csv

... although even with the ".csv" suffix, empty sets are still returned if query string parameters are appended. I additionally tested all of these cases with static files served from nginx, with the same results.

Since loading remote data, by definition, enables Processing to access data whose metadata that is not explicitly under the control of the user, I assume this is a bug and not a feature – many public datasets, such as this USGS feed of earthquake data:

http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M2.5.txt

... are no longer useable from Processing without using some sort of cumbersome workaround.

Relatedly, I found that a URL containing CSV data but ending in ".tsv" will load properly with loadTable(url, "csv") – this further suggests that the suffix constraint is a bug.

@alignedleft
Collaborator

The loadTable() syntax has been changing quite a bit. Here's the latest documentation:

http://trunk.processing.org/reference/loadTable_.html

CSV format is assumed, unless otherwise specified.

Does using this syntax with the latest build address your concern?

@benfry
Owner

Not a bug, this is just how the syntax will work, specifically to address what's being cited here.

If it's tsv data, use:
Table t = loadTable("http://localhost:8000/spreadsheets/worksheet/csv/1?header=true", "tsv");

If it's csv data, use:
Table t = loadTable("http://localhost:8000/spreadsheets/worksheet/csv/1?header=true", "csv");

In a related change, I've also removed auto-detection of the format, which means a file named .csv that's actually .tsv will no longer work properly.

@benfry benfry closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.