stopping execution window on error - newbie

A

a

I'm coding on an old windows laptop

i write the code and double click the icon. it runs the program and
writes results to a window.

when the code finishes, the window closes, i do a time.sleep(10) to
see what has happened.

unfortunately when there is an error it just closes the window.
anyway of seeing the error messages?

thanks

a
 
M

Mensanator

I'm coding on an old windows laptop

i write the code and double click the icon.  

Don't do that.
it runs the program and
writes results to a window.

when the code finishes, the window closes, i do a time.sleep(10) to
see what has happened.

unfortunately when there is an error it just closes the window.
anyway of seeing the error messages?

Go to the windows [Start] button. Select [Run...] and in the popup
box,
type "cmd" as the program to run. This will open a DOS shell window (a
text window.)

Then you can run your Python script from the window prompt and it
won't
close until you manually close it, even if the program crashes.

For example, once I open the DOS shell...

<EXAMPLE>
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

H:\>C:

C:\>cd python31\user\lotto

C:\Python31\user\lotto>dir
Volume in drive C has no label.
Volume Serial Number is 06DE-55B4

Directory of C:\Python31\user\lotto

05/13/2010 05:53 PM <DIR> .
05/13/2010 05:53 PM <DIR> ..
08/19/2009 07:08 PM 3,334 lotto.py
05/13/2010 05:56 PM 6,068 lotto_2010.py
2 File(s) 9,402 bytes
2 Dir(s) 102,247,440,384 bytes free

C:\Python31\user\lotto>..\..\python lotto_2010.py

{1: 2, 2: 3, 3: 2, 4: 1, 5: 2, 6: 1, 7: 2, 8: 1, 9: 1, 10: 2, 11: 2,
13: 1, 14: 2, 17: 1, 18: 2, 19: 1, 20: 1, 21: 1, 22: 1, 24: 1, 25: 1,
26: 3, 27: 1, 28: 2, 29: 2, 30: 1, 31: 1, 32: 1, 34: 1, 35: 1, 37: 2,
38: 2, 39: 2, 40: 1, 42: 2, 43: 1, 44: 2, 46: 2, 47: 1, 48: 1, 50: 1,
51: 2, 52: 3}

1 2 **
2 3 ***
3 2 **
4 1 *
5 2 **
6 1 *
7 2 **
8 1 *
9 1 *
10 2 **
11 2 **
12
13 1 *
14 2 **
15
16
17 1 *
18 2 **
19 1 *
20 1 *
21 1 *
22 1 *
23
24 1 *
25 1 *
26 3 ***
27 1 *
28 2 **
29 2 **
30 1 *
31 1 *
32 1 *
33
34 1 *
35 1 *
36
37 2 **
38 2 **
39 2 **
40 1 *
41
42 2 **
43 1 *
44 2 **
45
46 2 **
47 1 *
48 1 *
49
50 1 *
51 2 **
52 3 ***


(7, 21, 50, 36, 26, 3)
(7, 21, 50, 36, 26, 17)
(7, 21, 50, 36, 26, 52)
(7, 21, 50, 36, 3, 17)
(7, 21, 50, 36, 3, 52)
(7, 21, 50, 36, 17, 52)
(7, 21, 50, 26, 3, 17)
(7, 21, 50, 26, 3, 52)
(7, 21, 50, 26, 17, 52)
(7, 21, 50, 3, 17, 52)
(7, 21, 36, 26, 3, 17)
(7, 21, 36, 26, 3, 52)
(7, 21, 36, 26, 17, 52)
(7, 21, 36, 3, 17, 52)
(7, 21, 26, 3, 17, 52)
(7, 50, 36, 26, 3, 17)
(7, 50, 36, 26, 3, 52)
(7, 50, 36, 26, 17, 52)
(7, 50, 36, 3, 17, 52)
(7, 50, 26, 3, 17, 52)
(7, 36, 26, 3, 17, 52)
(21, 50, 36, 26, 3, 17)
(21, 50, 36, 26, 3, 52)
(21, 50, 36, 26, 17, 52)
(21, 50, 36, 3, 17, 52)
(21, 50, 26, 3, 17, 52)
(21, 36, 26, 3, 17, 52)
(50, 36, 26, 3, 17, 52)


8 9 32 38 40 48
13 22 28 39 42 43
1 2 5 11 18 52 +
2 3 26 44 51 52 +++
4 7 14 26 35 52 +++
2 7 10 19 42 47 +
5 20 31 34 50 51 +
1 28 29 37 39 46
10 11 27 37 38 46
6 21 24 29 30 44 +
3 14 17 18 25 26 +++
7 10 39 42 45 46 +
15 17 23 36 38 44 ++
16 19 23 27 41 49
15 25 32 36 44 47 +
16 19 24 29 38 41
3 4 8 13 43 49 +
2 11 17 19 22 50 ++
14 21 22 28 30 45 +
4 15 21 34 47 49 +
19 34 38 39 40 48
4 16 24 33 37 48
8 16 17 18 39 40 +
1 24 27 30 31 47
1 7 11 21 30 43 ++
1 8 13 18 32 36 +
5 10 12 16 20 21 +
7 11 23 24 26 35 ++
7 8 11 13 42 49 +
1 8 17 34 40 50 ++
1 24 29 35 41 45
15 17 24 32 44 52 ++
4 12 21 26 33 38 ++
2 13 15 41 48 50 +
2 7 9 27 45 52 ++
24 25 35 36 39 42 +
8 22 39 40 42 48
16 18 29 30 34 43
7 21 28 36 45 50 ++++
4 8 30 35 39 42
2 11 15 23 40 51
2 7 14 18 23 34 +
1 11 22 37 41 50 +
4 34 40 44 50 52 ++
12 28 33 39 40 52 +
14 18 25 36 38 39 +
4 11 16 17 27 37 +
1 11 16 28 31 36 +
8 16 31 34 36 52 ++
7 10 15 21 35 36 +++
2 9 21 23 29 30 +
15 29 33 41 46 47
2 5 18 34 36 39 +
7 15 21 31 45 50 +++
12 17 20 28 39 51 +
3 7 22 26 50 52 +++++
1 5 21 27 31 39 +
2 8 10 23 34 50 +
1 11 24 26 32 52 ++
1 18 20 38 41 42
12 33 36 42 45 48 +
1 6 21 28 37 39 +
16 18 19 22 33 35
2 7 17 27 29 47 ++
15 19 20 25 42 45
2 6 17 19 20 41 +
1 13 34 42 43 46
16 29 30 31 34 47
5 7 26 29 36 46 +++
1 27 28 30 31 49
8 17 19 47 49 52 ++
5 23 32 41 42 45
11 13 22 29 40 46
16 17 18 20 41 43 +
3 17 26 38 45 52 ++++
13 18 21 38 39 41 +
14 19 28 40 44 51
4 8 9 36 43 47 +
1 9 15 24 36 39 +
4 31 37 41 42 43
7 12 18 27 36 42 ++
3 4 26 27 35 51 ++
7 12 19 23 26 45 ++
19 28 36 39 42 52 ++
8 17 21 44 46 51 ++
2 4 18 19 36 49 +
1 4 11 16 22 35
13 14 17 18 41 46 +
8 16 23 29 43 48
1 8 25 36 37 44 +
7 20 21 23 36 50 ++++
3 7 23 27 39 43 ++
4 10 21 37 38 48 +
6 18 30 35 36 42 +
3 14 23 43 46 48 +
10 11 19 26 42 46 +
1 5 27 34 42 45
1 16 29 33 40 46
32 41 43 45 48 51
1 13 23 24 46 49
24 25 28 30 32 40
8 14 20 33 50 52 ++
2 16 27 28 33 39
13 17 19 32 43 52 ++
10 11 16 43 45 49
2 4 20 22 35 44
1 12 18 36 37 40 +
8 10 16 22 35 47
8 11 16 31 45 46
11 13 22 25 26 27 +
3 17 25 26 29 40 +++
7 10 27 37 46 47 +
3 5 7 27 33 40 ++
4 14 28 37 40 44
18 22 25 33 43 48
11 19 26 30 44 50 ++
3 11 22 42 46 51 +
7 8 21 26 30 50 ++++
6 13 15 23 37 39
12 17 31 37 43 47 +
2 7 11 21 33 42 ++
2 21 26 37 39 50 +++
6 26 37 38 42 46 +
18 19 24 34 40 49
2 9 12 17 31 42 +
5 14 30 32 34 49
7 14 29 41 49 50 ++
3 7 43 45 46 47 ++
12 22 31 37 40 51
1 3 5 11 28 46 +
6 7 12 22 30 32 +
13 18 20 25 26 49 +
14 19 22 41 49 50 +
3 4 12 20 39 42 +
9 18 31 44 46 49
9 20 24 27 41 45
6 8 27 31 45 52 +
22 34 35 40 41 42
1 8 15 37 38 45
6 9 13 16 35 51
6 14 17 30 33 52 ++
14 27 31 34 40 51
2 11 21 34 36 46 ++
1 3 12 15 47 51 +
4 5 26 30 32 37 +
4 10 18 29 37 51
8 33 35 36 39 43 +
9 17 22 23 40 52 ++
3 31 34 38 47 50 ++
21 26 27 33 41 50 +++
1 10 15 26 40 43 +
9 15 17 25 40 42 +
6 11 23 26 30 45 +
1 5 9 33 44 51
13 15 20 22 27 48
3 5 10 11 17 32 ++

C:\Python31\user\lotto>
</EXAMPLE>

Now I can study the output for as long as I want.

Also, I could have done this:

C:\Python31\user\lotto>..\..\python lotto_2010.py >
lotto_output.txt

and directed the output to a file for editing and/or printing.
 
A

a

I'm coding on an old windows laptop
i write the code and double click the icon.  

Don't do that.
it runs the program and
writes results to a window.
when the code finishes, the window closes, i do a time.sleep(10) to
see what has happened.
unfortunately when there is an error it just closes the window.
anyway of seeing the error messages?

Go to the windows [Start] button. Select [Run...] and in the popup
box,
type "cmd" as the program to run. This will open a DOS shell window (a
text window.)

Then you can run your Python script from the window prompt and it
won't
close until you manually close it, even if the program crashes.

For example, once I open the DOS shell...

<EXAMPLE>
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

H:\>C:

C:\>cd python31\user\lotto

C:\Python31\user\lotto>dir
 Volume in drive C has no label.
 Volume Serial Number is 06DE-55B4

 Directory of C:\Python31\user\lotto

05/13/2010  05:53 PM    <DIR>          .
05/13/2010  05:53 PM    <DIR>          ..
08/19/2009  07:08 PM             3,334 lotto.py
05/13/2010  05:56 PM             6,068 lotto_2010.py
               2 File(s)          9,402 bytes
               2 Dir(s)  102,247,440,384 bytes free

C:\Python31\user\lotto>..\..\python lotto_2010.py

{1: 2, 2: 3, 3: 2, 4: 1, 5: 2, 6: 1, 7: 2, 8: 1, 9: 1, 10: 2, 11: 2,
13: 1, 14: 2, 17: 1, 18: 2, 19: 1, 20: 1, 21: 1, 22: 1, 24: 1, 25: 1,
26: 3, 27: 1, 28: 2, 29: 2, 30: 1, 31: 1, 32: 1, 34: 1, 35: 1, 37: 2,
38: 2, 39: 2, 40: 1, 42: 2, 43: 1, 44: 2, 46: 2, 47: 1, 48: 1, 50: 1,
51: 2, 52: 3}

 1  2 **
 2  3 ***
 3  2 **
 4  1 *
 5  2 **
 6  1 *
 7  2 **
 8  1 *
 9  1 *
10  2 **
11  2 **
12
13  1 *
14  2 **
15
16
17  1 *
18  2 **
19  1 *
20  1 *
21  1 *
22  1 *
23
24  1 *
25  1 *
26  3 ***
27  1 *
28  2 **
29  2 **
30  1 *
31  1 *
32  1 *
33
34  1 *
35  1 *
36
37  2 **
38  2 **
39  2 **
40  1 *
41
42  2 **
43  1 *
44  2 **
45
46  2 **
47  1 *
48  1 *
49
50  1 *
51  2 **
52  3 ***

(7, 21, 50, 36, 26, 3)
(7, 21, 50, 36, 26, 17)
(7, 21, 50, 36, 26, 52)
(7, 21, 50, 36, 3, 17)
(7, 21, 50, 36, 3, 52)
(7, 21, 50, 36, 17, 52)
(7, 21, 50, 26, 3, 17)
(7, 21, 50, 26, 3, 52)
(7, 21, 50, 26, 17, 52)
(7, 21, 50, 3, 17, 52)
(7, 21, 36, 26, 3, 17)
(7, 21, 36, 26, 3, 52)
(7, 21, 36, 26, 17, 52)
(7, 21, 36, 3, 17, 52)
(7, 21, 26, 3, 17, 52)
(7, 50, 36, 26, 3, 17)
(7, 50, 36, 26, 3, 52)
(7, 50, 36, 26, 17, 52)
(7, 50, 36, 3, 17, 52)
(7, 50, 26, 3, 17, 52)
(7, 36, 26, 3, 17, 52)
(21, 50, 36, 26, 3, 17)
(21, 50, 36, 26, 3, 52)
(21, 50, 36, 26, 17, 52)
(21, 50, 36, 3, 17, 52)
(21, 50, 26, 3, 17, 52)
(21, 36, 26, 3, 17, 52)
(50, 36, 26, 3, 17, 52)

 8  9 32 38 40 48
13 22 28 39 42 43
 1  2  5 11 18 52 +
 2  3 26 44 51 52 +++
 4  7 14 26 35 52 +++
 2  7 10 19 42 47 +
 5 20 31 34 50 51 +
 1 28 29 37 39 46
10 11 27 37 38 46
 6 21 24 29 30 44 +
 3 14 17 18 25 26 +++
 7 10 39 42 45 46 +
15 17 23 36 38 44 ++
16 19 23 27 41 49
15 25 32 36 44 47 +
16 19 24 29 38 41
 3  4  8 13 43 49 +
 2 11 17 19 22 50 ++
14 21 22 28 30 45 +
 4 15 21 34 47 49 +
19 34 38 39 40 48
 4 16 24 33 37 48
 8 16 17 18 39 40 +
 1 24 27 30 31 47
 1  7 11 21 30 43 ++
 1  8 13 18 32 36 +
 5 10 12 16 20 21 +
 7 11 23 24 26 35 ++
 7  8 11 13 42 49 +
 1  8 17 34 40 50 ++
 1 24 29 35 41 45
15 17 24 32 44 52 ++
 4 12 21 26 33 38 ++
 2 13 15 41 48 50 +
 2  7  9 27 45 52 ++
24 25 35 36 39 42 +
 8 22 39 40 42 48
16 18 29 30 34 43
 7 21 28 36 45 50 ++++
 4  8 30 35 39 42
 2 11 15 23 40 51
 2  7 14 18 23 34 +
 1 11 22 37 41 50 +
 4 34 40 44 50 52 ++
12 28 33 39 40 52 +
14 18 25 36 38 39 +
 4 11 16 17 27 37 +
 1 11 16 28 31 36 +
 8 16 31 34 36 52 ++
 7 10 15 21 35 36 +++
 2  9 21 23 29 30 +
15 29 33 41 46 47
 2  5 18 34 36 39 +
 7 15 21 31 45 50 +++
12 17 20 28 39 51 +
 3  7 22 26 50 52 +++++
 1  5 21 27 31 39 +
 2  8 10 23 34 50 +
 1 11 24 26 32 52 ++
 1 18 20 38 41 42
12 33 36 42 45 48 +
 1  6 21 28 37 39 +
16 18 19 22 33 35
 2  7 17 27 29 47 ++
15 19 20 25 42 45
 2  6 17 19 20 41 +
 1 13 34 42 43 46
16 29 30 31 34 47
 5  7 26 29 36 46 +++
 1 27 28 30 31 49
 8 17 19 47 49 52 ++
 5 23 32 41 42 45
11 13 22 29 40 46
16 17 18 20 41 43 +
 3 17 26 38 45 52 ++++
13 18 21 38 39 41 +
14 19 28 40 44 51
 4  8  9 36 43 47 +
 1  9 15 24 36 39 +
 4 31 37 41 42 43
 7 12 18 27 36 42 ++
 3  4 26 27 35 51 ++
 7 12 19 23 26 45 ++
19 28 36 39 42 52 ++
 8 17 21 44 46 51 ++
 2  4 18 19 36 49 +
 1  4 11 16 22 35
13 14 17 18 41 46 +
 8 16 23 29 43 48
 1  8 25 36 37 44 +
 7 20 21 23 36 50 ++++
 3  7 23 27 39 43 ++
 4 10 21 37 38 48 +
 6 18 30 35 36 42 +
 3 14 23 43 46 48 +
10 11 19 26 42 46 +
 1  5 27 34 42 45
 1 16 29 33 40 46
32 41 43 45 48 51
 1 13 23 24 46 49
24 25 28 30 32 40
 8 14 20 33 50 52 ++
 2 16 27 28 33 39
13 17 19 32 43 52 ++
10 11 16 43 45 49
 2  4 20 22 35 44
 1 12 18 36 37 40 +
 8 10 16 22 35 47
 8 11 16 31 45 46
11 13 22 25 26 27 +
 3 17 25 26 29 40 +++
 7 10 27 37 46 47 +
 3  5  7 27 33 40 ++
 4 14 28 37 40 44
18 22 25 33 43 48
11 19 26 30 44 50 ++
 3 11 22 42 46 51 +
 7  8 21 26 30 50 ++++
 6 13 15 23 37 39
12 17 31 37 43 47 +
 2  7 11 21 33 42 ++
 2 21 26 37 39 50 +++
 6 26 37 38 42 46 +
18 19 24 34 40 49
 2  9 12 17 31 42 +
 5 14 30 32 34 49
 7 14 29 41 49 50 ++
 3  7 43 45 46 47 ++
12 22 31 37 40 51
 1  3  5 11 28 46 +
 6  7 12 22 30 32 +
13 18 20 25 26 49 +
14 19 22 41 49 50 +
 3  4 12 20 39 42 +
 9 18 31 44 46 49
 9 20 24 27 41 45
 6  8 27 31 45 52 +
22 34 35 40 41 42
 1  8 15 37 38 45
 6  9 13 16 35 51
 6 14 17 30 33 52 ++
14 27 31 34 40 51
 2 11 21 34 36 46 ++
 1  3 12 15 47 51 +
 4  5 26 30 32 37 +
 4 10 18 29 37 51
 8 33 35 36 39 43 +
 9 17 22 23 40 52 ++
 3 31 34 38 47 50 ++
21 26 27 33 41 50 +++
 1 10 15 26 40 43 +
 9 15 17 25 40 42 +
 6 11 23 26 30 45 +
 1  5  9 33 44 51
13 15 20 22 27 48
 3  5 10 11 17 32 ++

C:\Python31\user\lotto>
</EXAMPLE>

Now I can study the output for as long as I want.

Also, I could have done this:

    C:\Python31\user\lotto>..\..\python lotto_2010.py >
lotto_output.txt

and directed the output to a file for editing and/or printing.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top