ppwwyyxx/SoPaper

Syntax Error

clwgg opened this issue · 6 comments

clwgg commented

Hi,
I get the following error whenever I try to run sopaper:

Traceback (most recent call last):
  File "/home/clw/.local/bin/sopaper", line 11, in <module>
    load_entry_point('sopaper==0.8', 'console_scripts', 'sopaper')()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/clw/.local/lib/python3.7/site-packages/sopaper/__main__.py", line 23, in <module>
    from sopaper import searcher
  File "/home/clw/.local/lib/python3.7/site-packages/sopaper/searcher/__init__.py", line 8, in <module>
    from ..lib.ukutil import import_all_modules
  File "/home/clw/.local/lib/python3.7/site-packages/sopaper/lib/ukutil.py", line 76
    print check_filetype(open("./ukconfig.py").read(), 'PDF')
                       ^
SyntaxError: invalid syntax

I think I have all packages installed (see below), and have had this error now on two independent systems (Ubuntu 16.04 and ArchLinux). Any help would be appreciated.

Some more info on packages:

Package        Version 
-------------- --------
beautifulsoup4 4.7.1   
certifi        2019.3.9
chardet        3.0.4   
idna           2.8     
requests       2.21.0  
sopaper        0.8     
soupsieve      1.9.1   
termcolor      1.1.0   
urllib3        1.24.3  

extra/poppler 0.76.0-1 [installed]
    PDF rendering library based on xpdf 3.0
extra/poppler-data 0.4.9-1 [installed]
    Encoding data for the poppler PDF rendering library
extra/poppler-glib 0.76.0-1 [installed]
clwgg commented

After taking a second look, the problem is probably the print statement which uses python2 syntax while I am using python3. I suppose the project is intended to be used with python2?

Yes. This is a python2 project.

clwgg commented

alright, thanks for the confirmation! It might be helpful for others to display that more prominently in the README.

Do you have any plans of making it compatible with python3? I don't personally use python a lot and have no experience in how much effort that'd be, so please excuse my ignorance. Are there many other incompatibilities other than print ?

Wish you wrote the project with python3 :)

Fixed by #13

stas-g commented

i had this problem which got fixed by installing sopaper in a dedicated python 2 conda env.