Skip to content

S3Downloader.list() returns malformed URIs under Windows #1501

@alex23lemm

Description

@alex23lemm

Describe the bug
Instead of a / after the bucket name S3Downloader.list() adds \\ when constructing the URI under Windows resulting in an address that looks as follows:
s3://bucket_name\\models/output/model.tar.gz

To reproduce
I assume that you have set up your credentials underneath ~/.aws on your Windows machine.

conda create --name sagemaker-test
conda activate sagemaker-test
conda install pip
pip install sagemaker
  • Save the following Python script underneath C:\examples\s3downlader.py and modify the S3 URI to test it against your S3 bucket:
import sagemaker

s3_downloader = sagemaker.s3.S3Downloader()
output_path = "s3://[YOUR BUCKET NAME]/models/"
print(s3_downloader.list(output_path))
  • Back in Anaconda Prompt, execute the following command:
python c:\examples\s3downloader.py
  • In my case the result looks as follows:
['s3://[REMOVED_MY_BUCKET_NAME]\\models/sagemaker-train-xgboost-15-May-2020-10-41-44/output/model.tar.gz',
 's3://[REMOVED_MY_BUCKET_NAME]\\models/sagemaker-train-xgboost-15-May-2020-10-41-44/predictions/taxi_test.csv.out']

Expected behavior
In contrast, when I execute the Python script above in a SageMaker notebook, everything works as expected and the response looks as follows:

['s3://[REMOVED_MY_BUCKET_NAME]/models/sagemaker-train-xgboost-15-May-2020-10-41-44/output/model.tar.gz',
 's3://[REMOVED_MY_BUCKET_NAME]/models/sagemaker-train-xgboost-15-May-2020-10-41-44/predictions/taxi_test.csv.out']

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 1.58.2
  • Python version: 3.7
  • OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions