0

命令:pypi-server -p 8080 -v ~/packages

2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Bottle v0.13-dev 服务器启动(使用 AutoServer())... 2017-04-12 10:45:11,939|pypiserver.瓶子|INFO|139762541180672|收听http://0.0.0.0:8080/ 2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|按 Ctrl-C 退出。

    Traceback (most recent call last):
  File "/usr/local/bin/pypi-server", line 9, in <module>
    load_entry_point('pypiserver==1.2.0', 'console_scripts', 'pypi-server')()
  File "build/bdist.linux-x86_64/egg/pypiserver/__main__.py", line 296, in main
  File "build/bdist.linux-x86_64/egg/pypiserver/bottle.py", line 3270, in run
  File "build/bdist.linux-x86_64/egg/pypiserver/bottle.py", line 3106, in run
  File "build/bdist.linux-x86_64/egg/pypiserver/bottle.py", line 2876, in run
  File "/usr/local/lib64/python2.6/site-packages/waitress-1.0.1-py2.6.egg/waitress/__init__.py", line 1, in <module>
    from waitress.server import create_server
  File "/usr/local/lib64/python2.6/site-packages/waitress-1.0.1-py2.6.egg/waitress/server.py", line 22, in <module>
    from waitress.adjustments import Adjustments
  File "/usr/local/lib64/python2.6/site-packages/waitress-1.0.1-py2.6.egg/waitress/adjustments.py", line 75, in <module>
    class Adjustments(object):
  File "/usr/local/lib64/python2.6/site-packages/waitress-1.0.1-py2.6.egg/waitress/adjustments.py", line 116, in Adjustments
    listen = ['{}:{}'.format(host, port)]
ValueError: zero length field name in format
4

1 回答 1

4

您使用的是 python 2.6,在这里您需要明确编号格式字段。

对于 python 2.6,您需要将代码更改listen = ['{}:{}'.format(host, port)]listen = ['{0}:{1}'.format(host, port)]

在 python 2.7 '{} {}' 等价于 '{0} {1}' 所以在 python 2.7 中你可以使用listen = ['{}:{}'.format(host, port)],但在 python 2.6 中不能。

于 2017-04-12T05:39:28.070 回答