Python builtins.OSError OSError:[Errno 22]无效的参数

时间:2018-09-04 16:37:48

标签: python

我是python初学者,我在获取一条简单路线的数据时遇到上述错误,并且没有编写任何逻辑,我只是​​将用户重定向到新模板。

我已经在github上添加了这个项目,并且因为这个原因而切换了分支。.

我能够正确打开主页,但仪表板显示了此问题

builtins.OSError
OSError: [Errno 22] Invalid argument
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\_compat.py", line 35, in reraise
raise value
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\_compat.py", line 35, in reraise
raise value
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Rakeshvasal\AppData\Local\Programs\Python\Python36-32\lib\site-packages\flask\app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "D:\Rakesh\DemoTest\FlaskTest\firebaseinit.py", line 37, in dashboard
from _pydevd_bundle.pydevd_custom_frames import CustomFramesContainer, custom_frames_container_init

错误stactrace在下面

    # List all sites, applications and appPools
dir IIS:\AppPools | ForEach-Object {
    # Site's app pool
    $_.name
    $_.managedRuntimeVersion
    $_.enable32BitAppOnWin64 
    $_.managedPipelineMode 
    $_.processModel.username
    $_.processModel.password
    $_.processModel.identityType
    # Any web applications on the site + their app pools
} | exportto-csv C:\bob.csv

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,给定帖子上的所有操作都显示了相同的错误,最后得到了这段代码来更改端口号:

from flask import Flask

app = Flask(__name__)


@app.route("/")
def hello():
    return "Hello World!"


if __name__ == "__main__":
    import os

    HOST = os.environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(os.environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)

我的端口号以前默认设置为5000,现在我将其更改为5555,您可以将其更改为任何端口号

答案 1 :(得分:0)

我也遇到了这个问题,参考楼上的方法,将端口号修改为5555,问题就解决了。这个问题困扰了我一天

O(n)

访问链接:127.0.0.1:5555 / index