timClicks / slate

The simplest way to extract text from PDFs in Python
http://timmcnamara.co.nz/
GNU General Public License v3.0
428 stars 139 forks source link

Fix slate for Python 3.4+ #32

Open rtouze opened 8 years ago

rtouze commented 8 years ago

I faced some issues while using slate with Python 3.4 and 3.5. It is due to the differences in relative import between python 2 and python 3 which lead to an error in classes.py.

I also updated the tests, the readme and setup.py.

I did not take time to test with Python 2.7 and Python 3 releases prior 3.4 though.

I hope you'll be able to merge. BTW, thanks for your work on this lib!

mvherweg commented 8 years ago

import slate fails for me because it cannot import utils. change import utils in classes.py with from slate import utils and then it worked for me.

benjaminweb commented 7 years ago

Fixes #5 dating back August 5, 2014.

24 is a duplicate of #5.

PR #33 is a duplicate of this PR, the present PR seems but more comprehensive (untested by me).

aron-bordin commented 7 years ago

Hi ! any update on this? I'm facing problems while installing on python 3.6

zlqs1985 commented 7 years ago

I import slate in anaconda python 3.5 environment, with the slate and pdfminer.six package have been installed. Then the following ImportError emerged, so how can I fix it? --updates-- even under python 2.7 , the error remains

import slate
Traceback (most recent call last):

  File "<ipython-input-2-6c5d1974407e>", line 1, in <module>
    import slate

  File "C:\Users\zhanglu\Anaconda3\lib\site-packages\slate\__init__.py", line 48, in <module>
    from slate import PDF

ImportError: cannot import name 'PDF'
jangdan commented 6 years ago

Adding to what @benjaminweb said, #26 and #29 also fix the same import utils issue fixed here.

jangdan commented 6 years ago

This PR has some problems, too; read along...

So I'm trying to try out various Python (Python 3) PDF handling libraries, but slate was too good for me to try out the other ones. Of course, except for the fact that it didn't work with Python 3.6. I am on the latest macOS, using the latest (as of today) Python 3.6.4.

I tried installing slate the normal way through pip, but , as already mentioned in #38, I ran into a setup.py error:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/g6/x78ww6cx6mb_q6ws9_c24xkr0000gp/T/pip-build-v99m2lqm/distribute/

I tried installing the repo directly as @karoldvl in #38 had mentioned, but to no avail, resulting in the same dependency error.

I went through all the issues and PRs present in the repo, and this PR seemed to be the most active, most recently. So I went ahead and tried it, but I ended up with the same error as before. I can't tell if @aron-bordin is mentioning the same issue, but hope this helps.

Then I found a fork of @rtouze's fork(!), here. And interestingly this one fixes the damn setup.py error. Yey. I can clarify that my Python scripts are now pumping out pages and pages of scraped PDFs to the console.

I would suggest that @rtouze, one way or another, apply the changes in the @alkivi-sas repo.

Until then, running

pip install https://github.com/alkivi-sas/slate/tree/python3

installs a working fork of slate (currently).

Cheers.

jangdan commented 3 years ago

@rtouze: Reasons for closing?

rtouze commented 3 years ago

@rtouze: Reasons for closing?

I opened this 4 years ago... Is the project still maintained?