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

Syntax Error Py2.7 #27

Open
Sicks3c opened this issue Jul 29, 2019 · 5 comments
Open

Syntax Error Py2.7 #27

Sicks3c opened this issue Jul 29, 2019 · 5 comments

Comments

@Sicks3c
Copy link

Sicks3c commented Jul 29, 2019

Hello

I have an issue concerning JSParser
1 - I Cloned the repo
2 - python setup.py install
3 - pip install -r -requirements.txt
4 - python handler.py
The error

Traceback (most recent call last):
  File "handler.py", line 2, in <module>
    import tornado.ioloop, tornado.web, tornado.autoreload
  File "/usr/lib/python2.7/dist-packages/tornado/ioloop.py", line 52, in <module>
    from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info, future_add_done_callback  # noqa: E501
  File "/usr/lib/python2.7/dist-packages/tornado/concurrent.py", line 48, in <module>
    import asyncio
  File "/usr/local/lib/python2.7/dist-packages/asyncio/__init__.py", line 9, in <module>
    from . import selectors
  File "/usr/local/lib/python2.7/dist-packages/asyncio/selectors.py", line 39
    "{!r}".format(fileobj)) from None
                               ^
SyntaxError: invalid syntax

What I Tried

sudo pip install --upgrade {packages} ...

Same issue

I'm using

Kali2-amd64 4.18.0
Python version 2.7.16

@Sicks3c
Copy link
Author

Sicks3c commented Jul 29, 2019

I tried to switch to py3

and did these
Tried py3 I changed urlparse to urllib.parse and also
from StringIO import StringIO
because of
ImportError: No module named 'StringIO'
Works like charm
No syntax error but when I put js link via localhost and press JSParse
I get this

HTTPServerRequest(protocol='http', host='localhost:8008', method='POST', uri='/parse/ajax', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  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 714, in execute
    response = StringIO.StringIO()
AttributeError: type object '_io.StringIO' has no attribute 'StringIO'
ERROR:tornado.access:500 POST /parse/ajax (::1) 75.82ms

Any solution ?

@realsdx
Copy link

realsdx commented Aug 18, 2019

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

@NinjaMinjax
Copy link

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

I can confirm. It works with your solution.

@D0N-B0T
Copy link

D0N-B0T commented Dec 6, 2019

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

stil lhave the problem.

@B1gD4ddy
Copy link

ERROR: Package 'tornado' requires a different Python 2.7.17 not in '>= 3.5' .

Problem solve:
#pip install 'tornado<=5.1'

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

5 participants