When I first started learning Python, I found an exception when I ran the web.py home page test code.
The code is as follows:
The code is as follows:
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()
The exceptions are as follows:
Traceback (most recent call last):
File "C:\Users\HHHHH\AppData\Local\Programs\Python\Python37-32\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:\workspace\HelloPython\Helloworld.py", line 7, in <module>
app = web.application(urls, globals())
File "C:\Users\HHHHH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\web\application.py", line 62, in __init__
self.init_mapping(mapping)
File "C:\Users\HHHHH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\web\application.py", line 130, in init_mapping
self.mapping = list(utils.group(mapping, 2))
File "C:\Users\HHHHH\AppData\Local\Programs\Python\Python37-32\lib\site-packages\web\utils.py", line 531, in group
x = list(take(seq, size))
RuntimeError: generator raised StopIteration
Follow the exception prompt to find the appropriate code (… Utils.py “, line 531, in group), as follows:
Here, call line 524 take method and modify it as follows according to the information on the official website (note the indentation) :
Restart successfully after modification:
END
Read More:
- SystemError: execution of module h5py.utils raised unreported exception
- A stopiteration exception is thrown after Python next() completes
- Install in Python 3. X web.py
- Error: Exception was raised when calling per-thread-terminate function in extension lrwreplaymain.dl
- there was an error running the selected code generator unable to retrieve metadata for
- Python how does a. Py file call classes and functions in another. Py file
- Running setup.py install for sasl … error
- Python normality test: test whether the data obey the normal distribution
- Rendering Problems Exception raised during rendering:
- Error: Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2
- Failed to retrieve plugin descriptor for org.mybatis.generator :mybatis-generator
- Error encountered while executing PIP install: error: complete output from command Python setup.py egg_ info:
- The solution of a Java exception has occurred. And error exception in thread when eclipse runs
- Ubuntu has solved the error of h5py installation: building wheel for h5py( setup.py )… or error: failed building wheel for h5py
- RuntimeError: CUDA error: out of memory solution (valid for pro-test)
- 53 Command “python setup.py egg_info“ failed with error
- Using next (ITER (data. Dataloader()) to report an error stopiteration
- Pytorch RuntimeError: Error(s) in loading state_ dict for Dat aParallel:.. function submit.py Solutions for reporting errors
- Running Django manager.py report errors Error:111 connecting to 127.0.0.1:6379.connection refused
- Coursera Using python to access Web data quiz 4