简体   繁体   中英

“RuntimeError: generator raised StopIteration” every time i run the app. (Nothing Works)

So every time I try to run the app I get "RuntimeError: generator raised StopIteration error". I am using Python 3.7 (btw I don't know how to type fancy in this so its nice to see)

I have tried changing utils.py yield next(seq) to

try:
    yield next(seq)
except StopIteration:
    return

but that didn't seem to work. I've also re installed webpy but it didn't work.

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()

This error pops up:

Traceback (most recent call last): File "C:\Users\Korisnik\Desktop\Python Files\Web\venv\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 "C:/Users/Korisnik/Desktop/Python Files/Web/main.py", line 6, in app = web.application(urls, globals()) File "C:\Users\Korisnik\Desktop\Python Files\Web\venv\lib\site-packages\web\application.py", line 62, in init self.init_mapping(mapping) File "C:\Users\Korisnik\Desktop\Python Files\Web\venv\lib\site-packages\web\application.py", line 130, in init_mapping self.mapping = list(utils.group(mapping, 2)) File "C:\Users\Korisnik\Desktop\Python Files\Web\venv\lib\site-packages\web\utils.py", line 531, in group x = list(take(seq, size)) RuntimeError: generator raised StopIteration

The webpy documentation says that the latest full release (0.39) only works on Python 2. There's work in progress towards supporting Python 3, but for now it's only available in development builds.

You can try installing one of those, with pip install web.py==0.40-dev1 .

I was going into my main python folder and changing the yield thing there INSTEAD of going into the folder where my project is. The fix is changing the yield thing to the improved yield thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM