-
Notifications
You must be signed in to change notification settings - Fork 592
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
[DISCUSSION] Py3k simple #114
Conversation
It's not available on Python 3 (globally, at least.)
This is compatible with both Python 2 and 3.
They aren't supported in Python 3, and in any case, aren't necessary. None of the strings actually contain any Unicode, and due to Python 2's lax str/unicode split don't really need to be.
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 know I wrote this, but just a couple minor comments on things I noticed.
Also note, this isn't full Python 3 support, but just the simple stuff.
@@ -34,14 +36,14 @@ def create_cairo_font_face_for_file(filename, faceindex=0, loadoptions=0): | |||
cairo_t = PycairoContext.from_address(id(cairo_ctx)).ctx | |||
_cairo_so.cairo_ft_font_face_create_for_ft_face.restype = ctypes.c_void_p | |||
if FT_Err_Ok != _freetype_so.FT_New_Face(_ft_lib, filename, faceindex, ctypes.byref(ft_face)): | |||
raise "Error creating FreeType font face for " + filename | |||
raise Exception("Error creating FreeType font face for " + filename) |
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 should probably make this a more specific error.
@@ -493,7 +493,7 @@ def unpickle_find_global(mname,cname): | |||
if mname=="lstm.lstm": | |||
from . import lstm | |||
return getattr(lstm,cname) | |||
if not mname in sys.modules.keys(): | |||
if not mname in sys.modules: |
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.
Should have made this not in
.
@zuphilip, I suggest breaking this into smaller PRs. Some of them are trivial (replacing tabs by spaces) or easy to review (print function) and could be applied soon. That would reduce the complexity a little. |
I just created a new "experimental" branch |
TBH, I felt that all the commits are small enough that they could be reviewed in the commit view of the PR itself (except for the print function one.) |
I just want to mention that there is no way you're going to get models pickled using python 2.7 to deserialize on py3k without writing your very own pickle parser. You can work around most issues but ultimately |
This is meant to be separate branch rather than providing both Py2 & Py3 support. May be we should add a note to readme. |
This contains the commits from https://github.com/QuLogic/ocropy/tree/py3k-simple by @QuLogic. I separate them from the commits for Travis integration and rebase them to current master. Thus, we can discuss this here.