[python-win32] Python as scripting glue, WAS Python for sysadmin

Tim Golden Tim.Golden at viacom-outdoor.co.uk
Wed Dec 13 14:15:09 CET 2006


[Bokverket]
| The tasks on [Tim's] list that he has done/helped out with 
| lately are to a large extent useful jobs that an ordinary 
| user would love. Well, at least one who know how to program, 
| iow use Python as _the_ scripting language to glue all these 
| Micrsoft parts and apps together.  

| This would  require a wonderful Python-ish API on how to 
| access for example Outlook Express address lists, Word 
| and the file system.  Plus some wonderful examples of 
| useful examples and how to execute them in a Window 
| environment..

| IOW, making Python for Windows what AWK was for DOS :-)
| 
| Does this library already exist, easy-to-use?

[warning: bit of a ramble]

I suppose the short answer to this is: no. Not least 
because the remit of any such library would be huge:
Word, Outlook, Excel, Active Directory, WMI plus
all sorts of file system and network bits and pieces.
You'd probably spend months trying to formulate a
unified API of some sort, only to discover that you'd
re-implemented COM! That's not to dismiss your notion 
at all, just to give some kind of feeling of the 
enormity of the task. 

What complicates matters more (and I'm only
brushing over the surface here) is the fact that
several things are achievable via several different
routes. WMI, for example, offers a consistent wrapper
over a number of sys-adminy things but underneath it's
calling the Win32 APIs. The advantage of using the WMI
approach is that if you're using it for other things
it's just more of the same. The disadvantage is that
it's generally a bit slower and may not offer all
the control which the direct API offers.

Another issue I've found with several (abortive) modules
to wrap CDO, NTFS Security, Active Directory etc. is that
you find yourself reinventing the Microsoft API with
no real benefit. Also, inevitably, the time taken to
do it is always more than one first thought.

Of course one answer here is: document rather than
implement. ie rather than create some easy-to-use
all-embracing Windows package, create some useful
repository of Win32 admin code. This would also be
great but again requires much more dedication of
time than you might suppose. Existing possibilities
include:

+ the Python Cookbook which contains a Win32 section

+ the (apparently defunct) win32com.de site

+ The effbot's faq win32 section

+ my own all-too-small set of how-tos 

+ The archives of the Python, Python-win32 and Python-tutor lists

+ Loads of people's personal sites / blogs etc.

Given the effort, one might use the python.org
wiki to centralise things, but ISTM that this
requires much more input of time than perhaps one
realises.

Certainly my heart's in it but realistically I know
time is against me. My bread-and-butter comes from
SQL development and while I try to use Python as
much as I can, I'd be doing my employer a disservice
if I were to spend more time on Python-related things 
that didn't benefit my company.

What perhaps people don't realise is just how easy
it is to code up a Python solution pretty much from
scratch. Not infrequently when I answer a Win32
question on the mailing lists, I don't know the
answer to start with. I just Google for the obvious
terms and go from there. I do have the advantage of
having been a professional programmer for 16 years,
including 10 years of programming under Windows and
sometimes in Windows, and 7 years of using Python.
But I'm no rocket scientist, and a lot of the time
the question isn't "How can I do this in Python?"
but rather "How can I do this?" and the jump to
Python is nearly trivial.

There was a recent thread on python-dev in which
GvR was surprised at the (large) number of .msi
downloads from Python.org, indicating how popular
Python might be among Windoweers. My personal
quest is to encourage that popularity by answering
as many Win32-related Python questions as I can
and if I can generate (and maintain) useful and
more Pythonic modules to support that, then I
will.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list