Site Not creating on server - Please help

The Python module ‘MarkupSafe’, prior to version 2.1, had renamed the function ‘soft_unicode’ to ‘soft_str’. During the deprecation time period they had a mapper function from soft_unicode to soft_str. As of version 2.1 of MarkupSafe that mapper function was dropped.

Here is what I did to fix it. Locate the folder where you ran ‘bench init’. For me it was /srv/bench. Since I am using Debian Buster (10) the version of Python is 3.7. Then do this…

nano /srv/bench/erpnext/env/lib/python3.7/site-packages/markupsafe/__init__.py

At the bottom of the file, just above the try/catch block insert the following…

def soft_unicode(s: t.Any) -> str:
    import warnings

    warning_message = "'soft_unicode' has been renamed to 'soft_str'. It has been removed in MarkupSafe 2.1. It has been temporarily reinserted by a third party."
    warnings.warn(warning_message,DeprecationWarning,stacklevel=2,)

    return soft_str(s)

Then perform the following…

bench drop-site [site name]
bench  new-site [site name]

That should do it until the frappe/bench/ERPNext folks change the code to point to the new name of soft_str.

4 Likes