#๐Ÿ”’ run a script always

37 messages ยท Page 1 of 1 (latest)

fringe scroll
#

Hello, I created a Python script to send a message to Discord from a bot every 2 minutes, but for it to work, I have to keep the CMD open all the time. Is there any way I can run the script 24/7 without having to keep it open?

void groveBOT
#

@fringe scroll

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fringe scroll
#

I really don't know much about programming, so I'm here to ask, I hope you can help me

high ore
high ore
fringe scroll
#

What is that? I don't know much about this

high ore
#

oh, you're using CMD

#

one moment

#

@fringe scroll try putting start /b before the command. so it might look like start /b python your_program.py

fringe scroll
#

I did it and nothing happened; the script ran normally

high ore
#

okay, so it should keep running, even if you close cmd

fringe scroll
#

lemme try

high ore
#

nevermind, closing cmd will stop it

fringe scroll
#

its not working

#

ChatGPT told me to create a .bat file to run it in the background, but it didn't work for me

high ore
#

@fringe scroll in CMD, please run where python and tell me the whole output in this chat (no screenshots)

fringe scroll
#

C:\Users\renat\AppData\Local\Microsoft\WindowsApps\python.exe

high ore
#

in powershell, you might have to cd to the directory containing the py file.

fringe scroll
#

PS C:\Users\renat\Desktop\Discord-Auto-message-main> python auto.py &
Line: 1
Character: 16

The ampersand (&) character is not allowed. The & operator is reserved for future use; enclose an
ampersand character in double quotes ("&") to pass it as part of a string.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed

high ore
fringe scroll
#

It ran normally, as if it were in cmd

high ore
#

okay, see if it continues even if you close powershell

fringe scroll
#

Okay, it runs every 2 minutes, I have to wait a bit

#

nop, its not working

high ore
#

fuck

#

this is a lot easier on linux

fringe scroll
#

I thought it would be easier; I don't know anything about programming. I'm sorry for wasting your time

blissful scaffold
#

You are not still using a self bot right....?

high ore
#

I have to sign off, unfortunately

#

actually, I might have figured it out

#

nope, I didn't.

void groveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.