#π Is there a way to execute commands in anaconda prompt via a python script?
18 messages Β· Page 1 of 1 (latest)
@teal heath
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.
subprocess.Popen should be able do it, but you will have to find the executable path and may need to set some environment variables and/or command line arguments
Wdym?
what do you mean by anaconda prompt?
does subprocess.run(shell=True) work
it opens command prompt and then command prompt closes
idk i just know that i ust to open python files or anything with that
subprocess.run(["python","discord.py], shell=True)
so with the anaconda virtual env activated?
shell=True will likely not do what OP wants.
ye maybe sorry π
I'm basically trying to make a quick script that will open an environment I made and use the cd command a few times so I don't need to manually do it every time.
uh. that's probably better done with a shell script (.ps1 or so?), instead of python.
Noted
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.