[python-win32] Win32 Mode
Mark Hammond
mhammond at skippinet.com.au
Mon Dec 1 19:50:19 EST 2003
> >That's not what seems to be happening. Here's the entire code:
> >
> > import win32api
> > win32api.InitiateSystemShutdown ('', '', 0, 1, 1)
> >
> >and this is the result:
> >
> > Traceback (most recent call last):
> > File "try.py", line 9, in ?
> > win32api.InitiateSystemShutdown ('', '', 0, 1, 1)
> > pywintypes.error: (120, 'InitiateSystemShutdown', 'This
> function is
> > only valid in Win32 mode.')
This error means "not available on Win9x" - I wish they just said that in
the error message :)
> Doing this on Win 2003 Server, logged on as administrator, yields:
>
> >>> win32api.InitiateSystemShutdown ('', '', 0, 1, 1)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> pywintypes.error: (5, 'InitiateSystemShutdown', 'Access is denied.')
This is also expected - you have to use the win32security module to gain the
'privilege' to perform this operation - google should have a number of
example (and 'Python Programming on Win32' certainly does ;)
Mark.
More information about the Python-win32
mailing list