Django Gramps no module named web.settings - django

I'm using Gramps 3.3.1 under Ubuntu 12.04 and trying to in Django Export/Import. The install is okay, but when I look at the installed addons, it says that it failed, with reason: "No module named web.settings".
I cann't for the life of me figure out how to fix this. I'm assuming that it's this line in the python script:
import web.settings as default_settings
Anyone have any ideas? I'm trying to get this data out and into a MySQL database, but I can't seem to.
Thanks!

When you run into an error where Python tells you "No module named blah" it really means it can't find "blah".
I would check your pythonpath and the filesystem permissions on the stuff in your path.
Edit
Your issue seems to be a known issue: http://www.gramps-project.org/bugs/view.php?id=5464
It's caused by not running Gramps from source, near as I can tell. It doesn't look like a Python Path issue, so much as the Gramps Django devs making assumptions where your Django settings would be (but I could be wrong).
As for Python Path, there's plenty of resources describing how to. The simplest way to check your Python path is to run echo $PYTHONPATH in a terminal. If you don't see it there, Python might not find it.

Related

VS Code + Pylance does not find venv-installed modules while venv is activated

I use VS Code Version: 1.74.3 on MacOS 13.2. python -V returns Python 3.11.1.
I get the following error message: Import "django.shortcuts" could not be resolved from source Pylance(reportMissingModuleScource).
As you can see in the screenshot, the correct venv is activated and includes Django.
I also tried or checked:
Import could not be resolved/could not be resolved from source Pylance in VS Code using Python 3.9.2 on Windows 10
https://stackoverflow.com/a/65802367/2321643 but
the suggested solution with reloading the windows did not help.
reinstallation the virtual environment within VSCode and installing Django again
re-selecting the venv.
deleting all python-specific settings in user/settings.json as well as .vcode/settings.json.
Reinstallation python and associated extensions.
Using Debug I can safely run my Django-application without any import issues. What do I need to do that Pylance does not issues these problems?
My issue was a bug, fixed and closed.
For reference: https://github.com/microsoft/pylance-release/issues/3881
Try clicking on where it says "3.11.1 ('.venv': venv)" (near the bottom right).
It should bring up a little dialog sort of thing at the top where you can verify that the Python path is correct.
Check that it is using the correct Python path. It should be something like venv/bin/python3 or venv/bin/python assuming venv is situated at the root of youur project.

how do i fix "No module named 'win32api'" on python2.7

I am trying to import win32api in python 2.7.9. i did the "pip install pypiwin32" and made sure all the files were intalled correctly (i have the win32api.pyd under ${PYTHON_HOME}\Lib\site-packages\win32). i also tried coping the files from C:\Python27\Lib\site-packages\pywin32_system32 to C:\Python27\Lib\site-packages\win32. I also tried restarting my pc after each of these steps but nothing seems to work! i still get the error 'No module named 'win32api''
Well, turns out the answer is upgrading my python to 3.6.
python 2.7 seems to old to work with outside imports (I'm just guessing here, because its not the first time I'm having an import problem)
hope it helps :)

Can't load Python module by its path - __import__ says ImportError: Import by filename is not supported

I'm far from Python expert, so please bear with me.
I'm using Slack python bot library, which utilizes module loading to execute users code.
I noticed a weird thing - when I launch my script, it says ImportError: Import by filename is not supported on a line self.module = __import__(name) (where name is relative path to the Python file). I don't quite understand the problem, because the owners of the library test their code with both 2.x and 3.x Python, and it DOES work on TravisCI.
I'm using Python 2.7.8 on Windows 7.
How do I fix the problem? I suspect something on my system is wrong. I read similar questions on SO and worked around the issue by using imp.load_source, but I would like to get to the bottom of it.
P.S. It also works if I upload it to Heroku, which by default runs 2.7.12

No module named django.core when creating project in virtualenv

So I have looked around at a lot of questions similar to mine, however I couldn't find a concrete answer. My comp specifications are Windows 7 64-bit.
My problem is as such:
1) I installed virtualenv using pip:
pip install virtualenv
2) After that I created and activated a new environment:
path/virtualenv env
...
path/to/env/Scripts/activate
3) While running the new environment, I installed django:
(env) path/pip install django
4) After installing successfully, I am ready to make a project. However, upon trying it out:
path/django-admin.py startproject test
I get the following error:
File "C:/path/env/Scripts/django-admin.py", line 2, in (module)
from django.core import management
ImportError: No module named django.core
I have tried out various solutions people have posted, including using the full path:
python C:/path/to/django-admin.py startproject test
I have also checked to make sure the versions of Python it is referencing are correct,as both inside and outside the virtualenv it is associated with Python27. Many other solutions talked about PYTHONPATH or the syspath, however, when I import django or managemnet in the python shell, those work fine.
I have a feeling it may have something to do with the paths, but I'm not sure how a virtualenv interacts with the system paths. Since it is self-contained and the system paths are system wide, is it necessary to have something in the path specifically?
As an aside, my django-admin.py file is in both
path/env/Scripts
and
path/env/Lib/site-packages/django/bin
and the django folder is in
path/env/Lib/site-packages
How to fix this problem?
I solved this problem by using this command as following instead:
django-admin startproject
just remove the ".py" attached to "django-admin"
I could not get any other stack overflow answers to work either. Getting a venved Django stack running on Win64 is a bit of an ordeal.
But, I found an answer that worked for me here: http://samudranb.com/2012/06/02/how-to-setup-a-djangopython-development-env-on-windows/
Try running from an admin command prompt:
ftype Python.File="[your venv path]\Scripts\python.exe" "%1" %*
Just be sure to set it back to the original value when you're done.
This will help you understand why your facing that problem and there is also simple solution for that:
http://blog.jayteebee.org/2009/07/importerror-no-module-named-djangocore.html
I've literally searched for hours to a solution for this issue... I came across this video randomly: (https://www.youtube.com/watch?v=lPmkl4jtYgA) where he put "python .\Script\django-admin.py startproject" into the command prompt while in a virtual environment, so I tried the same with the following modification to point to the correct path on my machine "python .\env\Script\django-admin.py startproject". Voila!
Hopefully this helps someone as it seems there are multiple reasons for this issue.
Windows server 2003 provides the Where command
where python.exe
will show the full path of the current python.exe found on the path, use that to check it's using the correct one for your virtualenv.
The association issue comes into play because running
file.py
so the .py is argv[0] passes it through the windows association, which won't follow your venv.
python file.py
will not find file.py unless it's in the current directory.
So the solution is -
python %VIRTUAL_ENV%\scripts\django-admin.py startproject myproject
This runs python from the current active venv
and uses the venv env variable so it points to the correct location of django-admin.py (or you could give it an absolute path yourself of course)
I had the same problem. I solved that using this command:
(env)C:\environment directory>python Scripts\django-admin.py
This link was helpful for me:
enter link description here
i had the same problem i am running both python 3.4 and 2.7, so i pip installed Django globally on my machine and when i returned to my virtual environment i was able to create a project with no problems.
In Windows, you set:
set PATH=C:\virtualenv\python2.7\Scripts REM Scripts folder contains python.exe, pip.exe, django-admin.exe,...
set PYTHONPATH=C:\virtualenv\python2.7\Lib\site-packages REM site-packages folder contains packages of python such as django,...
After, create project mysite by
django-admin.py startproject mysite
I had this same problem using virtualenv in Terminal in MacOSX (Snow Leopard). My solution to the problem was to change the first line of django-admin.py from
#!/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
to
#!/path-to-your-virtualenv-directory/bin/python
Hope this helps someone.
I had the same problem and the way I resolve it was by activating my project directory before making migrations and running my server "python manage.py runserver".
Activate project Directory: source /path/bin/active
Path meaning where your project is stored.
Had same error and This solved it out for me.
source /path/to/virtualwrapper/activate
pip install django
This fix tries to re-install and configure django
I had the same problem, but I solved it, first I activated the virtual env, then ran:
django-admin.exe startproject project_name

Django extensions error message

Im a django beginner and am using it on a windows machine. Now when i run 'python manage.py runserver', im getting the following message :
"Error: No module named django_extensions"
Any way to fix this ?
Thank You
Look inside your settings.py file under the INSTALLED_APPS setting and delete "django_extensions". Or you can install django_extensions in this environment.
You're testing a Django application right ? (one you didn't write). It seems you miss some dependencies (at least this one).
You might be able to install it throw easy_install or by executing the setup.py of the following package (django-extension).
You also have to check if you have django_extension in your INSTALLED_APPS settings variable, but I'm not quite sure it is needed for django-extension..
Anyway, you might want to install this package : django-extension