Re: [python-win32] Take Screenshot when you log in remotely [Win 7 Pro]
Hi Tim, Thanks a lot for the inputs. Earlier (Win Xp I think), I was told (erroneously?) that using the /console switch with the mstsc command would enable you to connect into a currently running local user session. Is this info incorrect? Or is it that you are able to connect to the said session, but it changes to a remote session? I would tend to think it is the latter. Also, now with Win 7 (client is Professional and machine I'm connecting to is also Professional) mstsc seems to no longer have the /console switch. I guess I just have to bite the bullet and work with this. My **specific issue** is that my scenario works pretty well with task scheduling and leaving the local session locked. However, if I log in remotely using the same user (session become remote I guess), or even a different user (disconnects the local user's session) the screenshot can no longer be taken. Best regards, Ferdi > -- Forwarded message -- > From: Tim Roberts > To: "python-win32@python.org" > Cc: "image-sig-requ...@python.org" > Date: Thu, 5 Jul 2012 10:24:51 -0700 > Subject: Re: [python-win32] Take Screenshot when you log in remotely [Win > 7 Pro] > Ferdinand Sousa wrote: > > > > 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. > > Right. When you disconnect the session, there no longer is any screen > to take a shot of. Screenshots are implemented by calling the graphics > driver. A disconnected session does not have a graphics driver. > Windows does not keep a backing store copy of a session's frame buffer > anywhere. When a disconnected session is reconnected, all of the > applications are sent "paint" messages to force the screen to be > repainted from scratch. > > > > 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? > > That won't help. What you ask is simply not possible. The bits you > want to grab do not exist. > > -- > Tim Roberts, t...@probo.com > Providenza & Boekelheide, Inc. > > ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Does pywin32 support SD card operation (IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?
Hi All, Does pywin32 support SD card operation (IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)? I google IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL with Python. However, no useful information shows up. My code: if win32file.DeviceIoControl(hVol, winioctlcon.IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL, 0, 6, 0): Error message: AttributeError: 'module' object has no attribute "IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL". Thank you, Jane___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] problem After compiling with py2exe on a com class
Hi all, I got a com server that is crated inside a cad application. if i run the following code(That is a method of my com class): def showWindows(self): """ show a qt windows with a button """ try: logging.info("showWindows .") nDocument=str(self.td.Documents.Count) form=EditInputBox(nDocument) # <-- this is a pyqt dialog form.exec_() logging.info("After Exec %s"%str(self.td.Documents.Count)) return S_OK except: print_exc_plus() return 1 and I'm using the normal python source script, all work ok. but if I py2exe the com server,( .exe ) and i run the some code, and I leave the dialog opened for more than a minute I got the following exception from the self.td.Documents.Count that is a method of the cad application. It seems a problem releted to a timeout or releted to the garbage collector. Any Idea in how to debug it or how to find a solution to this problem is really appreciated. regards Matteo ERROR:root: ERROR:root: ERROR:root:(-2147417856, 'System call failed.', None, None) ERROR:root: ERROR:root: ERROR:root:Locals by frame, innermost last ERROR:root:Frame in boot_com_servers.py at line 112 ERROR:root: get_classes = ERROR:root: DllUnregisterServer = 0x02D5C470> ERROR:root: arg = /automate ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root: __package__ = None ERROR:root:com_module_names = ['testCom'] ERROR:root: __doc__ = None ERROR:root: zipextimporter = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\zipextimporter.pyc'> ERROR:root:__builtins__ = ERROR:root: sys = ERROR:root:__name__ = __main__ ERROR:root: com_modules = ['C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'>] ERROR:root: DllRegisterServer = 0x02D5C330> ERROR:root: i = 1 ERROR:root: k = ERROR:root: m = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'> ERROR:root: DllInstall = ERROR:root:win32com = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32com\__init__.pyc'> ERROR:root: pythoncom = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\pythoncom27.dll'> ERROR:root:win32api = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32api.pyd'> ERROR:root:Frame serve in win32com\server\localserver.pyc at line 36 ERROR:root: infos = [(with obj at 0x02F43B08>, 16)] ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root:Frame _Invoke_ in win32com\server\policy.pyc at line 277 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invoke_ in win32com\server\policy.pyc at line 282 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invokeex_ in win32com\server\policy.pyc at line 585 ERROR:root: serviceProvider = None ERROR:root:self = ERROR:root:args = () ERROR:root: dispid = 1001 ERROR:root:funcname = showWindows ERROR:root: wFlags = 3 ERROR:root:lcid = 0 ERROR:root:func = TestComInterface.showWindows of 0x02D72810>> ERROR:root: kwArgs = None ERROR:root:Frame showWindows in testCom.pyc at line 133 ERROR:root:self = at 0x02D72810> ERROR:root: nDocument = 1 ERROR:root:form = 0x05482588> ERROR:root:Frame __getattr__ in win32com\client\__init__.pyc at line 466 ERROR:root:self = thinkdesign Type Library.IApplication instance at 0x49209832> ERROR:root:args = (11, 2, (9, 0), (), 'Documents', '{91D219D5-0F56-11D3-BD73-00500400405B}') ERROR:root:attr = Documents ERROR:root:Frame _ApplyTypes_ in win32com\client\__init__.pyc at line 459 ERROR:root: resultCLSID = {91D219D5-0F56-11D3-BD73-00500400405B} ERROR:root: dispid = 11 ERROR:root:self = thinkdesign Type Library.IApplication instance at 0x49209832> ERROR:root:args = () ERROR:root: retType = (9, 0) ERROR:root:argTypes = () ERROR:root:
Re: [python-win32] problem After compiling with py2exe on a com class
On 17/07/2012 8:37 AM, Matteo Boscolo wrote: Hi all, I got a com server that is crated inside a cad application. if i run the following code(That is a method of my com class): def showWindows(self): """ show a qt windows with a button """ try: logging.info("showWindows .") nDocument=str(self.td.Documents.Count) form=EditInputBox(nDocument) # <-- this is a pyqt dialog form.exec_() logging.info("After Exec %s"%str(self.td.Documents.Count)) return S_OK except: print_exc_plus() return 1 and I'm using the normal python source script, all work ok. but if I py2exe the com server,( .exe ) When you run it from normal Python, is the .exe or .dll version of the object used? Depending on the creator of the object, the default is likely to be the inproc (ie, dll) version. You should verify this and ensure py2exe creates the same kind of server. Apart from that, I'm afraid I have no idea... HTH, Mark and i run the some code, and I leave the dialog opened for more than a minute I got the following exception from the self.td.Documents.Count that is a method of the cad application. It seems a problem releted to a timeout or releted to the garbage collector. Any Idea in how to debug it or how to find a solution to this problem is really appreciated. regards Matteo ERROR:root: ERROR:root: ERROR:root:(-2147417856, 'System call failed.', None, None) ERROR:root: ERROR:root: ERROR:root:Locals by frame, innermost last ERROR:root:Frame in boot_com_servers.py at line 112 ERROR:root: get_classes = ERROR:root: DllUnregisterServer = ERROR:root: arg = /automate ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root: __package__ = None ERROR:root:com_module_names = ['testCom'] ERROR:root: __doc__ = None ERROR:root: zipextimporter = ERROR:root:__builtins__ = ERROR:root: sys = ERROR:root:__name__ = __main__ ERROR:root: com_modules = [] ERROR:root: DllRegisterServer = ERROR:root: i = 1 ERROR:root: k = ERROR:root: m = ERROR:root: DllInstall = ERROR:root:win32com = ERROR:root: pythoncom = ERROR:root:win32api = ERROR:root:Frame serve in win32com\server\localserver.pyc at line 36 ERROR:root: infos = [(, 16)] ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root:Frame _Invoke_ in win32com\server\policy.pyc at line 277 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invoke_ in win32com\server\policy.pyc at line 282 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invokeex_ in win32com\server\policy.pyc at line 585 ERROR:root: serviceProvider = None ERROR:root:self = ERROR:root:args = () ERROR:root: dispid = 1001 ERROR:root:funcname = showWindows ERROR:root: wFlags = 3 ERROR:root:lcid = 0 ERROR:root:func = > ERROR:root: kwArgs = None ERROR:root:Frame showWindows in testCom.pyc at line 133 ERROR:root:self = ERROR:root: nDocument = 1 ERROR:root:form = ERROR:root:Frame __getattr__ in win32com\client\__init__.pyc at line 466 ERROR:root:self = ERROR:root:args = (11, 2, (9, 0), (), 'Documents', '{91D219D5-0F56-11D3-BD73-00500400405B}') ERROR:root:attr = Documents ERROR:root:Frame _ApplyTypes_ in win32com\client\__init__.pyc at line 459 ERROR:root: resultCLSID = {91D219D5-0F56-11D3-BD73-00500400405B} ERROR:root: dispid = 11 ERROR:root:self = ERROR:root:args = () ERROR:root: retType = (9, 0) ERROR:root:argTypes = () ERROR:root: wFlags = 2 ERROR:root:user = Documents ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?
That one isn't in winioctlcon.py yet, but you should be able to define it relatively easily. According to the headers: #define IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL \ CTL_CODE( FILE_DEVICE_DISK, 0x7a0, METHOD_BUFFERED, FILE_ANY_ACCESS) You'll probably need to create the output buffer yourself and initialize the Size correctly. typedef struct _SFFDISK_QUERY_DEVICE_PROTOCOL_DATA { USHORT Size; USHORT Reserved; GUID ProtocolGUID; } Roger ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] problem After compiling with py2exe on a com class
Il 17/07/2012 03:19, Mark Hammond ha scritto: On 17/07/2012 8:37 AM, Matteo Boscolo wrote: Hi all, I got a com server that is crated inside a cad application. if i run the following code(That is a method of my com class): def showWindows(self): """ show a qt windows with a button """ try: logging.info("showWindows .") nDocument=str(self.td.Documents.Count) form=EditInputBox(nDocument) # <-- this is a pyqt dialog form.exec_() logging.info("After Exec %s"%str(self.td.Documents.Count)) return S_OK except: print_exc_plus() return 1 and I'm using the normal python source script, all work ok. but if I py2exe the com server,( .exe ) When you run it from normal Python, is the .exe or .dll version of the object used? it's an exe file not a dll Depending on the creator of the object, the default is likely to be the inproc (ie, dll) version. You should verify this and ensure py2exe creates the same kind of server. Apart from that, I'm afraid I have no idea... HTH, Mark and i run the some code, and I leave the dialog opened for more than a minute I got the following exception from the self.td.Documents.Count that is a method of the cad application. It seems a problem releted to a timeout or releted to the garbage collector. Any Idea in how to debug it or how to find a solution to this problem is really appreciated. regards Matteo ERROR:root: ERROR:root: ERROR:root:(-2147417856, 'System call failed.', None, None) ERROR:root: ERROR:root: ERROR:root:Locals by frame, innermost last ERROR:root:Frame in boot_com_servers.py at line 112 ERROR:root: get_classes = 0x02C134F0> ERROR:root: DllUnregisterServer = ERROR:root: arg = /automate ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root: __package__ = None ERROR:root:com_module_names = ['testCom'] ERROR:root: __doc__ = None ERROR:root: zipextimporter = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\zipextimporter.pyc'> ERROR:root:__builtins__ = ERROR:root: sys = ERROR:root:__name__ = __main__ ERROR:root: com_modules = ['C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'>] ERROR:root: DllRegisterServer = ERROR:root: i = 1 ERROR:root: k = ERROR:root: m = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\testCom.pyc'> ERROR:root: DllInstall = 0x02D5C4B0> ERROR:root:win32com = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32com\__init__.pyc'> ERROR:root: pythoncom = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\pythoncom27.dll'> ERROR:root:win32api = 'C:\d\OMNIAS~1\PROGRA~1\ECLIPS~1\ALLPUR~1\THINKD~1\TestCom\dist\testCom.exe\win32api.pyd'> ERROR:root:Frame serve in win32com\server\localserver.pyc at line 36 ERROR:root: infos = [(, 16)] ERROR:root: clsids = ['{1E685399-2991-4E3D-8217-22DE9CFBEAF6}'] ERROR:root:Frame _Invoke_ in win32com\server\policy.pyc at line 277 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invoke_ in win32com\server\policy.pyc at line 282 ERROR:root: wFlags = 3 ERROR:root:args = () ERROR:root:lcid = 0 ERROR:root: dispid = 1001 ERROR:root:self = ERROR:root:Frame _invokeex_ in win32com\server\policy.pyc at line 585 ERROR:root: serviceProvider = None ERROR:root:self = ERROR:root:args = () ERROR:root: dispid = 1001 ERROR:root:funcname = showWindows ERROR:root: wFlags = 3 ERROR:root:lcid = 0 ERROR:root:func = > ERROR:root: kwArgs = None ERROR:root:Frame showWindows in testCom.pyc at line 133 ERROR:root:self = ERROR:root: nDocument = 1 ERROR:root:form = ERROR:root:Frame __getattr__ in win32com\client\__init__.pyc at line 466 ERROR:root:self = ERROR:root:args = (11, 2, (9, 0), (), 'Documents', '{91D219D5-0F56-11D3-BD73-00500400405B}') ERROR:root:attr = Documents ERROR:root:Frame _ApplyTypes_ in win32com\client\__init__.pyc at line 459 ERROR:root: resultCLSID = {91D219D5-0F56-1