Skip to content

Commit

Permalink
Support instance of pathlib.PosixPath as artifact URI (#3468)
Browse files Browse the repository at this point in the history
Passing an instance of `pathlib.PosixPath` to the `artifacts` attribute of `save_model` results in an `AttributeError: 'PosixPath' object has no attribute 'decode'` exception being thrown by `urllib`.

Explicit conversion to string overcomes this problem. I wonder whether this could be added to `mlflow` directly.

Signed-off-by: Ghislain Vaillant <ghisvail@gmail.com>
  • Loading branch information
ghisvail committed Oct 13, 2020
1 parent b73a631 commit bcff818
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mlflow/tracking/artifact_utils.py
Expand Up @@ -59,7 +59,7 @@ def _download_artifact_from_uri(artifact_uri, output_path=None):
:param output_path: The local filesystem path to which to download the artifact. If unspecified,
a local output path will be created.
"""
parsed_uri = urllib.parse.urlparse(artifact_uri)
parsed_uri = urllib.parse.urlparse(str(artifact_uri))
prefix = ""
if parsed_uri.scheme and not parsed_uri.path.startswith("/"):
# relative path is a special case, urllib does not reconstruct it properly
Expand Down

0 comments on commit bcff818

Please sign in to comment.