Navigation Menu

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

Do not implicit relative import #82

Merged
merged 2 commits into from Dec 5, 2016
Merged

Conversation

narusemotoki
Copy link
Contributor

@narusemotoki narusemotoki commented Dec 3, 2016

Weekly cleanup

Implicit relative importing does not work with Python 3.
This is the reason why gengo-python cannot install via pip for Python 3.

I combined my another pull request, because it is inconvenient that test file is in main package for this change. But I removed coverage, because it does not work with Python 3.2.
#81

Now it works with Python 3.

% python
Python 3.5.1+ (default, Mar 30 2016, 22:46:26) 
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gengo
>>> gengo.Gengo('public', 'private')                                                                                                                                                                                                                                                       
<gengo.gengo.Gengo object at 0x7fa25a608fd0>

And Python 2.

% python
Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gengo
>>> gengo.Gengo('public', 'private')
<gengo.gengo.Gengo object at 0x7feb24d7e9d0>

Before changes:

% python
Python 3.5.1+ (default, Mar 30 2016, 22:46:26) 
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gengo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/motoki/workspace/gengo-python/gengo/__init__.py", line 34, in <module>
    from gengo import Gengo, GengoError, GengoAuthError
ImportError: cannot import name 'Gengo'

Weekly cleanup

Implicit relative importing does not work with Python 3.
This is the reason why gengo-python cannot install via pip for Python 3.
We don't need to distribute test file. So I exclude it from main package.
Also I changed testing method. We can see colored result.
@hayate
Copy link
Contributor

hayate commented Dec 3, 2016

great job @narusemotoki 🙇‍♂️
LGTM

@trinchan
Copy link

trinchan commented Dec 5, 2016

LGTM

@narusemotoki narusemotoki merged commit b0759c1 into master Dec 5, 2016
@narusemotoki narusemotoki deleted the implicit_relative_importing branch December 5, 2016 09:10
narusemotoki added a commit that referenced this pull request Jan 4, 2017
Python 3 doesn't support relative import. This is one of the reasons,
gengo-python doesn't work with Python 3. The problem was solved with this pull
request. #82

I forgot to add this change in my above pull request. With that line, we can
force to use absolute import.
@narusemotoki narusemotoki mentioned this pull request Jan 4, 2017
narusemotoki added a commit that referenced this pull request Jan 4, 2017
Python 3 doesn't support relative import. This is one of the reasons,
gengo-python doesn't work with Python 3. The problem was solved with this pull
request. #82

I forgot to add this change in my above pull request. With that line, we can
force to use absolute import.
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

3 participants