python3.7.2使用web.py报错:generator raised StopIteration

运行报错

Traceback (most recent call last):
  File "D:\Program Files\Python\Python37\lib\site-packages\web\utils.py", line 526, in take
    yield next(seq)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Python\hello.py", line 6, in 
    app = web.application(urls, globals(),True)
  File "D:\Program Files\Python\Python37\lib\site-packages\web\application.py", line 62, in __init__
    self.init_mapping(mapping)
  File "D:\Program Files\Python\Python37\lib\site-packages\web\application.py", line 130, in init_mapping
    self.mapping = list(utils.group(mapping, 2))
  File "D:\Program Files\Python\Python37\lib\site-packages\web\utils.py", line 531, in group
    x = list(take(seq, size))
RuntimeError: generator raised StopIteration

解决办法

修改Lib\site-packages\web下的utils.py文件。
将第526行的

yield next(seq)

修改成

try:
    yield next(seq)
except StopIteration:
    return

再次运行,正常了


补充,webpy python3版本:https://github.com/webpy/webpy/tags

你可能感兴趣的:(web,python)