2

I want to auto run the python script when I open it from the terminal so that I won't have to press the run button From the terminal I want to open the file as : pycharm-community main.py

How do I auto run it while it opens?

2 Answers 2

2

Do File | Settings | Tools | Startup Tasks (or Ctrl-Alt-S).

Then: Build, Execution, Deployment > Console > Python Console

This gives you a dialogue with an edit box Starting script. Put your import code there. That will run every time you open a new console.

Sign up to request clarification or add additional context in comments.

1 Comment

That is not what I meant.. I have made a python program main.py..i want it to run automatically and show the output if I open it from the terminal
0

Preferences > Tools > Startup Tasks, <+ Add> and select your main.py

Then anytime you open the project the script will run and display results.

I wanted main.py to run daily at a certain time, so used Keyboard Maestro. Keyboard Maestro is also able to control the running of main.py, eliminating the step above. That way my script runs only at the desired time of day, not every time I open the project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.