heroku应用程序每次崩溃

时间:2019-04-29 16:37:49

标签: python-3.x

我试图使用heroku部署电报机器人,但它引发了一些错误

尝试多次重建应用程序,甚至重新检查了代码并更改了设置中的某些内容,但没有任何效果

 2019-04-28T20:00:06.366752+00:00 app[api]:`enter code here` Release v9 created by user testpaypal580@gmail.com
    2019-04-28T20:00:06.366752+00:00 app[api]: Deploy 0ac91a7b by user testpaypal580@gmail.com
    2019-04-28T20:00:06.892646+00:00 heroku[web.1]: State changed from crashed to starting
    2019-04-28T20:00:10.782109+00:00 heroku[web.1]: Starting process with command `python3 dwsongs-normal.py`
    2019-04-28T20:00:12.946054+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.1) or chardet (3.0.4) doesn't match a supported version!
    2019-04-28T20:00:12.946075+00:00 app[web.1]: RequestsDependencyWarning)
    2019-04-28T20:00:15.000000+00:00 app[api]: Build succeeded
    2019-04-28T20:00:17.102728+00:00 app[web.1]: 1):Free
    2019-04-28T20:00:17.102853+00:00 app[web.1]: 2):Strict
    2019-04-28T20:00:17.103267+00:00 app[web.1]: :ChooseTraceback (most recent call last):
    2019-04-28T20:00:17.103306+00:00 app[web.1]: File "dwsongs-normal.py", line 787, in <module>
    2019-04-28T20:00:17.104544+00:00 app[web.1]: ans = input(":Choose")
    2019-04-28T20:00:17.104735+00:00 app[web.1]: EOFError: EOF when reading a line
    2019-04-28T20:00:17.279581+00:00 heroku[web.1]: State changed from starting to crashed
    2019-04-28T20:00:17.263327+00:00 heroku[web.1]: Process exited with status 1

这是我得到的日志

任何帮助将不胜感激

代码:

try:
   print("1):Free")
   print("2):Strict")
   ans = input("Choose:")
   if ans == "1":
    bot.message_loop({
                      "chat": start,
                      "callback_query": download,
                      "inline_query": search,
                      "chosen_inline_result": up
                     })

1 个答案:

答案 0 :(得分:0)

尝试删除输入和打印语句。如果将程序打印到标准输出而没有一个程序,则该程序将崩溃。您可以改用> /dev/null结束脚本,例如将输出重定向到/ dev / null。 python3 dwsongs-normal.py > /dev/null