小编Mem*_*est的帖子

Python代码可以通过终端正常工作,但不能通过wsgi脚本工作.(TypeError:'NoneType'对象不可迭代)

完整脚本:

import pprint

def application(environ, start_response):
    start_response('200 OK', [('content-type', 'text/html')])
    aaa = ['a','b','c']
    pprint.pprint(aaa)
Run Code Online (Sandbox Code Playgroud)

如果我要在终端上运行它,那就是......

>>> import pprint
>>> aaa = ['a','b','c']
>>> pprint.pprint(aaa)
['a', 'b', 'c']
>>> 
Run Code Online (Sandbox Code Playgroud)

你可以看到它工作正常.但是通过wsgi-script它不起作用.

error_log中:

TypeError:'NoneType'对象不可迭代

BTW是"pprint"PHP中的"print_r()"等价?

python mod-wsgi wsgi python-2.7 python-3.x

-1
推荐指数
1
解决办法
842
查看次数

标签 统计

mod-wsgi ×1

python ×1

python-2.7 ×1

python-3.x ×1

wsgi ×1