Skip to content
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

Python3 compatibility #30

Merged
merged 2 commits into from
Mar 28, 2019
Merged

Python3 compatibility #30

merged 2 commits into from
Mar 28, 2019

Conversation

mkhon
Copy link
Contributor

@mkhon mkhon commented Jun 8, 2018

I checked only demo_play_with_model.py with pre-built Demo-Europarl-EN.pcl

mkhon added 2 commits June 8, 2018 07:48
- Use io.open instead of codecs.open/codecs.getwriter
- Use input() if raw_input is not available
- Use _pickle if cPickle is not available
- Use print_function from __future__
@ottokart ottokart merged commit a981c1c into ottokart:master Mar 28, 2019
@rhamnett
Copy link

This change breaks punctuator.py

Traceback (most recent call last):
File "/Users/rick/PycharmProjects/punctuator2/punctuator.py", line 149, in
net, _ = models.load(model_file, 1, x)
File "/Users/rick/PycharmProjects/punctuator2/models.py", line 54, in load
from . import models
ImportError: attempted relative import with no known parent package

@ashutosh486
Copy link

ashutosh486 commented Nov 2, 2020

It's better to put:

try:
    from . import models
except ImportError:
    import models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants