Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully error when tileset name not specified #127

Open
yuletide opened this issue Jul 2, 2018 · 2 comments
Open

Gracefully error when tileset name not specified #127

yuletide opened this issue Jul 2, 2018 · 2 comments
Labels

Comments

@yuletide
Copy link

yuletide commented Jul 2, 2018

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 and mapbox (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 yuletide changed the title Error when uploading tileset Error when uploading tileset -- ValueError: __len__() should return >= 0 Jul 2, 2018
@yuletide yuletide changed the title Error when uploading tileset -- ValueError: __len__() should return >= 0 Gracefully error when tileset name not specified Jul 2, 2018
@yuletide
Copy link
Author

yuletide commented Jul 2, 2018

Issue was missing parameter. Updated this to enhancement request for better error handling when tileset name missing

Thanks for the help @sgillies!

@sgillies sgillies added bug and removed enhancement labels Jul 2, 2018
@sgillies
Copy link
Contributor

sgillies commented Jul 2, 2018

I'm going to change this to a bug. We should fail early and clearly when there's no data source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants