任何对使用 PyGithub 模块有任何想法的人。实例化 git 对象时遇到问题。对于我尝试过的任何 URL,问题都是一样的。
from github import Github
g= Github("None", "None", "https://github.com/OpenSCAP")
#g = Github()
g.get_user().name #getting exception right here.
print( g.get_user().name)
for repo in g.get_user().get_repos():
print (repo.name)
下面是回溯。
pydev debugger
Traceback (most recent call last):
File "C:\EasyEclipse-for-Python-1.3.1\plugins\org.python.pydev.debug_1.3.13\pysrc\pydevd.py", line 803, in <module>
debugger.run(setup['file'], None, None)
File "C:\EasyEclipse-for-Python-1.3.1\plugins\org.python.pydev.debug_1.3.13\pysrc\pydevd.py", line 655, in run
execfile(file, globals, locals) #execute the script
File "C:\MyDrive\SecureShield\GitHub\src\mygit.py", line 5, in <module>
g.get_user().name
File "C:\Python27\Lib\site-packages\github\AuthenticatedUser.py", line 221, in name
self._completeIfNotSet(self._name)
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 248, in _completeIfNotSet
self._completeIfNeeded()
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 252, in _completeIfNeeded
self.__complete()
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 257, in __complete
self._url.value
File "C:\Python27\Lib\site-packages\github\Requester.py", line 172, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
File "C:\Python27\Lib\site-packages\github\Requester.py", line 180, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException
挣扎了这么多天。只有首先调用自己(为 Github 对象创建实例)我被卡住了。休息我知道,可能很容易。
当我将 URL 从“ https://github.com/OpenSCAP ”更改为“ http://github.com/OpenSCAP ”时,得到以下回溯。完全不知道这个问题。
pydev debugger
None
Repository(full_name=None)
Traceback (most recent call last):
File "C:\EasyEclipse-for-Python-1.3.1\plugins\org.python.pydev.debug_1.3.13\pysrc\pydevd.py", line 803, in <module>
debugger.run(setup['file'], None, None)
File "C:\EasyEclipse-for-Python-1.3.1\plugins\org.python.pydev.debug_1.3.13\pysrc\pydevd.py", line 655, in run
execfile(file, globals, locals) #execute the script
File "C:\MyDrive\SecureShield\GitHub\src\mygit.py", line 9, in <module>
print (repo.name)
File "C:\Python27\Lib\site-packages\github\Repository.py", line 435, in name
self._completeIfNotSet(self._name)
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 248, in _completeIfNotSet
self._completeIfNeeded()
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 252, in _completeIfNeeded
self.__complete()
File "C:\Python27\Lib\site-packages\github\GithubObject.py", line 257, in __complete
self._url.value
File "C:\Python27\Lib\site-packages\github\Requester.py", line 172, in requestJsonAndCheck
return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
File "C:\Python27\Lib\site-packages\github\Requester.py", line 213, in requestJson
return self.__requestEncode(cnx, verb, url, parameters, headers, input, encode)
File "C:\Python27\Lib\site-packages\github\Requester.py", line 243, in __requestEncode
url = self.__makeAbsoluteUrl(url)
File "C:\Python27\Lib\site-packages\github\Requester.py", line 304, in __makeAbsoluteUrl
if url.startswith("/"):
AttributeError: 'NoneType' object has no attribute 'startswith'
Exception AttributeError: "'NoneType' object has no attribute 'print_exc'" in <function _remove at 0x022C64B0> ignored