问题
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
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
and Procfile : worker: python bot.py
Edit : Worked using heroku ps:scale worker=1
回答1:
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.
来源:https://stackoverflow.com/questions/39306809/twitter-bot-on-heroku-error-no-web-processes-running-method-get-path-favicon