In pycharm .py file is run in python console mode - python-2.7

When I ran my program in pycharm that time my .py file output came in python console mode and also did not see the "Run" option in below(before debug).Please help me to set "Run" option.So I can execute my program using "Run" option.Attaching screen shot.
current is :
Expected:

Related

'django_extensions' 'show_urls' closes within a blink of a second

I use Django extensions as shown here: Django : How can I see a list of urlpatterns?
to get a list of exposed urls.
I'm on win 10.
Cmd.exe opens and closes immediatly.
With a highspeed cam i could figure out that whats written in the cmd.exe makes senes.
How can I prevent cmd.exe from closing by auto.
I if run CMD in Vscode terminal or cmd.exe outside vscode it works, problem only occures when powershell in vscode evokes cmd after manage.py show_urls.
In Vscode
CMD
Enter //changes powershell to CMD
manage.py show_urls

View C++ output in terminal when executing Qt application (macOS)

How can I view what the output of commands such as cout is in the terminal when executing an application?
For example, if I have an application named application.app, in order to run it from the terminal what I do is type open application.app
This launches the app correctly but I am unable to see the output of the print statements that are in the code.
To see the program's stdout output in Terminal, you can run it instead like this:
./application.app/Contents/MacOS/application

getting errors running at cmd line

exec(open("./path/to/script.py").read(), globals()) works for me in the python interactive console shell
howver i get no output and my script has 3 print functions that i am looking for to output the reason i am in intwracve shellmode..is i tried many times to run my script at command line or IDLE only to get django settings issue or main package not a package or even the no mudule errors
only here on this thread am i getting some progress
does any one know how to get output at the console..??

command prompt appears than immediately disappears

I encountered this problem after following a python tutorial on Youtube about creating text files. The instructor had us type in the following code to start:
def createFile(dest):
print dest
if__name__ == '__main__':
createFile('ham')
raw_input('done!')
We had created a folder on the desktop to store the file 'ham' in. But when I double clicked on 'ham' the command prompt window popped on then in a flash it popped off. I am an obvious beginner and I don't know what is going on. Can anyone explain this to me?
You can open command prompt then navigate to python interpreter
directory and run your program by typing python /diretory/to/your/program.py for
example if you have a program named test.py in the directory c:/python and you want to
run it and you have python interpreter installed in C:/python2.x/ directory
then you should open command prompt and type in
cd c:\python2.x\
then you should type
python c:/python/test.py
and perfectly it will work
showing you your program output .

How to open text file in notepad with cmd window in background?

I want to open a text file without opening cmd window in the background. I have tried:
webbrowser.open('file.txt')
but it crashes ArcGIS so I tried following:
os.system('file.txt')
it opens text file without crashing ArcGIS but cmd window remains in the background and goes away when I close text file.
It is more of a display choice question and just checking if there is any suggestion to avoid cmd window in the background.
I don't know if this is what you want, but maybe you should create .bat file (something like here) and run this with Python subprocess.
Save your script with a .pyw extension and the console window won't appear.
From the Python documentation :
On Windows systems, there is no notion of an “executable mode”. The Python installer automatically associates .py files with python.exe so that a double-click on a Python file will run it as a script. The extension can also be .pyw, in that case, the console window that normally appears is suppressed.
You need to modify the program that calls the "add-in script" to run it with pythonw.exe (and not python.exe which is the default).