Thursday, March 19, 2009

Python Programming In Windows

The Easy Way:
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now you need to change directories into your python installation folder
now in order to run your python program from the prompt if python program is in the same director with the python installation folder, if it is not then move it to this folder, now you will want to type:

python.exe yourprogramnamehere.py

The Hard Way: I don't feel like listening to the instructor and I want to do what I want to do.
Go To Start->Run
now type cmd and press enter
now you are at the prompt.
now comes the fun. Type out your full installation path for your python program and the full path to where your file resides everytime you want to debug your program which will be quite often until you get rid of all of your syntax errors and logic errors. This will add a good bit of time to your debugging process.

The entry at the command prompt will look something like this and will wrap around several lines at the prompt.

C:\Python26\python.exe C:\Documents And Settings\02402530235\My Documents\Python Programs\yourpythonprogramhere.py

Yes you can run your programs in Idle but you won't get the detailed error messages that you need in order to debug your program. Its best to use the command prompt instead. Now that is just for running the program not counting setting up JEdit.

Setting Up JEdit:
Go To Utilities->Global Options

Click On Gutter
Line Numbering Checked
Now you can click on Monospace 10 and change the font size larger than 10 so you can actually see the line numbers.

Click On Text Area
Now you can change the font size and font if you like by clicking on the button to the right of Text Font.

You must save your file as a .py before text highlighting will show up for your python code in JEdit.

2 comments:

  1. I don't quit understand how to download this Python program on my computer. Will you explain in simple terms how I will accomplish this on my system. I am LITERALLY a beginner when it comes to the computer. I am in your Monday and Wednesday night class. Thank you.

    ReplyDelete
  2. Thanks for sharing the best information and suggestions they very nice and very useful to us. You made a good site it’s very interesting one.I am satisfied with your site and also your information.
    free python training
    http://www.thedatasciencelabs.com/

    ReplyDelete