#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    2
    Rep Power
    0

    Console window troubles


    I recently installed python under windows98. When I click a .py file python tries to run it. If there is an error it gets reported in a console window but the window closes before I can read the error message. How can I get the window to remain open long enough to see what is wrong?
    Thanks
    Ray
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Unless you modify the program to catch the exception/erorr and redisplay it you can't

    The simplest/best thing is to open a console (DOS box) and change directory to the directory containing the program and run it from there.

    Most bugs/ issues like this can also be found uisng IDLE (open the file and press F5). However, this won't catch all bugs and can actually hide them.

    grim
  4. #3
  5. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    You can also run Python with the -i command option of which I am a big fan! This lets you run the program as normal then gives you a Python shell prompt (>>>) that you can use to try the program/code-block/function from right there . Handy for debugging .

    Mark.
    programming language development: www.netytan.com Hula

  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    2
    Rep Power
    0

    console window troubles


    What is IDLE and how do I use it? I have it as a shortcut but when I click on it nothing happens.
    Thanks
    Ray
  8. #5
  9. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    IDLE is a Integrated Development Environment - in this case that means a Windows based Python command shell and Script editor.

    Assuming you have installed Python 2.2 or 2.3....
    If you have a shortcut already to IDLE it should be like this:
    "C:\python23\Lib\idlelib\idle.pyw"
    when you right click it to examine its properties. The drive will change to reflect where you installed Python of course.

    Confirm that it is correct by browsing that directory and checking the file exists.

    If it is correct and clicking on it does not work then it means Python has not been registered as an application to launch py or pyw files. If that is the case then it's probably easiest to re-install Python and try again.

    Or locate a python file (a .py or pyw file) and view it's properties - on WinXp you can associate a c:\python23\python.exe with the files so that Windows knows to use it (I don't have a Win98 machine to confirm it's equivalent).

    grim
    Last edited by Grim Archon; November 7th, 2004 at 02:53 AM.

IMN logo majestic logo threadwatch logo seochat tools logo