2017-04-12 34 views
0

命令:PyPI將服務器-p 8080 -v〜/包在運行的PyPI服務器獲取ValueError異常:在格式零長度字段名稱

2017年4月12日10:45:11939 | pypiserver.bottle |信息| 139762541180672 |啓動瓶子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 

回答

4

你正在使用python 2.6,在這裏你需要明確的編號格式字段。

對於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.

+0

@邁克爾:你嘗試過'聽= '{0}:{1}'。格式(主機,端口)]'在'waitress/adjustments.py'? – Surajano

相關問題