gpt4 book ai didi

python - Heroku EOFError 仅适用于两行 python 代码

转载 作者:太空宇宙 更新时间:2023-11-03 21:27:41 24 4
gpt4 key购买 nike

这是我第一次尝试将 python 程序部署到 Heroku。

我的Python程序是

name=input("What is your name?: ");
print("Nice to meet you", name)

https://shielded-gorge-83102.herokuapp.com/

Application error 
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

执行日志命令时:

(intro) D:\heroku>heroku logs
2018-12-12T13:43:55.763708+00:00 app[api]: Release v2 created by user m.naufil1@gmail.com
2018-12-12T13:43:55.600014+00:00 app[api]: Initial release by user m.naufil1@gmail.com
2018-12-12T13:43:55.600014+00:00 app[api]: Release v1 created by user m.naufil1@gmail.com
2018-12-12T13:43:55.763708+00:00 app[api]: Enable Logplex by user m.naufil1@gmail.com
2018-12-12T13:44:09.000000+00:00 app[api]: Build started by user m.naufil1@gmail.com
2018-12-12T13:44:33.155579+00:00 app[api]: Release v3 created by user m.naufil1@gmail.com
2018-12-12T13:44:33.172663+00:00 app[api]: Scaled to web@1:Free by user m.naufil1@gmail.com
2018-12-12T13:44:36.735728+00:00 heroku[web.1]: Starting process with command `python script.py`
2018-12-12T13:44:38.669558+00:00 heroku[web.1]: Process exited with status 1
2018-12-12T13:44:38.605013+00:00 app[web.1]: What is your name?: Traceback (most recent call last):
2018-12-12T13:44:38.605042+00:00 app[web.1]: File "script.py", line 8, in <module>
2018-12-12T13:44:38.605143+00:00 app[web.1]: name=input("What is your name?: ");
2018-12-12T13:44:38.605148+00:00 app[web.1]: EOFError: EOF when reading a line
2018-12-12T13:44:38.834792+00:00 heroku[web.1]: State changed from starting to crashed
2018-12-12T13:44:38.836807+00:00 heroku[web.1]: State changed from crashed to starting
2018-12-12T13:44:42.997678+00:00 heroku[web.1]: Starting process with command `python script.py`
2018-12-12T13:44:45.507921+00:00 heroku[web.1]: State changed from starting to crashed
2018-12-12T13:44:45.418724+00:00 heroku[web.1]: Process exited with status 1
2018-12-12T13:44:45.349072+00:00 app[web.1]: What is your name?: Traceback (most recent call last):
2018-12-12T13:44:45.357936+00:00 app[web.1]: File "script.py", line 8, in <module>
2018-12-12T13:44:45.360501+00:00 app[web.1]: name=input("What is your name?: ");
2018-12-12T13:44:45.360593+00:00 app[web.1]: EOFError: EOF when reading a line
2018-12-12T13:45:01.410054+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shielded-gorge-83102.herokuapp.com request_id=95386b8c-f2e6-4d0f-8dcb-6355cf75da60 fwd="39.50.204.180" dyno= connect= service= status=503 bytes= protocol=https

我读了这篇文章:App crashing on Heroku Pyphon application

它说你不能在此处使用输入命令。这是因为它是一个网络应用程序并且打印命令无法在浏览器上运行吗?请告诉我如何在不接受输入的情况下运行该程序。

所以,如果我们需要一点 HTML,我也知道如何使用 HTML。所以请帮助我使用 python 运行这个程序。

最佳答案

您仍然可以进行输入,但方式略有不同。看看这个Send data from a textbox into Flask?

一旦您有了一个简单的应用程序,请按照本教程进行部署 https://devcenter.heroku.com/articles/getting-started-with-python

您很可能已经了解大部分步骤。而且并非所有这些都是强制性的。

关于python - Heroku EOFError 仅适用于两行 python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53744660/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com