首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >运行pypi-server时获取ValueError:格式为零长度的字段名

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

Stack Overflow用户
提问于 2017-04-12 13:25:19
回答 1查看 133关注 0票数 0

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

2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Bottle v0.13-开发服务器正在启动(使用AutoServer())...2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Listening on Ctrl 2017-04-12 10:45:11,939|pypiserver.bottle|INFO|139762541180672|Hit http://0.0.0.0:8080/ -C退出。

代码语言:javascript
运行
复制
    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
EN

回答 1

Stack Overflow用户

发布于 2017-04-12 13:39:28

您使用的是python 2.6,这里您需要显式地对格式字段进行编号。

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

Python2.7中的

'{} {}‘等同于'{0} {1}’,因此在Python2.7中可以使用listen = ['{}:{}'.format(host, port)],但在Python2.6中不能。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43360936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档