• python3.7.3使用web.py报错解决办法 and RuntimeError: generator raised StopIteration


    这是想要创建一个用python编写的web项目。但是首先要确定自己的web.py已经安装成功了。

    安装的命令是:

    pip install web.py==0.40-dev1

    运行官网的如下的实例:

    import web
    urls = (
    '/(.*)', 'hello'
    )
    app = web.application(urls, globals())

    class hello: 
    def GET(self, name):
    if not name: 
    name = 'World'
    return 'Hello, ' + name + '!'

    if __name__ == "__main__":
    app.run()

    然后出现了如下图所示的错误

    Traceback (most recent call last):
    File "D:softwarepythonlibsite-packageswebutils.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 "second.py", line 6, in <module>
    app = web.application(urls, globals())
    File "D:softwarepythonlibsite-packageswebapplication.py", line 62, in __init__
    self.init_mapping(mapping)
    File "D:softwarepythonlibsite-packageswebapplication.py", line 130, in init_mapping
    self.mapping = list(utils.group(mapping, 2))
    File "D:softwarepythonlibsite-packageswebutils.py", line 531, in group
    x = list(take(seq, size))
    RuntimeError: generator raised StopIteration

    然后我们就需要进行如下操作

    本文参考的是https://blog.csdn.net/gibiguvuggu/article/details/86223332

    这位的微博。

  • 相关阅读:
    VisualVM工具的使用
    jstack的使用
    JVM内存溢出的定位与分析
    初识JVM
    JVM运行参数
    VIM 常用命令
    python3 简单抓取图片2
    python3 抓取图片
    node.js GET 请求简单案例
    node.js 爬虫
  • 原文地址:https://www.cnblogs.com/littleswan/p/11345936.html
Copyright © 2020-2023  润新知