Wagtail Tinymce - ModuleNotFoundError: No module named 'wagtail.wagtailadmin' - python

I'm trying to install the package "wagtailtinymce" already downloaded it, however, the repository tutorial is completely bad. I do not know if it's because of some update or something. I'm using the latest version of wagtail and I already have a project created (obvious).
The error is in every import the package tries to make, and since I'm starting in Django and Wagtail, I do not know what to do. I have not been able to migrate the application yet because of this error.
File "/mnt/sda3/Development/Projetos/blog-wagtail/env/lib/python3.7/site-packages/wagtailtinymce/wagtail_hooks.py", line 37, in <module>
from wagtail.wagtailadmin.templatetags.wagtailadmin_tags import hook_output
ModuleNotFoundError: No module named 'wagtail.wagtailadmin'
File "/mnt/sda3/Development/Projetos/blog-wagtail/env/lib/python3.7/site-packages/wagtailtinymce/wagtail_hooks.py", line 29, in <module>
from django.core.urlresolvers import reverse
ModuleNotFoundError: No module named 'django.core.urlresolvers'
The import of django passed when I changed to "from django.urls import reverse" but the rest I do not know what to do, and I believe it will continue to give error every import

Looking at the documentation, https://github.com/isotoma/wagtailtinymce#wagtail-tinymce , this module is compatible with Wagtail 1.5 and currently we are in the 2.3 version.

As mentioned, the pip package for wagtailtinymce is not up to date for latest versions of wagtail.
However, the github repo of the package has a branch named wagtail40 which is compatible with the latest version.
To install, instead of using pip install wagtailtinymce, use pip install git+https://github.com/isotoma/wagtailtinymce.git#wagtail40 and following other steps mentioned in the docs should work.
Tested in Django==4.1.2 and wagtail==4.0.4

Related

ImportError: cannot import name 'YamlModel' from 'pydantic_yaml'

I am working at blender script, where I want to use YAML. So I try to import it:
from pydantic import BaseModel
from pydantic_yaml import YamlModel
But when I run my script, this error will occure:
ImportError: cannot import name 'YamlModel' from 'pydantic_yaml' (C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages\pydantic_yaml\__init__.py)
I have installed pydantic and pydantic_yaml on both Pythons (Blender one and the common one), if they wouldn't be installed, there would be different error. I tried googling, but google had very few results for this problem. Also, when I open that __init__.py file, there is clearly YamlModel. Thank you for any kind of help.
I found the same error and it is related how pydantic-yaml got installed.
There is a bug in the package. you need to install optional dependencies as well (so called extras).
pip install pedantic-yaml[pyyaml,ruamel]
or manually install pyyaml ruamel please make sure that that Taumel version is <=0.18

Python2 to Python3 migration causes problem in django-earthdistance package I rely on

File "/opt/folder/api/views.py", line 63, in
from django_earthdistance.models import EarthDistance, LlToEarth
File "/opt/folder/venv/lib/python3.8/site-packages/django_earthdistance/models.py", line 4, in
from django.utils import six
ImportError: cannot import name 'six' from 'django.utils' (/
I am finally moving to Python3 from Python2 and I just have about everything wrapped up, but I am getting this error from the dango-earthdistance package which hasn't been updated for a couple of years and apparently doesn't support the latest version of Python3 that I'm using (3.8.9). This lets me calculate distances with lat and lng in Postgres.
What's my best option?
Six is a package of tools for writing code that is compatible with both Python 2 and Python 3.
Django used to vendor their own copy of Six until they removed it in Django 3.0.
django-earthdistance is still looking for Django's copy of the Six library, and you can bring it back by installing the django-utils-six package.
See this related question for more information.

scrapyd error while deploying with scrapyd-client

While executing the command:
scrapyd-deploy default
I'm runnning into an error saying:
File"/home/user/miniconda3/envs/quickcompany/lib/python3.8/site-packages/scrapyd_client/deploy.py", line 23, in <module>
from scrapy.utils.http import basic_auth_header
ModuleNotFoundError: No module named 'scrapy.utils.http'
I have tried uninstalling and resinstalling the relevant libraries.
Also tried using both the github and packaged versions of scrapyd-client.
Little Modification to LuisA310 solution, it should be from w3lib.http import basic_auth_header for scrapyd-client==1.2.0a1
Twisted versions before 18.9 used scrapy.utils.http (which is deprecated) if you want to use scrapyd-client change from scrapy.utils.http import basic_auth_header to from w3lib.http import basic_auth_header in the scrapyd-deplo.py file although I would recommend you not to use deprecated packages.
For those wondering about the answer, there was a glitch in the library. I tried upgrading scrapyd client and it seemed to work fine from there on out

Unable to import 'flask_uploads' pylint(import-error)

I installed flask-upload module in windows 10:
pip install flask flask-wtf flask-uploads
The results were:
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 WTForms-2.3.1 Werkzeug-1.0.1 click-7.1.2 flask-1.1.2 flask-uploads-0.2.1 flask-wtf-0.14.3 itsdangerous-1.1.0
Then in the text editor there is an error when I import the module as shown in the screenshot. unable to import flask-uploads
After running the app.py the following are the errors in cmd:
Error: While importing "app", an ImportError was raised:
Traceback (most recent call last):
File "c:\users\seanv\onedrive\documents\web dev\##pprojects\flask\flask_uploads\myenv\lib\site-packages\flask\cli.py", line 240, in locate_app
__import__(module_name)
File "C:\Users\seanv\OneDrive\Documents\web dev\##pprojects\flask\flask_uploads\app.py", line 4, in <module>
from flask_uploads import configure_uploads, IMAGES, UploadSet
File "c:\users\seanv\onedrive\documents\web dev\##pprojects\flask\flask_uploads\myenv\lib\site-packages\flask_uploads.py", line 26, in <module>
from werkzeug import secure_filename, FileStorage
ImportError: cannot import name 'secure_filename' from 'werkzeug' (c:\users\seanv\onedrive\documents\web dev\##pprojects\flask\flask_uploads\myenv\lib\site-packages\werkzeug\__init__.py)
May someone who understands the problem help me with possible solutions or suggestions. Thank you in advance.
Your app is using Flask-Uploads.
Back in February 2020, there was an update for Werkzeug, a library which Flask and many libraries, including Flask-Uploads, is based on.
This update introduced a breaking change, as Werkzeug changed its API, ie. the import of secure_filename.
I provided a pull request to Flask-Uploads, which the maintainer accepted. But very sadly and unfortunately the maintainer did not want to provide a new package for PyPi.
So, while you could install the updated Flask-Uploads via a commit id from its GitHub repository, you cannot any longer install it from PyPi.
I asked the maintainer for a new release, I also offered my help, but no chance.
So, finally, I decided to fork the library.
Here is the new package on PyPi
https://pypi.org/project/Flask-Reuploaded/
Here is the repository
https://github.com/jugmac00/flask-reuploaded
It is a drop-in replacement. So you just have to install the new package and it just works. No need to change any imports or code in your application.

Python module from GitHub installed using setup.py can't see own submodules

I downloaded python-somelib-master.zip from GitHub hoping to use the API it provides. I ran
python setup.py install
And it apparently completed successfully:
Writing D:\SOFT\Python3\Lib\site-packages\python-somelib-1.0-py3.5.egg-info
which then introduced D:\SOFT\Python3\Lib\site-packages\somelib.
However, when I try to import something from there in my script:
from somelib import SubModule
I get
File "D:\SOFT\Python3\lib\site-packages\somelib\__init__.py", line 1, in <module>
from base import SubModule
ImportError: No module named 'base'
I confirmed that base.py is present in D:\SOFT\Python3\Lib\site-packages\somelib.
Did I not properly install the module?
You must install modules dependencies in your machine too. If you are using Ubuntu, you can easily do it with "apt-get". Hope it helps! xD

Categories

Resources