Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Tony Cappellini
> To me the bigger criticism is that there are probably 600 other programs > that do the same > thing, but what fun would it be for me to use someone > else's program... got it. I'll take a look at your program. ___ python-win32 mailing list python-

Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Alec Bennett
> Is this capability not already part of XP? > I've got my machines set to go to sleep after 1 hour, > no programming needed. > Right click on the Desktop, Properties, ScreenSaver, Power. A couple of problems with doing it like that: 1) if you set your computer to go to sleep after X minutes, you

Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Tony Cappellini
Message: 3 Date: Fri, 05 Dec 2008 08:40:32 -0600 From: Mike Driscoll <[EMAIL PROTECTED]> Subject: Re: [python-win32] rebooting windows from Python? To: [EMAIL PROTECTED] Cc: Python-Win32 List Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Mike Driscoll
Alec, I've been using the following method that I found on ActiveState's Cookbook, which I modified a little (http://code.activestate.com/recipes/360649/): Does that method ever hang during shutdown? I've tested the WMI method a few times and got one hang, where it was asking me to termi

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
> I've been using the following method that I found on > ActiveState's Cookbook, which I modified a little > (http://code.activestate.com/recipes/360649/): Does that method ever hang during shutdown? I've tested the WMI method a few times and got one hang, where it was asking me to terminate a pr

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Mike Driscoll
Alec, And thus I say for the second time in 24 hours: Eureka! For anyone else coming down this path, here's how to shutdown, reboot or logoff Windows, each with the option to force the action. In other words, you can force Windows to reboot even if its asking if you want to save a document.

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
And thus I say for the second time in 24 hours: Eureka! For anyone else coming down this path, here's how to shutdown, reboot or logoff Windows, each with the option to force the action. In other words, you can force Windows to reboot even if its asking if you want to save a document. nLogOf

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Tim Golden
Alec Bennett wrote: import wmi wmi.WMI(privileges=["Shutdown"]).Win32_OperatingSystem()[0].Shutdown () Stylin, works. The only thing it doesn't do that I personally need it to do is the "force shutdown". In other words "shutdown.exe -f". I found this page with some hints but couldn't get

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
> > import wmi > > wmi.WMI(privileges=["Shutdown"]).Win32_OperatingSystem()[0].Shutdown () > > Stylin, works. The only thing it doesn't do that I personally need it to do is the "force shutdown". In other words "shutdown.exe -f". I found this page with some hints but couldn't get it to work:

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Tim Golden
Tim Roberts wrote: Alec Bennett wrote: I'm wondering if there's some way to reboot or shutdown Windows from within Python? I can log out like this: win32api.ExitWindowsEx(4) And according to the documentation, I should be able to shutdown like this: win32api.ExitWindowsEx(2) But that retur

Re: [python-win32] rebooting windows from Python?

2008-12-04 Thread Wesley Brooks
To restart I use: outFileObject = os.popen("shutdown -r -t 05", 'r') To shutdown swap -r for -s. This is the same as running the "shutdown -r -t 05" on the command prompt. The number is the delay and the outFileObject catches any messages that would be printed out to the command prompt window.

Re: [python-win32] rebooting windows from Python?

2008-12-04 Thread Tim Roberts
Alec Bennett wrote: > I'm wondering if there's some way to reboot or shutdown Windows from within > Python? > > I can log out like this: > > win32api.ExitWindowsEx(4) > > And according to the documentation, I should be able to shutdown like this: > > win32api.ExitWindowsEx(2) > > But that returns

[python-win32] rebooting windows from Python?

2008-12-04 Thread Alec Bennett
I'm wondering if there's some way to reboot or shutdown Windows from within Python? I can log out like this: win32api.ExitWindowsEx(4) And according to the documentation, I should be able to shutdown like this: win32api.ExitWindowsEx(2) But that returns the following error: 'A required priv