Setup.py: install lxml with Python2.6 on CentOS

I had the same issue, I managed to install it after installing the package libxslt-devel and python-devel which seems to be your problem: yum install libxslt-devel python-devel python setup.py install Installed /usr/lib/python2.6/site-packages/lxml-2.2.8-py2.6-linux-i686.egg Processing dependencies for lxml==2.2.8 Finished processing dependencies for lxml==2.2.8 However since I also installed other packages in the process, you might want to … Read more

PyCharm not recognizing Django project imports: from my_app.models import thing

I was having this issue using a “2 Scoops of Django” project layout, e.g. /project_root /project_dir /config /settings /my_app /tests models.py /requirements readme.rst The code was working, but in /tests, IntelliJ/PyCharm showed an unresolved reference: from my_app.models import Something I had all the __init__.py files in place. I ended up having to set the sources … Read more

nightmare with relative imports, how does pep 366 work?

The “boilerplate” given in PEP 366 seems incomplete. Although it sets the __package__ variable, it doesn’t actually import the package, which is also needed to allow relative imports to work. extraneon‘s solution is on the right track. Note that it is not enough to simply have the directory containing the module in sys.path, the corresponding … Read more

How to import python file from git submodule

you can add to sys.path in the file you want to be able to access the module, something like: import sys sys.path.append(“/home/me/myproj/gitmodules”) import mygitsubmodule This example is adding a path as a raw string to make it clear what’s happening. You should really use the more sophisticated, system independent methods described below to determine and … Read more

How to import the own model into myproject/alembic/env.py?

You can set the PYTHONPATH environment variable to control what python sees as the top level folder, eg. if you are in the root folder of your project: PYTHONPATH=. alembic revision -m “…” Then you can use a “normal” import in your alembic env.py, relative to your root folder, in your example: from src.models.base import … Read more

ImportError: cannot import name ‘Literal’ from ‘typing’

Using Literal in Python 3.8 and later from typing import Literal Using Literal in all Python versions (1) Literal was added to typing.py in 3.8, but you can use Literal in older versions anyway. First install typing_extensions (pip install typing_extensions) and then from typing_extensions import Literal This approach is supposed to work also in Python … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)