-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation: cannot import name 'Mapping' from 'collections' #72
Comments
From the Frappe website, Integrations -> S3 Backup Settings, I see below error msg from a pop-up App Versions
Route
Traceback
Request Data
Response Data
|
When installing Frappe S3 Attachment in a Python 3.10+ environment, you may encounter the following error: Solution1. Update DependenciesFirst, upgrade bench pip uninstall boto3 botocore -y
bench pip install boto3 botocore --upgrade 2. Create a Patch FileSet up the necessary file structure within the app directory: cd apps/frappe_s3_attachment
mkdir -p frappe_s3_attachment/patches
touch frappe_s3_attachment/patches/__init__.py Then, create the patch file: from __future__ import unicode_literals
import frappe
def execute():
"""
This patch updates the collections import to use collections.abc
"""
try:
from collections.abc import Mapping, MutableMapping
except ImportError:
from collections import Mapping, MutableMapping 3. Add the Patch RecordUpdate or create frappe_s3_attachment.patches.fix_collections_import 4. Update requirements.txtEdit boto3
botocore
python-magic==0.4.18 5. Run Migrations and Restartbench migrate
bench restart At least for me, this solution works. |
I think this plugin is a bit old and seems to be poorly maintained and may have many issues. I saw that the plug-in listed in Frappe cloud is this one. https://frappecloud.com/marketplace/apps/frappe_s3_attachment https://github.com/shridarpatil/Frappe-attachments-s3 It is a fork of this repository and has made some adaptations. It shows that it supports frappe 15. And this one. https://frappecloud.com/marketplace/apps/dfp_external_storage https://github.com/developmentforpeople/dfp_external_storage I suggest you try those first instead of trying to improve this project. |
Expected behaviour
No error in installation
Actual behaviour
Below error msg
Installing frappe_s3_attachment...
frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_daily is not a valid method: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)
frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_weekly is not a valid method: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)
frappe.integrations.doctype.s3_backup_settings.s3_backup_settings.take_backups_monthly is not a valid method: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)
Updating Dashboard for frappe_s3_attachment
Step to reproduce
bench get-app https://github.com/zerodhatech/Frappe-attachments-s3.git
bench --site sitename install-app frappe_s3_attachment
While installation, I saw above error
Version
master
Comment
I guess it is only backup related issue that was Frappe's native support for S3 backup, but just want to raise your attention, in case I missed something.
The text was updated successfully, but these errors were encountered: