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

cgi escape will not import #97

Open
henrythemouse opened this issue Dec 1, 2020 · 5 comments
Open

cgi escape will not import #97

henrythemouse opened this issue Dec 1, 2020 · 5 comments

Comments

@henrythemouse
Copy link

Hi,

I'm trying to convert my python2 app to python3. It uses mod-python on debian. I have a sid vm that I'm using to experiment with, which supplies mod-python 3.5.0-1+b1.

I've run into an error that seems rooted in python3.8, sid is currently using python3.9.

File "/usr/lib/python3/dist-packages/mod_python/psp.py", line 28, in <module> from cgi import escape ImportError: cannot import name 'escape' from 'cgi' (/usr/lib/python3.9/cgi.py)

I'm writing to see if this has been resolved in the git repo? Or maybe there is a work around? I read online that the program 'supervisor' may have patched this somehow in python3.8. I installed that, but no difference.

Anyone have any idea what I could do?

@wom-bat
Copy link
Contributor

wom-bat commented Feb 4, 2021

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975608 which has a patch attached for the Debian version.

@henrythemouse
Copy link
Author

Thank you, the patch does the trick.

@henrythemouse
Copy link
Author

henrythemouse commented Jul 26, 2021

Just a update concerning this issue,

I decided to compile mod_python. The compile worked fine, as did the install. When I tried to use it, I got the same error that caused me to submit this issue in the fist place. The problem of cgi moving to the html module . It was fixed in apache.py (in the git clone I did for this build), but not in psp.py. I copied the fix from apache.py to psp.py. That fixed this issue.

It would be nice if someone could update the psp.py file in git, Seems like there is still some interest in mod_python.


The psp module had not been updated


-from cgi import escape

+try:
+    from html import escape
+except:
+    from cgi import escape

@grisha
Copy link
Owner

grisha commented Jul 26, 2021

Good catch - could you make a pull request with this change? (If not I'll figure something out - but a pull request will give you proper credit for the fix).

@henrythemouse
Copy link
Author

A pull request (104) was submitted 6 days ago, for a general fix of the cgi issue.
I went ahead and created a new one for this specific issue, hopefully that works for you.
Let me know if I didn't do something correctly, 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

3 participants