File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 2121import pathlib
2222
2323from six .moves .urllib .parse import urlparse
24+ from six .moves .urllib .request import url2pathname
2425
2526from sagemaker import s3
2627from sagemaker .job import _Job
@@ -535,21 +536,22 @@ def _handle_user_code_url(self, code):
535536 user_code_s3_uri = code
536537 elif code_url .scheme == "" or code_url .scheme == "file" :
537538 # Validate that the file exists locally and is not a directory.
538- if not os .path .exists (code ):
539+ code_path = url2pathname (code_url .path )
540+ if not os .path .exists (code_path ):
539541 raise ValueError (
540542 """code {} wasn't found. Please make sure that the file exists.
541543 """ .format (
542544 code
543545 )
544546 )
545- if not os .path .isfile (code ):
547+ if not os .path .isfile (code_path ):
546548 raise ValueError (
547549 """code {} must be a file, not a directory. Please pass a path to a file.
548550 """ .format (
549551 code
550552 )
551553 )
552- user_code_s3_uri = self ._upload_code (code )
554+ user_code_s3_uri = self ._upload_code (code_path )
553555 else :
554556 raise ValueError (
555557 "code {} url scheme {} is not recognized. Please pass a file path or S3 url" .format (
You can’t perform that action at this time.
0 commit comments