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
Py3 prints #73
Py3 prints #73
Conversation
In Python 2 I only see two possible solutions to support both versions of Python:
|
Ah, okay, thank you for the explanation. One can include in every file with a print statement at the very beginning the statement: from __future__ import print_function I guess this is the wrapper library you mean? |
Yes. |
@@ -35,4 +36,4 @@ for fname in sys.argv[2:]: | |||
page = doc.importNode(page,1) | |||
container.append(page) | |||
|
|||
print(etree.tostring(doc, pretty_print=True)) | |||
print((etree.tostring(doc, pretty_print=True))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be removed.
Okay, I added the wrapper library to the files. Thus, we can test and discuss this further. |
@@ -61,4 +62,4 @@ for node in dc_nodes: | |||
hnode.attrib['content'] = value | |||
hocr_meta.append(hnode) | |||
|
|||
print(etree.tostring(hocr_doc, pretty_print=True)) | |||
print((etree.tostring(hocr_doc, pretty_print=True))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is also not needed.
@@ -136,6 +137,6 @@ CMGjwvxTsr74/f/F95m3TH9x8o0/TU//N+7/D/ScVcA= | |||
|
|||
if __name__ == "__main__": | |||
if len(sys.argv) == 1: | |||
print("Usage: %s <imgdir>\n" % os.path.basename(sys.argv[0])) | |||
print(("Usage: %s <imgdir>\n" % os.path.basename(sys.argv[0]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, too.
I deleted the three unnecessary brackets. Please have a look at the new version. |
This was done with: 2to3 -wn -f print hocr-*
@zuphilip, I changed the order of the commits and squashed two of them. This avoids unnecessary commits and asserts that the single commits don't break anything. I think that the PR is now ready to get merged. |
Fine for me! Thanks for squashing the commits and reviewing. |
Thank you for this PR. Merged now. |
The
tsht
-tests works for me locally with Python 2 as well as Python 3 and also Travis agreed. However, let us check this carefully and test some more examples.