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 21
21
import pathlib
22
22
23
23
from six .moves .urllib .parse import urlparse
24
+ from six .moves .urllib .request import url2pathname
24
25
25
26
from sagemaker import s3
26
27
from sagemaker .job import _Job
@@ -535,21 +536,22 @@ def _handle_user_code_url(self, code):
535
536
user_code_s3_uri = code
536
537
elif code_url .scheme == "" or code_url .scheme == "file" :
537
538
# 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 ):
539
541
raise ValueError (
540
542
"""code {} wasn't found. Please make sure that the file exists.
541
543
""" .format (
542
544
code
543
545
)
544
546
)
545
- if not os .path .isfile (code ):
547
+ if not os .path .isfile (code_path ):
546
548
raise ValueError (
547
549
"""code {} must be a file, not a directory. Please pass a path to a file.
548
550
""" .format (
549
551
code
550
552
)
551
553
)
552
- user_code_s3_uri = self ._upload_code (code )
554
+ user_code_s3_uri = self ._upload_code (code_path )
553
555
else :
554
556
raise ValueError (
555
557
"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