Gracefully error when tileset name not specified
yuletide opened this issue · 2 comments
yuletide commented
What you've tried already
Trying to upload a tileset. Getting a confusing error.
Expected outcome
Command should exit with a descriptive error
Actual outcome
NextGen/Tiles ☸ mapbox --access-token $MAPBOX_SECRET_TOKEN upload districts.mbtiles
Uploading data source [------------------------------------] 0%
Traceback (most recent call last):
File "/usr/local/bin/mapbox", line 11, in <module>
load_entry_point('mapboxcli==0.8.0', 'console_scripts', 'mapbox')()
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/mapboxcli/scripts/uploads.py", line 71, in upload
callback=callback)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/mapbox/services/uploads.py", line 277, in upload
url = self.stage(fileobj, callback=callback)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/mapbox/services/uploads.py", line 115, in stage
bucket.upload_fileobj(fileobj, key, Callback=callback)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/boto3/s3/inject.py", line 581, in bucket_upload_fileobj
Callback=Callback, Config=Config)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/boto3/s3/inject.py", line 539, in upload_fileobj
return future.result()
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/s3transfer/futures.py", line 73, in result
return self._coordinator.result()
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/s3transfer/futures.py", line 233, in result
raise self._exception
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/s3transfer/tasks.py", line 126, in __call__
return self._execute_main(kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/s3transfer/tasks.py", line 150, in _execute_main
return_value = self._main(**kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/s3transfer/upload.py", line 692, in _main
client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/client.py", line 593, in _make_api_call
request_signer=self._request_signer, context=request_context)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 242, in emit_until_response
responses = self._emit(event_name, kwargs, stop_on_response=True)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/hooks.py", line 210, in _emit
response = handler(**kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/handlers.py", line 210, in conditionally_calculate_md5
calculate_md5(params, **kwargs)
File "/usr/local/Cellar/mapbox/0.8.0/libexec/lib/python3.7/site-packages/botocore/handlers.py", line 183, in calculate_md5
if request_dict['body'] and 'Content-MD5' not in params['headers']:
ValueError: __len__() should return >= 0
Other information
- Version numbers for
mapboxcli
andmapbox
(from, e.g.,pip list
) :
mapbox --version: 0.8.0
- Operating System : OSX 10.13.5
- Python version number :
Python 3.6.3 :: Anaconda custom (64-bit)
- How did you install the mapbox cli? Homebrew, pip, other? : homebrew
Edit: Issue was missing parameter. Updated this to enhancement request for better error handling when tileset name missing
mapbox --access-token $MAPBOX_SECRET_TOKEN upload $username.districts districts.mbtiles
worked fine
yuletide commented
Issue was missing parameter. Updated this to enhancement request for better error handling when tileset name missing
Thanks for the help @sgillies!
sgillies commented
I'm going to change this to a bug. We should fail early and clearly when there's no data source.