mapbox/mapbox-cli-py

No read method on valid file upload

Closed this issue · 4 comments

Just got this somewhat-cryptic message on trying to upload this valid demo geojson file

| => mapbox upload --name landplanner.demopoints demo.geojson
Usage: mapbox upload [OPTIONS] TILESET [INFILE]

Error: Invalid value: Object `None` has no .read method, a file-like object is required

My key is properly configured (I gave it all 12 scopes just in case) and exported to $MAPBOX_ACCESS_TOKEN, and the file is valid, so I'm not sure what's going on here. Is my account missing some authorization globally?

@wboykinm I think it's just a mix up in the command line arguments. demo.geojson was interpreted as the TILESET arg leaving the INFILE argument blank.

This should work

$ mapbox upload --name "Demo Points Title" landplanner.demopoints demo.geojson

                |------------------------| |--------------------| |----------|
                     Title in Studio             Tileset ID        input data

To clarify

  • --name is optional and defines the human-readable title you'll see in Studio
  • TILESET is required and defines the tileset id (with the <username>.<textid> pattern)
  • INFILE is the local data and should be required.

The cryptic error message is definitely a problem. INFILE should probably be a required argument and give a useful error message

Error: Missing argument "INFILE".

It appears to be explicitly not required so I'll have to review why that's the case.

@wboykinm thanks for the report. The above PR should at least make the error messages clear in the next version.

Awesome; thanks!

Resolved on my end. Thanks again @perrygeo.