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

Cannot import name 'soft_unicode' from 'markupsafe' #45

Closed
RamiSouai opened this issue Feb 21, 2022 · 3 comments
Closed

Cannot import name 'soft_unicode' from 'markupsafe' #45

RamiSouai opened this issue Feb 21, 2022 · 3 comments
Assignees

Comments

@RamiSouai
Copy link

requirements.txt:
HiYaPyCo==0.4.16

The latest version of markupsafe has removed soft_unicode resulting in the following error:

ImportError while importing test module '/home/runner/work/secureCodeBox/secureCodeBox/scanners/zap-advanced/scanner/tests/test_zap_configuration.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.9.10/x[64](https://github.com/secureCodeBox/secureCodeBox/runs/5255972111?check_suite_focus=true#step:5:64)/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_zap_configuration.py:14: in <module>
    from zapclient.configuration.zap_configuration import ZapConfiguration
zapclient/__init__.py:12: in <module>
    from .zap_abstract_client import ZapClient
zapclient/zap_abstract_client.py:15: in <module>
    from .configuration import ZapConfiguration
zapclient/configuration/__init__.py:12: in <module>
    from .zap_configuration import ZapConfiguration
zapclient/configuration/zap_configuration.py:12: in <module>
    import hiyapyco
/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/hiyapyco/__init__.py:30: in <module>
    from jinja2 import Environment, Undefined, DebugUndefined, StrictUndefined, TemplateError
/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/jinja2/__init__.py:12: in <module>
    from .environment import Environment
/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/jinja2/environment.py:25: in <module>
    from .defaults import BLOCK_END_STRING
/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/jinja2/defaults.py:3: in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/jinja2/filters.py:13: in <module>
    from markupsafe import soft_unicode
E   ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/hostedtoolcache/Python/3.9.10/x64/lib/python3.9/site-packages/markupsafe/__init__.py)
@komitor
Copy link

komitor commented Feb 22, 2022

Encountered the same issue. This is coming from the dependency "Jinja2>1,<3". As they are already in Version 3, I am not sure if they will release a hotfix for this.

Local workaround:
Add MarkupSafe 2.0.1 to local dependencies

Workaround for this project to still work:
Add MarkupSafe 2.0.1 to dependencies

@M-Bab
Copy link

M-Bab commented Apr 26, 2022

This is already fixed in this repo but the release of 0.4.17 did not happen yet. Therefore this workaround works as well:

pip install HiYaPyCo@git+https://github.com/zerwes/hiyapyco

After that you are free to install jinja2 in version 3.

@zerwes
Copy link
Owner

zerwes commented May 9, 2022

Finally release 0.5.0 is out.
https://pypi.org/project/HiYaPyCo/0.5.0/

Sorry for the delay!
There where several issues with the build and release steps.
So I had to drop python 2 support to get this all working again.
Due to the major change of sunsetting python 2 support, I decided to use a new (minor) release number.

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

4 participants