thinkst / opencanary

Modular and decentralised honeypot
http://opencanary.org
BSD 3-Clause "New" or "Revised" License
2.31k stars 360 forks source link

Failed to load application: cannot import name 'soft_unicode' from 'markupsafe' #179

Closed konstantia86 closed 2 years ago

konstantia86 commented 2 years ago

10 days ago, markupsafe was upgraded to a new version and soft_unicode was removed. I have tried downgrading the markupsafe version to the last known working version (2.0.1) with no luck. Any advice?

konstantia86 commented 2 years ago

After a quick investigation, the soft_unicode function was replaced by soft_str. (https://markupsafe.palletsprojects.com/en/2.1.x/changes/)

NoGoCodeHunter commented 2 years ago

@konstantia86 Sorry to be so daft, but in what CONF file do I need to update it from soft_unicode to soft_str?

jayjb commented 2 years ago

Hi @konstantia86,

Thats super strange. The workaround I used was to downgrade using pip install MarkupSafe==2.0.1 which works for me.

Would you mind letting me know which version of python you using?

HybridAU commented 2 years ago

Just adding that this is the same bug as #177 and can also be fixed by a pull request that updates Jinja2 because the new version of Jinja2 doesen't soft_unicode anymore

konstantia86 commented 2 years ago

@konstantia86 Sorry to be so daft, but in what CONF file do I need to update it from soft_unicode to soft_str?

I actually don't know because I am not that familiar with the whole project structure.

konstantia86 commented 2 years ago

Hi @konstantia86,

Thats super strange. The workaround I used was to downgrade using pip install MarkupSafe==2.0.1 which works for me.

Would you mind letting me know which version of python you using?

Yes, I did this too, and actually it is better to use pip install -Iv markupsafe==2.0.1, to force the installation of the specific version and it worked. However, this needs to be fixed in the code because it may cause more problems in the future, when for instance v2.0.1 will become deprecated. For the record, I used Python 3.7.

NoGoCodeHunter commented 2 years ago

Okay, so downgrading markupsafe seems to have resolved the issue. Python = 3.8.10 MarkupSafe = 2.0.1

For those having an issue here is what I did in case it helps:

Once you are in in the virtual environment:

pip uninstall markupsafe
pip install -Iv markupsafe==2.0.1

Once ran, I was able to start the 'opencanaryd'. Thanks to @konstantia86 and Good Luck.

manincharge commented 2 years ago

You can also replace instances of soft_unicode with soft_str. I think I only found 3-4 references in the code.

jayjb commented 2 years ago

Fixed in new released version as we upgraded Jinja.