简体   繁体   English

在运行pypi-server时获取ValueError:格式为零长度的字段名称

[英]While running pypi-server getting ValueError: zero length field name in format

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

2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Bottle v0.13-dev server starting up (using AutoServer())... 2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Listening on http://0.0.0.0:8080/ 2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Hit Ctrl-C to quit. 2017-04-12 10:45:11,939 | pypiserver.bottle | INFO | 139762541180672 | Bottle v0.13-dev服务器正在启动(使用AutoServer())... 2017-04-12 10:45:11,939 | pypiserver。 bottle | 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

You are using python 2.6, here you need to explicitly number the format fields. 您正在使用python 2.6,在这里您需要显式编号格式字段。

For python 2.6 you need to change your code listen = ['{}:{}'.format(host, port)] to listen = ['{0}:{1}'.format(host, port)] 对于python 2.6,您需要更改代码listen = ['{}:{}'.format(host, port)]listen = ['{0}:{1}'.format(host, port)]

In python 2.7 '{} {}' is equivalent to '{0} {1}' so in python 2.7 you can use listen = ['{}:{}'.format(host, port)] , but not in python 2.6. 在python 2.7中,'{} {}'等价于'{0} {1}',因此在python 2.7中,您可以使用listen = ['{}:{}'.format(host, port)] ,但在python中不能使用2.6。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM