Hi List, I use pywin32-217.win-amd64 for Python 2.7 on Windows 7 Professional.
I have written a script that uses the screenshot() function from the ImageGrab module of the Python Imaging library and I would like to run this script as a scheduled task. Now for the issues. In the task scheduler, if I select 'Run whether user is logged on or not', it does run, but the scheduler shows it as failed to run. This happens both when logged in or if logged in and session is locked So, I chose to use the 'Run only when user is logged on' option. Now, this works well, when logged on as well as if the session is locked. The problem is if I try to login remotely via RDP this stops working the moment I disconnect. In detail: I log in locally - it works I lock the session - still works I log in remotely to the same session (using mstsc /admin) - still works Now if I disconnect, or even if I minimize my remote session window, it fails. Also, if I log off locally and then try logging in remotely using RDP it works as long as I keep the remote session window open. If I disconnect or even minimize the RDP window, it stops working. Is there any option I could use to make it work under 'Run whether user is logged on or not' Task scheduler option? Maybe I could reduce the privilege level needed to execute python.exe? Any other option to make it run under the 'Run only when user is logged on' option? So that I can log in remotely and then disconnect and have it still work? My problem is I am using selenium webdriver to open a webpage and take a screenshot of it, though in this testing script I am just grabbing whatever is on screen at the point the script is run. Also will Firefox run if a user is not logged in? Code: ##--------------------------------------------------------------------- from ImageGrab import grab as screenshot from time import sleep sleep(2) # delay 2 seconds home_folder = 'C:/Users/ferdinand/Desktop/pics/' def grab_screen(file_path): pic = screenshot() pic.save('%s' % file_path) del pic import datetime d = datetime.datetime.now() filename = 'pic_%d.%02d_.png' % (d.hour,d.minute) LOG = '\n\n##-------------------------\nNew Instance\n' try: grab_screen(home_folder + filename) except Exception,e: LOG += e else: LOG += 'Created file %s' % filename f = open(home_folder + 'log.txt', 'a') f.write(LOG) f.close() ##---------------------------------------------------------------------
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32