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

Prevent smart_open from writing to logs on import #476

Merged
merged 6 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Prevent smart_open from writing to logs on import (PR [#476](https://github.com/RaRe-Technologies/smart_open/pull/476), [@mpenkov](https://github.com/mpenkov))

# 1.11.0, 8 Apr 2020

- Fix GCS multiple writes (PR [#421](https://github.com/RaRe-Technologies/smart_open/pull/421), [@petedannemann](https://github.com/petedannemann))
Expand Down
10 changes: 7 additions & 3 deletions smart_open/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def register_transport(submodule):
try:
submodule = importlib.import_module(submodule)
except ImportError:
logger.warning('unable to import %r, disabling that module', submodule)
return

if hasattr(submodule, 'SCHEME'):
Expand All @@ -64,8 +63,13 @@ def get_transport(scheme):
This submodule must have been previously registered via :func:`register_transport`.

"""
message = "scheme %r is not supported, expected one of %r" % (scheme, SUPPORTED_SCHEMES)

expected = SUPPORTED_SCHEMES
readme_url = 'https://github.com/RaRe-Technologies/smart_open/blob/master/README.rst'
message = (
"Unable to handle scheme %(scheme)r, expected one of %(expected)r. "
"Extra dependencies required by %(scheme)r may be missing. "
"See <%(readme_url)s> for details." % locals()
)
try:
submodule = _REGISTRY[scheme]
except KeyError:
Expand Down