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

Add Python 3 support without droping Python 2 support #9

Merged
merged 1 commit into from Mar 13, 2015

Conversation

Projects
None yet
2 participants
@Sr4l
Contributor

Sr4l commented Nov 18, 2014

Hi,
These changes make the library running with Python 2 and 3. I think the commit messages are self-explanatory. So please test it and consider to merge it.

@jbochi

This comment has been minimized.

Collaborator

jbochi commented Mar 11, 2015

@Sr4l Sorry for taking so long to review this. The patch looks awesome, but it does not merge cleanly anymore. Are you willing to rebase (and maybe squash) your commits?

@Sr4l Sr4l force-pushed the Sr4l:master branch 5 times, most recently from 7841364 to d68c91e Mar 11, 2015

@Sr4l

This comment has been minimized.

Contributor

Sr4l commented Mar 11, 2015

@jbochi Done.
But there a two things to consider:

  1. To be 100% correct there should be a from __future__ import print_function in the second line of pytesteract.py, but this will definitely break Python 2.5 support. As long as print stays something like print(str) we are fine.
  2. I only tested the code with Python 2.7 and 3.4 on Ubuntu 14.04
use prefered tempfile.NamedTemporaryFile (needs python >= 2.3) instea…
…d of os.tempnam

drop StringIO import and sys.stderr workarround
change from file() to open() for open a file

make print statement a function, this make the code working with python 2 and 3
update README and comments in python source file

update setup.py to represent python2 and 3 support, jump to version 0.2

Update README and comments to use both `import Image` and `from PIL import Image`

add myself to CONTRIBUTERS

`from pytesseract import image_to_string` work in python2 and 3 in my virtual env, but it doesn't on systemwide installations in python3

@Sr4l Sr4l force-pushed the Sr4l:master branch from d68c91e to a98627d Mar 12, 2015

jbochi added a commit that referenced this pull request Mar 13, 2015

Merge pull request #9 from Sr4l/master
Add Python 3 support without droping Python 2 support

@jbochi jbochi merged commit a7b27c8 into madmaze:master Mar 13, 2015

@jbochi

This comment has been minimized.

Collaborator

jbochi commented Mar 13, 2015

Thanks @Sr4l !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment