JSParser
JSParser copied to clipboard
Python 3.x support (ImportError: No module named 'StringIO')
When running python handler.py
I get the following error:
ImportError: No module named 'StringIO'
I believe this is related to python 3.x
⇒ python --version
Python 3.5.2
May i know any fix available for this?
Use the following:
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
Thanks.After above fix got below error
urlparse
was renamed to urllib.parse
in Python 3.
@EdOverflow Thanks a lot . it worked.
When running python3 handler.py I get the following error:
ModuleNotFoundError: No module named 'StringIO'
I already added this following code in my handler.py and also i changed the urlparse to urllib.parse!
Thanks for advance @EdOverflow
Have you tried just using from io import StringIO
, @Sechunt3r?
@EdOverflow
python3 handler.py
works fine but when I parse urls in the localhostm I get this error
File "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "handler.py", line 198, in post
data = self.parseLinks(url, headers)
File "handler.py", line 184, in parseLinks
file = self.fetchURL(url, headers)
File "handler.py", line 179, in fetchURL
res = sc.execute(url)
File "/opt/JSParser/safeurl.py", line 710, in execute
response = StringIO.StringIO()
AttributeError: type object '_io.StringIO' has no attribute 'StringIO'
ERROR:tornado.access:500 POST /parse/ajax (::1) 73.78ms
hey anyone can help me in these errors. ss attached
@kunal812eee replace import StringIO
to from io import StringIO
root@local:~/JSParser$ python3 handler.py
Traceback (most recent call last):
File "handler.py", line 5, in
Use the following:
try: from StringIO import StringIO except ImportError: from io import StringIO
Thanks it worked
@EdOverflow
python3 handler.py
works fine but when I parse urls in the localhostm I get this errorFile "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute result = method(*self.path_args, **self.path_kwargs) File "handler.py", line 198, in post data = self.parseLinks(url, headers) File "handler.py", line 184, in parseLinks file = self.fetchURL(url, headers) File "handler.py", line 179, in fetchURL res = sc.execute(url) File "/opt/JSParser/safeurl.py", line 710, in execute response = StringIO.StringIO() AttributeError: type object '_io.StringIO' has no attribute 'StringIO' ERROR:tornado.access:500 POST /parse/ajax (::1) 73.78ms
Did you find any solution for this one ?
@EdOverflow
python3 handler.py
works fine but when I parse urls in the localhostm I get this errorFile "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute result = method(*self.path_args, **self.path_kwargs) File "handler.py", line 198, in post data = self.parseLinks(url, headers) File "handler.py", line 184, in parseLinks file = self.fetchURL(url, headers) File "handler.py", line 179, in fetchURL res = sc.execute(url) File "/opt/JSParser/safeurl.py", line 710, in execute response = StringIO.StringIO() AttributeError: type object '_io.StringIO' has no attribute 'StringIO' ERROR:tornado.access:500 POST /parse/ajax (::1) 73.78ms
Did you find any solution for this one ?
Edit both files ( handler.py and safeurl.py) from io import StringIO
@EdOverflow
python3 handler.py
works fine but when I parse urls in the localhostm I get this errorFile "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute result = method(*self.path_args, **self.path_kwargs) File "handler.py", line 198, in post data = self.parseLinks(url, headers) File "handler.py", line 184, in parseLinks file = self.fetchURL(url, headers) File "handler.py", line 179, in fetchURL res = sc.execute(url) File "/opt/JSParser/safeurl.py", line 710, in execute response = StringIO.StringIO() AttributeError: type object '_io.StringIO' has no attribute 'StringIO' ERROR:tornado.access:500 POST /parse/ajax (::1) 73.78ms
Did you find any solution for this one ?
In python 3.7, I edit safeurl.py as following and it work
- import io
- edit line No.710
response = StringIO.StringIO()
toresponse = io.BytesIO()
- edit line No.732
return response.getvalue()
toreturn response.getvalue().decode('utf-8')
Use the following:
try: from StringIO import StringIO except ImportError: from io import StringIO
Hi @EdOverflow Can You please let me know where to paste this snippet?
Thanks.
Have you tried just using
from io import StringIO
, @Sechunt3r?
I tried from io import StringIO
this also then also I am getting error in installing StingIO and I am getting this error while installing StringIO ,
ERROR: Could not find a version that satisfies the requirement StringIO (from versions: none)
ERROR: No matching distribution found for StringIO
can any one help me in installing StingIO
you could use StringIO, but most case BytesIO is correct solution.
Traceback (most recent call last):
File "handler.py", line 250, in
Anyone help me to fix this error
Im getting this type of error
Have you tried just using
from io import StringIO
, @Sechunt3r ?I tried
from io import StringIO
this also then also I am getting error in installing StingIO and I am getting this error while installing StringIO , ERROR: Could not find a version that satisfies the requirement StringIO (from versions: none) ERROR: No matching distribution found for StringIOcan any one help me in installing StingIO
use pip3 install -r requirements.txt
Edit safeurl.py and give try: from StringIO import StringIO except ImportError: from io import StringIO Then edit handler.py and in line 5 replace urlparse with urllib.parse Then replace cgi with html i.e from html import escape This will solve the issue thanks😊
I got the following error:
@ShudarsanRegmi Literally what @Crj777 said. Replace "from cgi import escape" with "from html import scape"
while running python handler.py i get this issue
Traceback (most recent call last):
File "/home/kalki/Desktop/bug_bounty/JSParser/handler.py", line 5, in
How can i fix this?
+1
<iframe+src=x+onload=prompt(1)>