which leads to an ImportError on running python-django-open-project
Details:
Error executing: /home/fritz/.pyvenvs/intranet/bin/python -c "
from __future__ import print_function
import os
import sys
from os.path import dirname, abspath
stdout = sys.stdout; stderr = sys.stderr
sys.stdout = sys.stderr = open(os.devnull, 'w')
from django.conf import settings
# Try to import json really hard
try:
import json
except ImportError:
from django.utils import simplejson as json
# Force settings loading so all output is sent to devnull.
settings.DEBUG
sys.stdout = stdout; sys.stderr = stderr
app_paths = {}
for app in settings.INSTALLED_APPS:
mod = __import__(app)
if '.' in app:
for sub in app.split('.')[1:]:
mod = getattr(mod, sub)
app_paths[app] = dirname(abspath(mod.__file__))
print(json.dumps(app_paths), end='')"
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 20, in <module>
ImportError: No module named 'rules.apps.AutodiscoverRulesConfig'; 'rules.apps' is not a package
I'm not quite sure if this is good practice on django-rules' part or not, but would appreciate your help if there's an easy solution.
For the time being, I use a dirty hack
"app_paths = {}\n"
"for app in settings.INSTALLED_APPS:\n"
" if 'rules' in app.split('.'):\n"
" app = 'rules'\n"
" ..."
django-rules (https://github.com/dfunckt/django-rules/) recommends loading the packages with
which leads to an ImportError on running python-django-open-project
I'm not quite sure if this is good practice on django-rules' part or not, but would appreciate your help if there's an easy solution. For the time being, I use a dirty hack
Regards