I am trying to create a simple s3 session in Pycharm and it is not letting me create for the love of God. I have checked multiple times still the same error, can anyone please nudge me in the right direction?
My code -
from secrets import AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN
import boto3
import multiprocess as mp
import multiprocessing
session = boto3.session.Session()
session = boto3.session.Session(aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
aws_session_token=AWS_SESSION_TOKEN)
s32 = boto3.resource('s3')
=============
/usr/local/bin/python3.8 /Users/mu/PycharmProjects/Experiments/Get_S3_Files_Add_Partition.py
Traceback (most recent call last):
File "/Users/mu/PycharmProjects/Experiments/Get_S3_Files_Add_Partition.py", line 12, in <module>
s32 = boto3.resource('s3')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/__init__.py", line 100, in resource
return _get_default_session().resource(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/session.py", line 384, in resource
client = self.client(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/session.py", line 258, in client
return self._session.create_client(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/session.py", line 835, in create_client
client = client_creator.create_client(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/client.py", line 80, in create_client
cls = self._create_client_class(service_name, service_model)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/client.py", line 107, in _create_client_class
self._event_emitter.emit(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/utils.py", line 61, in _handler
module = import_module(module)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/utils.py", line 52, in import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/s3/inject.py", line 15, in <module>
from boto3.s3.transfer import create_transfer_manager
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/boto3/s3/transfer.py", line 127, in <module>
from s3transfer.exceptions import RetriesExceededError as \
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/s3transfer/__init__.py", line 141, in <module>
import s3transfer.compat
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/s3transfer/compat.py", line 173, in <module>
from multiprocessing.managers import BaseManager
ModuleNotFoundError: No module named 'multiprocessing.managers'; 'multiprocessing' is not a package
Please refer to the AWS SDK Github where code examples are located. Your code looks different from the Python examples. See this example.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.