python pypi:当指向某个回购时,ConfigParser会爆炸

时间:2017-03-24 13:59:52

标签: python pypi

我有一个包(名字很差)python-reusable,我试图上传到PyPi存储库。我可以将它上传到另一个存储库,但是当我尝试上传到这个特定的存储库时,我得到了一个堆栈跟踪:

running sdist
running egg_info
writing requirements to python_reusable.egg-info/requires.txt
writing python_reusable.egg-info/PKG-INFO
writing top-level names to python_reusable.egg-info/top_level.txt
writing dependency_links to python_reusable.egg-info/dependency_links.txt
reading manifest file 'python_reusable.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_reusable.egg-info/SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt

running check
creating python_reusable-0.2.0

[redacted]
....

Writing python_reusable-0.2.0/setup.cfg
Creating tar archive
removing 'python_reusable-0.2.0' (and everything under it)
running register
Traceback (most recent call last):
  File "setup.py", line 19, in <module>
    install_requires=reqs
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/register.py", line 10, in run
    orig.register.run(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/register.py", line 46, in run
    self._set_config()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/register.py", line 72, in _set_config
    config = self._read_pypirc()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/config.py", line 76, in _read_pypirc
    current['username'] = config.get(server, 'username')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py", line 607, in get
    raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'global'

当我尝试将其上传到另一个pypi服务器时,它可以工作:

Writing python_reusable-0.2.0/setup.cfg
Creating tar archive
removing 'python_reusable-0.2.0' (and everything under it)
running register
Registering python_reusable to [REDACTED]
Server response (200): OK
running upload
Submitting dist/python_reusable-0.2.0.tar.gz to [REDACTED]
Server response (200): OK

如果服务器或.pypirc出现问题,我觉得错误应该传播,所以我知道发生了什么。那么,发生了什么?

我自己不在这个包中的任何地方使用ConfigParser。

1 个答案:

答案 0 :(得分:0)

原来这是distutils中的一个错误。会在那里提出问题。

我的.pypirc

[distutils]
index-servers = 
    exists
    not_in_this_file

[exists]
    ...

#nothing else

我认为在distuitl中有一个未被捕获的例外,它没有检测到mising not_in_this_file部分。