View Single Post
  #10  
Old 13th October 2011, 10:42 AM
jazzy jazzy is offline
Member
 
Join Date: Nov 2010
Posts: 49
Default

OK, This might be a longish post -

The Python setup/install programme doesn't seem to set the 'path' environment variable.. I dunno why not, it seems silly to me, and it always catches me out - I keep forgetting to tell new users that they have to set the path manually.

The Path environment variable is a ";" separated list of directories (folders) where the shell will search for an executable (Python.exe in this case)

So....With XP (Win 7 should be the same or similar at least)

Start -> Control Panel -> System
Advanced Tab
Environment Variables button ( near the bottom)

Select Path in the System Variables Scroll box (bottom one)
Click on Edit
Append ;C:\python27 to the value


To test it:

Open a command prompt
type python
you should get something like this:

Python 2.7.? (etc................)
Type "help", "copyright" etc....
>>>

Now test to make sure that the win32 extensions are installed correctly:

Type import win32com

You should get no error


Bingo! you're good to go. Type quit() to exit

Now, to run the script you can double click on the .py file and it should open a command prompt and run,,, but if there's an error it will stop and the command prompt will disappear before you can read what the error was.

Better to open a command prompt, change to the directory where the script is and run it from the command line.


-----------------

As an aside: I _think_ that the Python3.x installs now update the Path environment variable - but Python 3 is NOT backwardly compatible with 2, I'm starting to use 3 - but some of the 3rd party libraries I use haven't been ported over yet.
Reply With Quote