views:

59

answers:

1

Hello,

I have the following two quesions:

1 I want to be able to shutdown windows xp from python code. I am able to do that by running the following code in the python console:

import os

os.system("shutdown -s -f")

But, if i put the same code in a .py file and try to execute it,it does not work. I get the help prompt for the shutdown command.Any way to fix this ?

2 Is there any way i can take a screenshot of the current screen using python on windows ?

Thank You

+2  A: 

There's some code to shutdown windows in this message from the python-win32 list.

You can take a screen shot using PIL's ImageGrab module.

ars