Crossin的编程教室

标题: 实战(0)就遇到问题 [打印本页]

作者: Lizero    时间: 2018-11-26 16:57
标题: 实战(0)就遇到问题
有点崩溃,第0课就遇到解决不了的问题,大神们帮忙看看
代码如下:
[size=16.6667px]import weburls = ('/', 'index')class index:    def GET(self):        return "Hello, world!"if __name__ == "__main__":    app = web.application(urls, globals())    app.run()
报错如下:
Traceback (most recent call last):
  File "D:\Program Files\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:/Program Files/Demo/Demo1.py", line 12, in <module>
    app = web.application(urls, globals())
  File "D:\Program Files\Python37\lib\site-packages\web\application.py", line 62, in __init__
    self.init_mapping(mapping)
  File "D:\Program Files\Python37\lib\site-packages\web\application.py", line 130, in init_mapping
    self.mapping = list(utils.group(mapping, 2))
  File "D:\Program Files\Python37\lib\site-packages\web\utils.py", line 531, in group
    x = list(take(seq, size))
RuntimeError: generator raised StopIteration

QQ截图20181126165355.png (179.76 KB, 下载次数: 920)

QQ截图20181126165355.png


作者: Lizero    时间: 2018-11-26 16:59
不知道为什么原文不转行。。。
import web
urls = ('/', 'index')
class index:
    def GET(self):
        return "Hello, world!"
if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()
作者: Lizero    时间: 2018-11-26 18:17
已解决,用 慕UI5507523 这位的方法
https://www.imooc.com/qadetail/265503

作者: Lizero    时间: 2018-11-28 17:18
Python3.7用上述方法还是不能完美解决,做到实战(2)的时候还是会出问题。弄了两天,看网上说可能是3.7的问题,无奈重装Python3.6暂时可以往下操作
作者: crossin先生    时间: 2018-11-29 11:56
webpy对新版支持有问题




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5