Skip to content
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

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' #8

Closed
admvateam opened this issue Dec 10, 2019 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@admvateam
Copy link

File "/root/Nessus_Map/Nessus_Map/urls.py", line 6, in
from . import views
File "/root/Nessus_Map/Nessus_Map/views.py", line 3, in
from filebrowser.base import FileListing
File "/usr/local/lib/python3.7/dist-packages/filebrowser/base.py", line 11, in
from django.utils.encoding import python_2_unicode_compatible, force_text
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/usr/local/lib/python3.7/dist-packages/django/utils/encoding.py)

Hello,
I've install "pip3 install django-filebrowser==3.11.1" and them get this error

@Anon-Exploiter
Copy link
Member

@admvateam have you tried using virtual environment?

Try out the following: Anon-Exploiter/SiteBroker#4 (comment)

In virtualenv's command, replace it to python3 and then do pip3 install -r requirements.txt again after activating the environment.

@admvateam
Copy link
Author

Hello Anon-Exploiter,
The error have when exec
python3 manage.py runserver

This is the complete error

_root@kali2:~/Nessus_Map# python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.7/dist-packages/django/core/management/base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/usr/local/lib/python3.7/dist-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/usr/local/lib/python3.7/dist-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/dist-packages/django/urls/resolvers.py", line 587, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.7/dist-packages/django/utils/functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "/usr/local/lib/python3.7/dist-packages/django/urls/resolvers.py", line 580, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "/root/Nessus_Map/Nessus_Map/urls.py", line 6, in
from . import views
File "/root/Nessus_Map/Nessus_Map/views.py", line 3, in
from filebrowser.base import FileListing
File "/usr/local/lib/python3.7/dist-packages/filebrowser/base.py", line 11, in
from django.utils.encoding import python_2_unicode_compatible, force_text
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/usr/local/lib/python3.7/dist-packages/django/utils/encoding.py)

@Anon-Exploiter
Copy link
Member

Hey @admvateam , I completely understand the error. Have you tried the solution I provided above? Using virtualenv? It works perfectly fine with that.

Also, this is not a bug in the script, its an issue on your side. Please don't create issues for such things, and google before filing an issue.

Here's a screenshot showing vanilla installation with a virtual environment created on an AWS instance.


image

@Anon-Exploiter Anon-Exploiter added the help wanted Extra attention is needed label Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants