本文介绍了heroku上的Twitter机器人错误“未运行任何Web进程";方法=获取路径="/favicon.ico"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用tweepypython 3.5中创建了一个Twitter机器人,该机器人每天都会更新有关新关注者的状态.该代码可以在IDLE上顺利运行.我试图将机器人部署在heroku上,但它始终在日志中抛出错误:

I made a twitter bot in python 3.5 using tweepy which updates status about the New followers everyday. The code runs smoothly on IDLE. I tried to deploy the bot on heroku but it keeps throwing error in the logs :

at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" dyno= connect= service= status=503 bytes=

经历类似的问题后,我尝试了以下命令:

After going through similar questions, I tried the commands like :

heroku ps:scale web=1

但无济于事.这是我的名为bot.py

but to no avail.Here is my python program named bot.py

import tweepy
import sys
import time
import os
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
CONSUMER_KEY = ''
CONSUMER_SECRET = '' 
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

api = tweepy.API(auth)
count=1
Past_Followers = 0
Current_Followers = 0
while(count>0):
   variable1 = api.get_user('USERNAME')
   Past_Followers = variable1.followers_count
   api.update_status(status='Follower count is '+str(Past_Followers))
   time.sleep(86400)
   variable2 = api.get_user('USERNAME')
   Current_Followers = variable2.followers_count
   api.update_status(status='Total Followers '+str(Current_Followers))
   api.update_status(status='New Followers Today = '+str(Current_Followers - Past_Followers))
   count=count+1
   print(count)

requirements.txt:tweepy==3.5.0; runtime.txt:python-3.5.2和Procfile:worker: python bot.py编辑:使用heroku ps:scale worker=1

requirements.txt : tweepy==3.5.0 ; runtime.txt : python-3.5.2 and Procfile : worker: python bot.pyEdit : Worked using heroku ps:scale worker=1

推荐答案

问题是,当bot是工作程序时,您正在尝试运行Web进程.您要ps:scale worker=1而不是ps:scale web=1. Web适用于Procfile中带有web:的进程,它们必须是Web应用程序.

The problem is you are trying to run your web process, when the bot is a worker. You want to ps:scale worker=1 instead of ps:scale web=1. Web is for processes with web: in your Procfile and they have to be web apps.

这篇关于heroku上的Twitter机器人错误“未运行任何Web进程";方法=获取路径="/favicon.ico"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 06:13