Starting Python in XP Pro

Dave Angel davea at ieee.org
Tue Oct 19 18:33:31 EDT 2010


  On 10/19/2010 3:06 PM, Grant Andrew wrote:
> 1. Okay, I can open the interpreter and do math.  If only I needed the
> answer to 6*7 I'd be great.  But, to your point, Python is installed and
> working.
>
> 2.  When I went to the shortcut and hit properties, the path was
>
> Target: C:\Python26\Lib\idlelib\idle.bat
> Start in: C:\Python26\
>
> I cd'd to C:\Python26\ at the command prompt and ran Lib\idlelib\idle.bat.
>
> It just reprints C:\Python26\ with no error or message.  Looks like this:
>
> C:\Python26>Lib\idlelib\idle.bat
> C:\Python26>
>
> 3.  I created a simple file in Wordpad that prints a few lines.  It is
> called Print.py but I'm not sure where the 'code' folder is.  I'm not
> familiar enough with Python to locate a file from the Interpreter and open
> it.
>
> 4.  I also tried editing the PATH variable, which did have both versions in
> it, but with no success - same error.
>
>
> Thanks for your help...
>
> Grant
>
> <snip

(You top-posted, so I'm removing all the stuff that's now out of order)

Your PATH should never have two versions of the same program system in 
it.  So if two different installs are in your system PATH, you should 
(using the control panel) remove the one you're not using.  Remember 
that existing programs aren't affected by changes in the system PATH.

The code directory is wherever you write your .py file(s).  The point is 
it should not be in the middle of the installation directory, but 
somewhere else you chose.

I use
m:\programming\python\sources

and then make a subdirectory under there.  Only when a script is working 
reliably do I copy it to a place on my PATH, like m:\t\bin   Once I do, 
it's as accessible as any other executable on the PATH.

Wordpad creates rtf files by default, which are useless to the python 
interpreter.  You want a text file.  You can do it with the SaveAs 
dialog, by changing the "Save as type" from "Rich Text Format" to "Text 
Document".

However, it'd be easier to just use a text editor, such as Notepad.  Or 
one of dozens of other text editors, most free, that you can install.

Anyway, once you've got a text file called   print.py, in the 
c:\sourceCode directory, try the following:

c:\someOtherPlace> cd \sourceCode
c:\sourceCode> python print.py

and see if it loads and runs correctly.

If that works, then you can try typing:

c:\sourceCode> print.py

and if that works, you can try:

c:\sourceCode> print

Note that there's already a print.exe program in Windows, in the 
system32 directory, so this might not be a good name for this particular 
test.

If this all works, and Idle doesn't, someone else will have to help.

DaveA




More information about the Python-list mailing list