473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

checking if program is installing using python

i want to check to see if a certain program is installed on my windows
box using python. how can i do that...(ie, i want to see if "word" is
installed)

please help

Jul 18 '05 #1
4 5099
[wi******@hotmail.com wrote]
does this help?
http://aspn.activestate.com/ASPN/Coo...n/Recipe/52224


There is the "which" module that I wrote that does this a little more
robustly:
http://starship.python.net/~tmick/#which

However, I didn't see the original posting for this thread so I'm not
sure if this is what is being looked for.

Cheers,
Trent

--
Trent Mick
Tr****@ActiveState.com
Jul 18 '05 #3
wi******@hotmail.com wrote:
does this help?
http://aspn.activestate.com/ASPN/Coo...n/Recipe/52224


It's very rare that a program like Word is installed
in the PATH, so it's unlikely this helps.

Generally you would need to look in the registry, or
perhaps use os.popen() to parse the output of executing
the command "assoc .doc", to do what is required.

It might help for the OP to describe more about what
he plans to do with the information, since there might
be simpler/better approaches.

-Peter
Jul 18 '05 #4
GujuBoy wrote:
i want to check to see if a certain program is installed on my
windows box using python. how can i do that...(ie, i want to
see if "word" is installed)


This won't help you if you're after an off-the-cuff search for
installed apps, but if you need to determine the existence of a known
application in order to do something specific, this might be of some
use.

First, use the registry to determine the install location of the app.
(You might like to check out the following recipe, which deals with
accessing the registry via Python:
http://aspn.activestate.com/ASPN/Coo...n/Recipe/66011)

For example, to find the location where MS Office 2003 is installed,
you need to check the registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0 \Common\InstallRoot"
which has two values, the 2nd of which, "Path" is set to "C:\Program
Files\Microsoft Office\OFFICE11\" on my work PC.

Once you have the location, you can just use
os.path.exists(path-from-reg + "\Word.exe") to check that it's actually
there.

In some cases, such as with MSOffice, the key you need to refer to will
depend on the version installed. As mentioned, the regkey above is for
MS Office 2003, which is recorded in the registry as version 11.0. If
you're only concerned that they have an application installed without
caring what version they're using, you'll need to check for several
keys to find the information you're looking for. (Office XP is 10.0,
Office 2K is 9.0, etc) Office is pretty consistent about this between
versions but other applications (such as the godawful virus checker we
use here) can't be counted on being quite as helpful.

Also worth noting if you're actually interested in testing for the
existence of Office apps is that each member of the Office suite can
have its own install location. So if you're only checking for Word, the
key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0 \Word\InstallRoot"
would be more relevant than the common install area given above.

Hopefully something in this somewhere will help :)

-alex23

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
6
by: RoSsIaCrIiLoIA | last post by:
Do you know how to write a self-checking program in standard C? Do I can think that if I write in a file.c static g="1234567"; in the file.exe (or file) there is in some place...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
16
by: John Salerno | last post by:
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of...
8
by: Eric_Dexter | last post by:
I was looking for a simple way to load a simple python program from another python program. I tried os.system(cabel) The file name is cabel.py a csound instrument editor.. The error I am...
14
by: Nathan Pinno | last post by:
How do I factor a number? I mean how do I translate x! into proper Python code, so that it will always do the correct math? Thanks in advance, Nathan P.
53
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming...
2
by: Royt | last post by:
Hi, I'm a newbie to Python, but I think it won't be too hard to learn. A few days ago I registered Google App Engine, it only support Python 2.5. I want to set my blog on it soon. But it's not easy...
2
by: Holger | last post by:
Hi I'm using python Serial from: http://switch.dl.sourceforge.net/sourceforge/pyserial/pyserial-2.4.tar.gz to implement ymodem and other protocols on the PC com port And it works like a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.