system32 directory

Tim Golden mail at timgolden.me.uk
Fri Mar 7 03:49:30 EST 2008


Robert Dailey wrote:
> On Thu, Mar 6, 2008 at 2:42 AM, Tim Golden <mail at timgolden.me.uk> wrote:
>> <fishing advice>
>> First thing to do when asking "How do I do X in Python under Windows?"
>> is to stick -- python X -- into Google and you get, eg:
>>
>>
>> http://aspn.activestate.com/ASPN/docs/ActivePython/2.2/PyWin32/win32api__GetSystemDirectory_meth.html
>>
>> which suggests that the win32api module from the pywin32 modules has
>> the function you need.
>> </fishing advice>
>>
>> And sure enough...
>>
>> <dump>
>> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
>> (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>  >>> import win32api
>>  >>> win32api.GetSystemDirectory ()
>> 'C:\\WINDOWS\\system32'
>>  >>>
>> </dump>
>>
>> TJG
>>
> 
> I was aiming to figure out if the standard modules shipped with Python could
> do this already before I started using 3rd party libraries. Thanks.

Ah. Sorry. I'm sure you can call it via ctypes (built in
from Python 2.5). But even if I'd realised that's what
you'd wanted, I'd probably have given the original answer
because pywin32 pretty much *is* standard library for any
Python installation I do on Win32 :)

TJG



More information about the Python-list mailing list