P
P
Penguinwtf2021-06-06 22:21:27
Python
Penguinwtf, 2021-06-06 22:21:27

How to fix "app[worker.1]: bash: main.py: command not found" error?

I made a python discord bot that parses the page every 10 minutes and gives me a message in the discord (BeautifulSoup4, requests).
Tried to pour it on Heroku.
At first it gave an error at=error code=H14 desc="No web processes running" method=GET path="/"
fixed it via heroku ps:scale web=1
now it gives an error:

2021-06-06T19:17:19.492130+00:00 heroku[worker.1]: Starting process with command `main.py`
2021-06-06T19:17:20.174553+00:00 heroku[worker.1]: State changed from starting to up
2021-06-06T19:17:21.540882+00:00 heroku[worker.1]: Process exited with status 127
2021-06-06T19:17:21.489291+00:00 app[worker.1]: bash: main.py: command not found

How to fix it?

requirements:
discord.py==1.7.2
requests==2.25.1
BeautifulSoup4==4.9.3
websockets==9.1


Procfile:
worker: main.py

Simplified view of main.py:
import requests
from bs4 import BeautifulSoup
import discord
client = discord.Client()
from discord.ext import tasks, commands

def parse():
    html = get_html(URL)
    if html.status_code == 200:
        return get_content(html.text)
    else:
        print('error')

@client.event
async def on_ready():
    parsing_disc.start()
    print('We have logged in as {0.user}'.format(client))


@tasks.loop(minutes = 10)
async def parsing_disc():
    global NumberC
    global NameP
    NumberC = 0
    EnyMsg = ''
    print('try to parse...')
    while NumberC <= 22:
        EnyMsg = parse()
        if EnyMsg:
            f = open('player_base.txt')
            text = f.read()
            if NameP in text:
                print('Уже было')
            else:
                f = open('player_base.txt', 'a')
                f.write('\n' + NameP)
                channel = client.get_channel(846420270621523971)
                await channel.send('```' + EnyMsg + '```' + '\n' + CharURL)
            f.close()
        NumberC += 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Penguinwtf, 2021-06-07
@Penguinwtf

Need to fix worker: python main.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question