【标题】
执行课堂作业(python数据处理实践)报错
【版本、环境信息】
WS2环境
python:3.6.9
【源码】
import cv2
import nori2 as nori
from meghair.utils import io
from meghair.utils.imgproc import imdecode
fetcher = nori.Fetcher()
datas = io.load(“s3://ai-cultivate/task1/pics.pkl”)
for item in datas:
print(item)
img = imdecode(fetcher.get(item[“nori_id”]))[…, :3]
cv2.imwrite("%s.jpg" % item[“meta”], img)
break
【执行命令】
python3 test_nori.py
【报错信息】
`wangcong@pensive-agnesi:/data/wangcong_test$ rlaunch --cpu=1 --gpu=1 --memory=4096 – python3 test_nori.py
/usr/lib/python3/dist-packages/requests/init.py:80: RequestsDependencyWarning: urllib3 (1.26.4) or chardet (3.0.4) doesn’t match a supported version!
RequestsDependencyWarning)
18 15:01:02 MegSkull 4.10.0 initialized. Using MegBrain: 8.10.1
18 15:01:02 MegHair 4.7.0 initialized
failed to process ‘HeadObject’, with parameters: {‘url_path’: ‘/ch-share/pics.pkl’, ‘query_string’: {}, ‘method’: ‘HEAD’, ‘headers’: {‘User-Agent’: ‘Boto3/1.17.73 Python/3.6.9 Linux/4.15.0-136-generic Botocore/1.20.73’}, ‘body’: b’’, ‘url’: ‘http://oss.i.brainpp.cn/ch-share/pics.pkl’, ‘context’: {‘client_region’: ‘us-east-1’, ‘client_config’: <botocore.config.Config object at 0x7f20645eeeb8>, ‘has_streaming_input’: False, ‘auth_type’: None, ‘signing’: {‘bucket’: ‘ch-share’}}}
Traceback (most recent call last):
File “/usr/local/lib/python3.6/dist-packages/refile/s3.py”, line 301, in s3_isfile
client.head_object(Bucket=bucket, Key=key)
File “/usr/local/lib/python3.6/dist-packages/botocore/client.py”, line 386, in _api_call
return self._make_api_call(operation_name, kwargs)
File “/usr/local/lib/python3.6/dist-packages/botocore/client.py”, line 692, in _make_api_call
operation_model, request_dict, request_context)
File “/usr/local/lib/python3.6/dist-packages/refile/errors.py”, line 103, in wrapper
result = func(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/botocore/client.py”, line 711, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File “/usr/local/lib/python3.6/dist-packages/botocore/endpoint.py”, line 102, in make_request
return self._send_request(request_dict, operation_model)
File “/usr/local/lib/python3.6/dist-packages/botocore/endpoint.py”, line 132, in _send_request
request = self.create_request(request_dict, operation_model)
File “/usr/local/lib/python3.6/dist-packages/botocore/endpoint.py”, line 116, in create_request
operation_name=operation_model.name)
File “/usr/local/lib/python3.6/dist-packages/botocore/hooks.py”, line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/botocore/hooks.py”, line 228, in emit
return self._emit(event_name, kwargs)
File “/usr/local/lib/python3.6/dist-packages/botocore/hooks.py”, line 211, in _emit
response = handler(**kwargs)
File “/usr/local/lib/python3.6/dist-packages/botocore/signers.py”, line 90, in handler
return self.sign(operation_name, request)
File “/usr/local/lib/python3.6/dist-packages/botocore/signers.py”, line 162, in sign
auth.add_auth(request)
File “/usr/local/lib/python3.6/dist-packages/botocore/auth.py”, line 373, in add_auth
raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “test_nori.py”, line 9, in
datas = io.load(“s3://ch-share/pics.pkl”)
File “/usr/local/lib/python3.6/dist-packages/meghair/utils/io.py”, line 395, in load
with fopen(fname, ‘rb’) as fin:
File “/usr/local/lib/python3.6/dist-packages/refile/smart.py”, line 387, in smart_open
return SmartPath(path).open(mode, **options)
File “/usr/local/lib/python3.6/dist-packages/refile/smart_path.py”, line 85, in open
return self.path.open(mode, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/refile/s3_path.py”, line 98, in open
if not self.is_file():
File “/usr/local/lib/python3.6/dist-packages/refile/s3_path.py”, line 36, in is_file
return s3_isfile(self.path_with_protocol)
File “/usr/local/lib/python3.6/dist-packages/refile/s3.py”, line 305, in s3_isfile
raise error
refile.errors.S3ConfigError: Unable to locate credentials
INFO[0014] [Agent: A18890146806741] Worker FAILED: user command error: exit code 1
wangcong@pensive-agnesi:/data/wangcong_test$ `