473,545 Members | 1,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5126
[wi******@hotmai l.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****@ActiveSt ate.com
Jul 18 '05 #3
wi******@hotmai l.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_MAC HINE\SOFTWARE\M icrosoft\Office \11.0\Common\In stallRoot"
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_MAC HINE\SOFTWARE\M icrosoft\Office \11.0\Word\Inst allRoot"
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
4570
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 from embedded devices). Currently, we are using a heavyweight, proprietary log tool developed by another part of the company. This tool contains all...
6
2386
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 1234567'\0''\0''\0''\0''\0''\0''\0'...'\0' This is my first attempt: /* file.c -> file.exe */ #include <stdio.h>
29
16446
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 I *want* at the end of this; I just have never taken on a programming task of this magnitude. I've seen that some are using python as a utility...
16
3921
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 the normal bash commands (e.g. print instead of echo). My main reason for asking is that I like using Python for everything, and if I don't need to...
8
2291
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 getting is
14
7299
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
5182
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 language —I mean, it is not like C, in that sense. I am working on my PhD Thesis, which is about Operations Research,
2
1397
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 for me to finish it in a short time since I'm not very familiar with Python, so I want find some codes available, throught reading the code, I can...
2
5288
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 charm in cygwin, but when I try to use it directly in python under windows using active state python installation, it says it's missing the module...
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7391
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5962
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
693
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.