cx_freeze不保存boto3的.aws凭据

时间:2019-05-17 19:18:01

标签: python-2.7 tkinter boto3 cx-freeze botocore

我正在使用python 2.7和boto3最新版本的Windows 10计算机上。另外,我正在使用cz_freeze 5.2.0版本从python代码创建一个.exe。

项目简要视图:

我正在创建一个可部署的工具,该工具使用boto3以编程方式下载和上传S3存储桶中的对象。可执行文件在我的机器上运行得很好,因为〜/ .aws文件夹中已经存在凭据。但是,当我在另一台计算机上复制可执行文件时,它总是抛出一个错误,说它无法找到凭据。


我尝试通过3种方式解决问题。

在冻结它之前,我在setup.py文件中包含了.aws文件夹。但是,它会从可执行文件所在的文件夹中读取凭据。

我还尝试将.aws文件夹的路径添加为环境变量,但它也无法找到凭据

我将S3存储桶中的文件夹更改为授予完全公共访问权限,并尝试运行该程序,但是它仍然在寻找凭据。

请帮助我。我的解决方案用完了。我已经粘贴了完整的追溯错误:

runfile('E:/EEG_Evolution/New tests/Key process V1.0/decoding ekx.py', wdir='E:/EEG_Evolution/New tests/Key process V1.0')
Reloaded modules: dowload_ekb
('the prefix for the dng_num is: ', '52525')
Traceback (most recent call last):

File "", line 1, in
runfile('E:/EEG_Evolution/New tests/Key process V1.0/decoding ekx.py', wdir='E:/EEG_Evolution/New tests/Key process V1.0')

File "C:\Users\nVIALP2\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
execfile(filename, namespace)

File "C:\Users\nVIALP2\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 95, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

File "E:/EEG_Evolution/New tests/Key process V1.0/decoding ekx.py", line 49, in
file_name, local_file_location = db.new_ekb(dong, destination, check)

File "dowload_ekb.py", line 88, in new_ekb
for obj in bucket_objects:

File "C:\Users\nVIALP2\Anaconda2\lib\site-packages\boto3\resources\collection.py", line 83, in iter
for page in self.pages():

File "C:\Users\nVIALP2\Anaconda2\lib\site-packages\boto3\resources\collection.py", line 166, in pages
for page in pages:

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\paginate.py", line 255, in iter
response = self._make_request(current_kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\paginate.py", line 332, in _make_request
return self._method(**current_kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\client.py", line 648, in _make_api_call
operation_model, request_dict, request_context)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\client.py", line 667, in _make_request
return self._endpoint.make_request(operation_model, request_dict)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\endpoint.py", line 132, in _send_request
request = self.create_request(request_dict, operation_model)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\endpoint.py", line 116, in create_request
operation_name=operation_model.name)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\hooks.py", line 228, in emit
return self._emit(event_name, kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\hooks.py", line 211, in _emit
response = handler(**kwargs)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\signers.py", line 90, in handler
return self.sign(operation_name, request)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\signers.py", line 157, in sign
auth.add_auth(request)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\auth.py", line 425, in add_auth
super(S3SigV4Auth, self).add_auth(request)

File "C:\Users\nVIALP2\AppData\Roaming\Python\Python27\site-packages\botocore\auth.py", line 357, in add_auth
raise NoCredentialsError

NoCredentialsError: Unable to locate credentials

0 个答案:

没有答案