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
@@ -510,21 +511,22 @@ def _handle_user_code_url(self, code):
510
511
user_code_s3_uri = code
511
512
elif code_url .scheme == "" or code_url .scheme == "file" :
512
513
# Validate that the file exists locally and is not a directory.
513
- if not os .path .exists (code ):
514
+ code_path = url2pathname (code_url .path )
515
+ if not os .path .exists (code_path ):
514
516
raise ValueError (
515
517
"""code {} wasn't found. Please make sure that the file exists.
516
518
""" .format (
517
519
code
518
520
)
519
521
)
520
- if not os .path .isfile (code ):
522
+ if not os .path .isfile (code_path ):
521
523
raise ValueError (
522
524
"""code {} must be a file, not a directory. Please pass a path to a file.
523
525
""" .format (
524
526
code
525
527
)
526
528
)
527
- user_code_s3_uri = self ._upload_code (code )
529
+ user_code_s3_uri = self ._upload_code (code_path )
528
530
else :
529
531
raise ValueError (
530
532
"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