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

Adding detailed message for import error #70

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions google/resumable_media/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,15 @@ def SimpleUpload(*args, **kwargs):
pkg_resources.require('requests >= 2.18.0')
except pkg_resources.ResolutionError as caught_exc: # pragma: NO COVER
import six
message = ''
if isinstance(caught_exc, pkg_resources.VersionConflict):
message = 'There is a version conflict in request module ' \
'required by ``google.resumable_media.requests`` subpackage.\n'
elif isinstance(caught_exc, pkg_resources.DistributionNotFound):
message = '``requests`` module not found.\n'

new_exc = ImportError(
message +
'``requests >= 2.18.0`` is required by the '
'``google.resumable_media.requests`` subpackage.\n'
'It can be installed via\n'
Expand Down