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

Flask-Babel or Flask-BabelEx is installed but not initialized #434

Open
fsxchen opened this issue Jun 28, 2021 · 13 comments
Open

Flask-Babel or Flask-BabelEx is installed but not initialized #434

fsxchen opened this issue Jun 28, 2021 · 13 comments

Comments

@fsxchen
Copy link

fsxchen commented Jun 28, 2021

Issue Type

  • Bug Re port

Faraday version

Paste the output of the ./faraday.py --version command
Faraday v3.15.0

Component Name

Steps to reproduce

sudo faraday-server --debug

then I use browser,I get

ValueError: Flask-Babel or Flask-BabelEx is installed but not initialized
2021-06-28T04:41:15-0400 - faraday.server.app - ERROR {PoolThread-twisted.internet.reactor-1} [pid:10537] [app.py:1891 - log_exception()] Exception on /session [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1945, in full_dispatch_request
self.try_trigger_before_first_request_functions()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1993, in try_trigger_before_first_request_functions
func()
File "/usr/local/lib/python3.9/dist-packages/Flask_Security_Too-4.0.1-py3.9.egg/flask_security/core.py", line 1164, in check_babel
raise ValueError(
ValueError: Flask-Babel or Flask-BabelEx is installed but not initialized

Expected results

What did you expect to happen when following the steps above?

Debugging tracebacks (current results)

Try to reproduce the bug with the server and/or gtk client in debug mode and check the logs for the ERROR string.
Add here any errors you find while running in debug mode or, if possible, Faraday’s log files (located at $HOME/.faraday/logs/).

If you need help on how to execute in debug mode click here for more information.

Please attach the result of:

pip freeze > requirements_freeze.txt

Screenshots

If you don't find anything on the logs, please provide screenshots of the error.

Environment information

Configuration files

Mention any settings you have changed/added/removed.

Reports/Extra data

If you are having issues with plugins, please attach relevant files if possible.
(strip your reports of all sensitive information beforehand).

OS

Linux kali 5.9.0-kali1-amd64 #1 SMP Debian 5.9.1-1kali2 (2020-10-29) x86_64 GNU/Linux

@aenima-x
Copy link
Contributor

uninstall Flask-Babel and Flask-BabelEx
Those are no longer dependencies

@Immucrepal
Copy link

Trying sudo apt-get purge --auto-remove python-flask-babel
Nothing changed. I still have the same issue.
Is there something else to do for uninstalling those packages ?

@aenima-x
Copy link
Contributor

@fsxchen they are python packages.
Use pip

@Immucrepal
Copy link

I've uninstalled these packages. pip list doesn't give them.
I then uninstall Babel python module. Then I got the same issue.

I've got this error log :
2021-06-28T17:27:42-0400 - faraday.server.app - ERROR {PoolThread-twisted.internet.reactor-0} [pid:91568] [app.py:1891 - log_exception()] Exception on /config [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1945, in full_dispatch_request
self.try_trigger_before_first_request_functions()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1993, in try_trigger_before_first_request_functions
func()
File "/usr/lib/python3/dist-packages/flask_security/core.py", line 1155, in check_babel
raise ValueError(
ValueError: Flask-Babel or Flask-BabelEx is installed but not initialized

@aenima-x
Copy link
Contributor

aenima-x commented Jun 29, 2021

@fsxchen can you attach your pip freeze

@Immucrepal
Copy link

alabaster==0.7.12
astroid==2.5.6
attrs==21.2.0
bleach==3.3.0
certifi==2021.5.30
cffi==1.14.5
chardet==4.0.0
click==8.0.1
colorama==0.4.4
configobj==5.0.6
coverage==5.5
cryptography==3.4.7
docutils==0.17.1
factory-boy==3.2.0
Faker==8.8.2
Flask==2.0.1
hypothesis==6.14.0
idna==2.10
imagesize==1.2.0
importlib-metadata==4.6.0
inflection==0.5.1
isort==5.9.1
itsdangerous==2.0.1
jeepney==0.6.0
Jinja2==3.0.1
keyring==23.0.1
lazy-object-proxy==1.6.0
MarkupSafe==2.0.1
mccabe==0.6.1
more-itertools==8.8.0
packaging==20.9
pkginfo==1.7.0
pluggy==0.13.1
py==1.10.0
pyasn1==0.4.8
pycparser==2.20
Pygments==2.9.0
pylint==2.8.3
pyparsing==2.4.7
pytest==5.4.3
pytest-cov==2.12.1
pytest-factoryboy==2.1.0
python-dateutil==2.8.1
pytz==2021.1
pytzdata==2020.1
PyYAML==5.4.1
readme-renderer==29.0
requests==2.25.1
requests-toolbelt==0.9.1
responses==0.13.3
rfc3986==1.5.0
SecretStorage==3.3.1
six==1.16.0
snowballstemmer==2.1.0
sortedcontainers==2.4.0
soupsieve==2.2.1
Sphinx==4.0.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
SQLAlchemy==1.3.24
sqlparse==0.4.1
tabulate==0.8.9
terminaltables==3.1.0
text-unidecode==1.3
toml==0.10.2
tqdm==4.61.1
twine==3.4.1
urllib3==1.26.6
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.1
wrapt==1.12.1
WTForms==2.3.3
zipp==3.4.1

@Immucrepal
Copy link

I've reinstalled Faraday with the last release on a Kali linux and I got the same errors :
File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1945, in full_dispatch_request
self.try_trigger_before_first_request_functions()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1993, in try_trigger_before_first_request_functions
func()
File "/usr/lib/python3/dist-packages/flask_security/core.py", line 1155, in check_babel
raise ValueError(

I desinstalled Babel python package with the command below :
python3 -m pip uninstall Babel

After restarting the server, I got the same error.

Very wierd !

@aenima-x
Copy link
Contributor

aenima-x commented Jul 2, 2021

@fsxchen did you notice that faraday is not in that list??
you have a problem with your envirement.
The python environment that is running faraday is not the same of that pip

@Immucrepal
Copy link

You're right !
Here is the pip freeze command result in the good environment

alabaster==0.7.12
alembic==1.6.5
anyascii==0.2.0
apispec==4.7.0
apispec-webframeworks==0.5.2
astroid==2.6.2
attrs==21.2.0
autobahn==21.3.1
Automat==20.2.0
bcrypt==3.2.0
beautifulsoup4==4.9.3
bleach==3.3.0
blinker==1.4
certifi==2021.5.30
cffi==1.14.5
chardet==4.0.0
cli-helpers==2.1.0
click==8.0.1
colorama==0.4.4
configobj==5.0.6
constantly==15.1.0
coverage==5.5
cryptography==3.4.7
distro==1.5.0
dnspython==2.1.0
docutils==0.17.1
email-validator==1.1.3
factory-boy==3.2.0
Faker==8.9.0
faraday-agent-parameters-types==1.0.0
faraday-plugins==1.5.0
faradaysec @ file:///home/kali/soft/faraday
filedepot==0.8.0
filteralchemy-fork==0.1.0
Flask==2.0.1
Flask-Classful==0.14.2
Flask-KVSession-fork==0.6.3
Flask-Limiter==1.4
Flask-Login==0.5.0
Flask-Mail==0.9.1
Flask-Principal==0.4.0
Flask-Security-Too==4.0.1
Flask-SQLAlchemy==2.5.1
Flask-WTF==0.15.1
html2text==2020.1.16
hyperlink==21.0.0
hypothesis==6.14.0
idna==2.10
imagesize==1.2.0
importlib-metadata==4.6.0
incremental==21.3.0
inflection==0.5.1
isort==5.9.1
itsdangerous==2.0.1
jeepney==0.6.0
Jinja2==3.0.1
keyring==23.0.1
lazy-object-proxy==1.6.0
limits==1.5.1
lxml==4.6.3
Mako==1.1.4
MarkupSafe==2.0.1
marshmallow==3.12.1
marshmallow-sqlalchemy==0.25.0
mccabe==0.6.1
more-itertools==8.8.0
nplusone==1.0.0
packaging==20.9
passlib==1.7.4
pendulum==2.1.2
pgcli==3.1.0
pgspecial==1.13.0
Pillow==8.3.0
pkginfo==1.7.0
pluggy==0.13.1
prompt-toolkit==3.0.19
psycopg2==2.9.1
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
Pygments==2.9.0
pylint==2.9.3
pyOpenSSL==20.0.1
pyotp==2.6.0
pyparsing==2.4.7
pytest==5.4.3
pytest-cov==2.12.1
pytest-factoryboy==2.1.0
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2021.1
pytzdata==2020.1
PyYAML==5.4.1
readme-renderer==29.0
requests==2.25.1
requests-toolbelt==0.9.1
responses==0.13.3
rfc3986==1.5.0
SecretStorage==3.3.1
service-identity==21.1.0
setproctitle==1.2.2
simplejson==3.17.2
simplekv==0.14.1
six==1.16.0
snowballstemmer==2.1.0
sortedcontainers==2.4.0
soupsieve==2.2.1
Sphinx==4.0.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
SQLAlchemy==1.3.24
sqlparse==0.4.1
syslog-rfc5424-formatter==1.2.2
tabulate==0.8.9
terminaltables==3.1.0
text-unidecode==1.3
toml==0.10.2
tqdm==4.61.1
twine==3.4.1
Twisted==21.2.0
txaio==21.2.1
urllib3==1.26.6
wcwidth==0.2.5
webargs==8.0.0
webencodings==0.5.1
Werkzeug==2.0.1
wrapt==1.12.1
WTForms==2.3.3
zipp==3.4.1
zope.interface==5.4.0

@aenima-x
Copy link
Contributor

aenima-x commented Jul 4, 2021

@fsxchen Ok now this makes more sense.
But still there is not Babel, I dont know that to tell you.
That is a known problem when some of those packages are found.

I suggest you to install it from the github repo, not the kali version

@s0i37
Copy link

s0i37 commented Jul 22, 2021

Just comment this check in /usr/local/lib/python3.9/dist-packages/flask_security/core.py:

if have_babel() and "babel" not in app.extensions and 0:

And all should be fine.

@thedigitalempress
Copy link

Now I followed this thread and uninstalled flask and babel and now i'm getting this error when running the server:

File "/usr/lib/python3/dist-packages/flask_login/login_manager.py", line 12, in
from flask import (_request_ctx_stack, abort, current_app, flash, redirect,
ModuleNotFoundError: No module named 'flask'

And I keep getting this error when running the client:
2021-08-17T09:55:44-0400 - faraday_client.start_client - ERROR {MainThread} [start_client.py:369 - login()] Faraday server returned invalid response: 500

@ezk06eer
Copy link

@thedigitalempress you should do:
pip install flask
comment this check in
/usr/local/lib/python3.9/dist-packages/flask_security/core.py:

if have_babel() and "babel" not in app.extensions and 0:

this is not estrictly inherited from our code but from flask_security itself in the kali version.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants