Pygithub: Python 2.7 Error - ImportError: cannot import name Github

Created on 11 Oct 2016  ·  16Comments  ·  Source: PyGithub/PyGithub

import github works but nothing seems to be under github. Using Python 2.7.

pip install PyGithub

Thoughts?

Most helpful comment

In the directory you are working in, do you have a file called github.py? (or a folder with an __init__.py inside of it?

All 16 comments

from github import Github is the best way to get started. Check the documentation for some examples of how to use different auth types.

from github import Github will result in an error stating that MainClass doesn't exist.

Hmm, that is very strange, possible that you have conflicting dependencies? Can you list the results of pip freeze?

pip freeze:

prettytable==0.7.2

PyGithub==1.29

requests==2.11.1

On Wed, Oct 12, 2016 at 10:23 AM, Andrew Gross [email protected]
wrote:

Hmm, that is very strange, possible that you have conflicting
dependencies? Can you list the results of pip freeze?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PyGithub/PyGithub/issues/472#issuecomment-253227530,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJPI7AQ-d-K0ux--s9819NQZtMDT0EHks5qzO1IgaJpZM4KTIZ4
.

In the directory you are working in, do you have a file called github.py? (or a folder with an __init__.py inside of it?

Yes sir.

On Wed, Oct 12, 2016 at 10:51 AM, Andrew Gross [email protected]
wrote:

In the directory you are working in, do you have a file called github.py?
(or a folder with an init.py inside of it?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PyGithub/PyGithub/issues/472#issuecomment-253235836,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJPIx7SioI6d7e4qTTN4VZaRIIUtY-Bks5qzPP7gaJpZM4KTIZ4
.

Yes sir, github.py

On Wed, Oct 12, 2016 at 11:27 AM, Anthony Zatelli [email protected]
wrote:

Yes sir.

On Wed, Oct 12, 2016 at 10:51 AM, Andrew Gross [email protected]
wrote:

In the directory you are working in, do you have a file called github.py?
(or a folder with an init.py inside of it?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PyGithub/PyGithub/issues/472#issuecomment-253235836,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJPIx7SioI6d7e4qTTN4VZaRIIUtY-Bks5qzPP7gaJpZM4KTIZ4
.

Yep, that'll do it. Python will try to import from that file first, try changing the name of your local file and it should work.

Awesome! Thank you. :)

On Wed, Oct 12, 2016 at 11:41 AM, Andrew Gross [email protected]
wrote:

Yep, that'll do it. Python will try to import from that file first, try
changing the name of your local file and it should work.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/PyGithub/PyGithub/issues/472#issuecomment-253251162,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJPIyvN4e2IXEfvfN7o-8OD0HisOCSpks5qzP_CgaJpZM4KTIZ4
.

I met the same problem. then I got here. Thank you!

I was facing the similar issue. This helped. Thanks

I met the same problem. then I got here. Thank you!

Thanks @andrewgross

LOL we all got into the github.py trap 🤖

Haaaaaa. yep. Thanks for this!

Just fell into the trap myself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdyaAbhra picture AdyaAbhra  ·  5Comments

men1n2 picture men1n2  ·  6Comments

nchammas picture nchammas  ·  3Comments

BBI-YggyKing picture BBI-YggyKing  ·  5Comments

PeterJCLaw picture PeterJCLaw  ·  6Comments