PrepareFor
PrepareFor

Reputation: 2598

my Python program shut down when i executing by double click

i write some python program.

i usually execute my program by CMD

but this time, i tried to execute program by double click

it works well until interpreter meet input code.

when i input some texts, it shut down

my input code is

for i in (input('range input => ')).split(' '):
    range_list.append(int(i));

it works totally well when i execute by path(py ~.py) through the CMD

can you help me?

Upvotes: 0

Views: 1465

Answers (3)

shad0w_wa1k3r
shad0w_wa1k3r

Reputation: 13373

Your program opens in a windowed mode when you double click it. The window will disappear / close down when the program finishes, which happens a lot fast after you have entered all the required inputs.

If you wish to see the output before the program exit, expect an input at the end of your program.

Upvotes: 2

crux666
crux666

Reputation: 85

Yeah when the program is done, it closes.
You can add something like x = input() at the end if you want to keep it open, or just run it in cmd.

Upvotes: 2

Chris Hawkes
Chris Hawkes

Reputation: 12420

The interpreter is running in an endless loop. Executing your program from windows or via the command line using python will run and exit the program immediately.

At the end of your program just add

input()

This will keep it open so you can see your results.

Upvotes: 2

Related Questions