Re: [pygame] IDLE crashes on error?
Hi try to use: pygame.quit() sys.exit() ~DR0ID Thanks! There's still the same traceback output in IDLE, but my Pygame window closes instead of freezing, and that's all I'm worried about.
Re: [pygame] IDLE crashes on error?
I think sys.exit() is implemented as throwing a "SystemExit" exception: http://www.python.org/doc/current/lib/module-sys.html On 8/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Traceback (most recent call last): File "C:\Program Files\Python\pygame_test.pyw", line 15, in -toplevel- sys.exit() SystemExit looks like maybe IDLE has a top level exception handler that is catching the SystemExit, and printing a traceback, rather than just exiting cleanly... I'm not sure why it would do that though... (can you see what the IDLE source is doing?) you are calling sys.exit() with no parameters right?
Re: [pygame] IDLE crashes on error?
[EMAIL PROTECTED] schrieb: - Original Message - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: Sent: Monday, August 14, 2006 5:11 PM Subject: Re: [pygame] IDLE crashes on error? [EMAIL PROTECTED] wrote: Thank you all. Running IDLE first and then loading the file fixes the primary problem, as does removing the -n from the "Edit With" option... whether or not that's going to cause other problems later, I don't know, but I'd be willing to risk it. However, sys.exit() still freezes my window rather than closing it, with this output in IDLE: freezes what window? Your IDLE editing window? Your IDLE shell? Your Pygame window? Pygame window. Sorry to be unclear. Hi try to use: pygame.quit() sys.exit() ~DR0ID
Re: [pygame] IDLE crashes on error?
- Original Message - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: Sent: Monday, August 14, 2006 5:11 PM Subject: Re: [pygame] IDLE crashes on error? [EMAIL PROTECTED] wrote: Thank you all. Running IDLE first and then loading the file fixes the primary problem, as does removing the -n from the "Edit With" option... whether or not that's going to cause other problems later, I don't know, but I'd be willing to risk it. However, sys.exit() still freezes my window rather than closing it, with this output in IDLE: freezes what window? Your IDLE editing window? Your IDLE shell? Your Pygame window? Pygame window. Sorry to be unclear.
Re: [pygame] IDLE crashes on error?
[EMAIL PROTECTED] wrote: Thank you all. Running IDLE first and then loading the file fixes the primary problem, as does removing the -n from the "Edit With" option... whether or not that's going to cause other problems later, I don't know, but I'd be willing to risk it. However, sys.exit() still freezes my window rather than closing it, with this output in IDLE: freezes what window? Your IDLE editing window? Your IDLE shell? Your Pygame window? Traceback (most recent call last): File "C:\Program Files\Python\pygame_test.pyw", line 15, in -toplevel- sys.exit() SystemExit Am I doing something wrong here? I'll definitely be trying out Scite, too -- thanks Alan. -Morgan
Re: [pygame] IDLE crashes on error?
Thank you all. Running IDLE first and then loading the file fixes the primary problem, as does removing the -n from the "Edit With" option... whether or not that's going to cause other problems later, I don't know, but I'd be willing to risk it. However, sys.exit() still freezes my window rather than closing it, with this output in IDLE: Traceback (most recent call last): File "C:\Program Files\Python\pygame_test.pyw", line 15, in -toplevel- sys.exit() SystemExit Am I doing something wrong here? I'll definitely be trying out Scite, too -- thanks Alan. -Morgan
Re: [pygame] IDLE crashes on error?
On 12 Aug 2006 at 14:37, Luke Paireepinart wrote: > Nice conjectures, but I think the confusion is from David's response. > I think he meant to say '[turning on this subprocess] option is > [removing] the -n flag' > The -n command is on by default on windows boxen (at least mine was.) > As per someone else's instructions (I can't remember who, sorry) > Open Windows Explorer > Tools Menu > Folder Options > File Types tab > select 'py' and hit advanced > select 'Edit with Idle' and hit Edit > under 'Application used to perform action:' > get rid of the -n argument that it passes. > > You should probably do this with .pyw files also. > > I can't imagine why giving it more than one -n would make a difference, > or how you added -n to the argument list, but anyway, > this should do what you want. I just tried it and it is very helpful. > I used to create .bat files for all my programs > that would run my programs and then pause, > so if there were error messages I could see them, > since pygame apps would give me IDLE problems, > but I just wrote a pygame app and it worked fine once > I removed the -n flag. The -n flag is there for a reason. Windows had problems when IDLE starts a second process for an "edit" file association. Maybe the problem was solved in recent Windows versions. Better still is to start IDLE first, then open the file to edit. Lenard Lindstrom <[EMAIL PROTECTED]>
Re: [pygame] IDLE crashes on error?
James Hofmann wrote: This option is the -n flag. It's saved me a lot of trouble with IDLE. >From the help: Running without a subprocess: If IDLE is started with the -n command line switch it will run in a single process and will not create the subprocess which runs the RPC Python execution server. >This can be useful if Python cannot create the >subprocess or the RPC socket interface on your platform. However, in this mode user code is not isolated from IDLE itself. Also, the environment is not restarted when Run/Run Module (F5) is selected. If your code has been modified, you must reload() the affected modules and re-import any specific items (e.g. from foo import baz) if the changes are to take effect. For these reasons, it is preferable to run IDLE with the default subprocess if at all possible. Man, did that cause me trouble. I made a 'config' module that I put variables I wanted to be global for my program, so I could just say 'config.varname' to reference them, but whenever I changed the 'config.py' module I had really weird behaviour, like I hadn't even made changes. Now I know it's because 'config.py' had already been imported and I had to restart IDLE every time I changed it. What a hassle. This sounds like it does the opposite of what we want...merges the processes instead of completely seperating them. It does :) I tried running IDLE with it and then forcing my pygame code to crash. IDLE will normally zombify(unresponsive) if I do that and make me kill it manually; but with -n it completely blew up and gave me a MSVC crash box. So my conjectures are: we are not running the same program and -n is doing something completely different for you guys, the OS running this is a factor, or I'm doing a better job at making crashy code. Nice conjectures, but I think the confusion is from David's response. I think he meant to say '[turning on this subprocess] option is [removing] the -n flag' The -n command is on by default on windows boxen (at least mine was.) As per someone else's instructions (I can't remember who, sorry) Open Windows Explorer Tools Menu > Folder Options File Types tab select 'py' and hit advanced select 'Edit with Idle' and hit Edit under 'Application used to perform action:' get rid of the -n argument that it passes. You should probably do this with .pyw files also. I can't imagine why giving it more than one -n would make a difference, or how you added -n to the argument list, but anyway, this should do what you want. I just tried it and it is very helpful. I used to create .bat files for all my programs that would run my programs and then pause, so if there were error messages I could see them, since pygame apps would give me IDLE problems, but I just wrote a pygame app and it worked fine once I removed the -n flag. Hope that helps :D -Luke __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [pygame] IDLE crashes on error?
> This option is the -n flag. It's saved me a lot > of trouble with IDLE. >From the help: >Running without a subprocess: > >If IDLE is started with the -n command line switch it >will run in a single process and will not create the >subprocess which runs the RPC Python execution server. >This can be useful if Python cannot create the >subprocess or the RPC socket interface on your >platform. However, in this mode user code is not >isolated from IDLE itself. Also, the environment is >not restarted when Run/Run Module (F5) is selected. If >your code has been modified, you must reload() the >affected modules and re-import any specific items >(e.g. from foo import baz) if the changes are to take >effect. For these reasons, it is preferable to run >IDLE with the default subprocess if at all possible. This sounds like it does the opposite of what we want...merges the processes instead of completely seperating them. I tried running IDLE with it and then forcing my pygame code to crash. IDLE will normally zombify(unresponsive) if I do that and make me kill it manually; but with -n it completely blew up and gave me a MSVC crash box. So my conjectures are: we are not running the same program and -n is doing something completely different for you guys, the OS running this is a factor, or I'm doing a better job at making crashy code. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: [pygame] IDLE crashes on error?
On 8/11/06, Bob Ippolito <[EMAIL PROTECTED]> wrote: On Aug 11, 2006, at 3:38 PM, James Hofmann wrote:> --- [EMAIL PROTECTED] wrote:>>> Hi folks, Python/Pygame newbie here. Really liking it so far, >> but I've resorted to>> using Notepad. It seems like any time I execute code>> with errors in it -->> simple syntax errors, not endless while loops or>> anything -- IDLE freezes. >> Also, and I don't know if this is related, but>> sys.exit() doesn't actually>> close my windows when I'm running things from IDLE.>> They just freeze. IDLE version 1.1.3, Python version 2.4.3, any>> help/advice appreciated.>> IDLE runs your code in the same operating system> process, which means that anything that crashes your> code may crash IDLE, too, and also changes the > behavior of your code as with sys.exit(). You can use> it as the editor or for tests in the console, but run> pygame code elsewhere.IDLE definitely has an option to use a subprocess for interpreters. Turn it on, then this problem goes away.-bobThis option is the -n flag. It's saved me a lot of trouble with IDLE.
Re: [pygame] IDLE crashes on error?
On Aug 11, 2006, at 3:38 PM, James Hofmann wrote: --- [EMAIL PROTECTED] wrote: Hi folks, Python/Pygame newbie here. Really liking it so far, but I've resorted to using Notepad. It seems like any time I execute code with errors in it -- simple syntax errors, not endless while loops or anything -- IDLE freezes. Also, and I don't know if this is related, but sys.exit() doesn't actually close my windows when I'm running things from IDLE. They just freeze. IDLE version 1.1.3, Python version 2.4.3, any help/advice appreciated. IDLE runs your code in the same operating system process, which means that anything that crashes your code may crash IDLE, too, and also changes the behavior of your code as with sys.exit(). You can use it as the editor or for tests in the console, but run pygame code elsewhere. IDLE definitely has an option to use a subprocess for interpreters. Turn it on, then this problem goes away. -bob
Re: [pygame] IDLE crashes on error?
[EMAIL PROTECTED] wrote: Hi folks, Python/Pygame newbie here. Really liking it so far, but I've resorted to using Notepad. It seems like any time I execute code with errors in it -- simple syntax errors, not endless while loops or anything -- IDLE freezes. Also, and I don't know if this is related, but sys.exit() doesn't actually close my windows when I'm running things from IDLE. They just freeze. IDLE version 1.1.3, Python version 2.4.3, any help/advice appreciated. -Morgan I've actually had little trouble with IDLE, and usually use it for testing. (On WinXP.) Simple errors like syntax errors don't freeze IDLE; instead it just prints a red error message. This can be a problem occasionally with Pygame programs, because the graphics window obscures the console window and prevents me from seeing that message. So, for testing I try to avoid using fullscreen, and place the window where I can see any error message. Another thing you can try is to put a "raise" statement (eg. 'raise "An error!"') or breakpoint (some funky key combination), or a try/except block. try: print "forty-two" + 42 except: print "Hmm, I'm too strongly-typed to do that." Kris
Re: [pygame] IDLE crashes on error?
--- [EMAIL PROTECTED] wrote: > Hi folks, > > Python/Pygame newbie here. Really liking it so far, > but I've resorted to > using Notepad. It seems like any time I execute code > with errors in it -- > simple syntax errors, not endless while loops or > anything -- IDLE freezes. > Also, and I don't know if this is related, but > sys.exit() doesn't actually > close my windows when I'm running things from IDLE. > They just freeze. > > IDLE version 1.1.3, Python version 2.4.3, any > help/advice appreciated. > > -Morgan > IDLE runs your code in the same operating system process, which means that anything that crashes your code may crash IDLE, too, and also changes the behavior of your code as with sys.exit(). You can use it as the editor or for tests in the console, but run pygame code elsewhere. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com