From mvilas at gmail.com Tue Dec 1 04:48:08 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Tue, 1 Dec 2009 00:48:08 -0300 Subject: [python-win32] WinAppDbg 1.3 is out! Message-ID: <3fbf862f0911301948r6024071r266fe7a3dbe6927f@mail.gmail.com> What is WinAppDbg? ================== The WinAppDbg python module allows developers to quickly code instrumentation scripts in Python under a Windows environment. It uses ctypes to wrap many Win32 API calls related to debugging, and provides an object-oriented abstraction layer to manipulate threads, libraries and processes, attach your script as a debugger, trace execution, hook API calls, handle events in your debugee and set breakpoints of different kinds (code, hardware and memory). Additionally it has no native code at all, making it easier to maintain or modify than other debuggers on Windows. The intended audience are QA engineers and software security auditors wishing to test / fuzz Windows applications with quickly coded Python scripts. Several ready to use utilities are shipped and can be used for this purposes. Current features also include disassembling x86 native code (using the open source diStorm project, see http://ragestorm.net/distorm/), debugging multiple processes simultaneously and produce a detailed log of application crashes, useful for fuzzing and automated testing. Where can I find WinAppDbg? =========================== Project homepage: ----------------- http://tinyurl.com/winappdbg Download links: --------------- Windows installer (32 bits) http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.win32.msi/download http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.win32.exe/download Windows installer (64 bits) http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.win-amd64.msi/download http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.win-amd64.exe/download Source code http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.zip/download http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.tar.bz2/download Documentation: -------------- Online http://winappdbg.sourceforge.net/doc/v1.3/ http://sourceforge.net/apps/trac/winappdbg/wiki/ProgrammingGuide For download: http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.chm/download http://sourceforge.net/projects/winappdbg/files/WinAppDbg/1.3/winappdbg-1.3.pdf/download What's new in this version? =========================== In a nutshell... * 64 bits support. * Windows Vista and 7 support. * Memory dumping support. * Wait chain support. * New tool: SelectMyParent (based on the tool by Didier Stevens). * More code examples. * Supports detecting the current processor architecture and Windows version. * Crash logger works with SQLite databases in addition to the old DBM format. It also has a smaller memory footprint now. * Win32 API wrappers were refactored and improved. Many new definitions and API calls were added, up to Windows 7. * Many bugfixes as usual... :) also several improvements to make the code more robust. Here's the full changelog: http://sourceforge.net/apps/trac/winappdbg/log/trunk?verbose=on&format=changelog&stop_rev=237&limit=300&mode=stop_on_copy From skippy.hammond at gmail.com Tue Dec 1 12:33:43 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 01 Dec 2009 22:33:43 +1100 Subject: [python-win32] Options for running Python under IIS? In-Reply-To: <796c415c0911301413m17ceaac3vd8140b2c9c576e09@mail.gmail.com> References: <796c415c0911111503i624835bcvecf3eb11f3a73f66@mail.gmail.com> <796c415c0911301413m17ceaac3vd8140b2c9c576e09@mail.gmail.com> Message-ID: <4B14FF17.1080603@gmail.com> On 1/12/2009 9:13 AM, Preston Landers wrote: > I just thought I'd follow up on my original post about IIS. We > decided to go ahead and use isapi-wsgi and so far the results are very > good. It won't go into official production for a while but it looks > very promising. In order to avoid the threading issue (we do in fact > use mutable module level variables) we are using the "simple" > (non-threaded) base class. To achieve concurrency we're using the IIS > "web garden" feature, which is the config setting Randy mentioned to > allow multiple worker processes per application pool. We're > configuring the app pool through ADSI, the same way Python-ISAPI > configures itself. Awesome - thanks for the update. I've CCd the isapi-wsgi list for their info. > Speaking of which - it seems like the ADSI stuff for IIS might be > deprecated? I only say that because it's not installed by default in > newer versions of Windows and must be selected as "IIS Metabase and > IIS 6 configuration compatibility" in the Windows feature selection. > That's not a problem for my app - the installer detects the lack of > this component. But calling it "IIS 6 configuration compatibility" > seems to suggest ADSI might eventually go away. Or maybe it doesn't - > does anyone know? I'm just wondering if Python-ISAPI might > eventually have to be updated to use WMI for configuration instead. > Links like this which compare ADSI and WMI don't say anything about > ADSI being deprecated. It's just not installed by default for IIS 7+. Yeah - that is my impression too. I'd welcome patches which move to WMI (but sadly, I doubt I will get to it for a while...) Thanks, Mark From jckdnk111 at yahoo.com Wed Dec 2 17:46:51 2009 From: jckdnk111 at yahoo.com (tyju tiui) Date: Wed, 2 Dec 2009 08:46:51 -0800 (PST) Subject: [python-win32] compiling IP2Location extention on win32 Message-ID: <632095.57098.qm@web51405.mail.re2.yahoo.com> Hi, I am trying to compile the python C extension from IP2Location: http://www.ip2location.com/python.aspx I'm not sure what I am doing wrong but the full error message is here: http://jckdnk111.pastebin.com/f71e8ff3d I am on Windows 7 32-bit with python 2.6.3 installed from the python.org windows installer. I have MS Visual Studio 2008. Any help or advice would be greatly appreciated. Thanks! Ty From timr at probo.com Wed Dec 2 20:02:37 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 02 Dec 2009 11:02:37 -0800 Subject: [python-win32] compiling IP2Location extention on win32 In-Reply-To: <632095.57098.qm@web51405.mail.re2.yahoo.com> References: <632095.57098.qm@web51405.mail.re2.yahoo.com> Message-ID: <4B16B9CD.6090502@probo.com> tyju tiui wrote: > I am trying to compile the python C extension from IP2Location: http://www.ip2location.com/python.aspx > I'm not sure what I am doing wrong but the full error message is here: http://jckdnk111.pastebin.com/f71e8ff3d > > I am on Windows 7 32-bit with python 2.6.3 installed from the python.org windows installer. > I have MS Visual Studio 2008. > > Any help or advice would be greatly appreciated. > I can't tell from their web site whether they've ever built this on Windows or not. They have a confusion over whether they're going to use the static C runtime library or the dynamic C runtime library. You can try doing this before you do the build: set LINK=/nod:msvcrt.lib but I suspect you're going to need to contact the IP2Location people to see if they support Python 2.6 on Windows. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jckdnk111 at yahoo.com Wed Dec 2 21:14:30 2009 From: jckdnk111 at yahoo.com (tyju tiui) Date: Wed, 2 Dec 2009 12:14:30 -0800 (PST) Subject: [python-win32] compiling IP2Location extention on win32 In-Reply-To: <4B16B9CD.6090502@probo.com> References: <632095.57098.qm@web51405.mail.re2.yahoo.com> <4B16B9CD.6090502@probo.com> Message-ID: <467123.41323.qm@web51408.mail.re2.yahoo.com> Brilliant! Tim, thank you so much. You just solved a problem I have been fighting for a week. I owe you a beer or drink of your choice. Thanks again! Ty ----- Original Message ---- From: Tim Roberts To: Python-Win32 List Sent: Wed, December 2, 2009 2:02:37 PM Subject: Re: [python-win32] compiling IP2Location extention on win32 tyju tiui wrote: > I am trying to compile the python C extension from IP2Location: http://www.ip2location.com/python.aspx > I'm not sure what I am doing wrong but the full error message is here: http://jckdnk111.pastebin.com/f71e8ff3d > > I am on Windows 7 32-bit with python 2.6.3 installed from the python.org windows installer. > I have MS Visual Studio 2008. > > Any help or advice would be greatly appreciated. > I can't tell from their web site whether they've ever built this on Windows or not. They have a confusion over whether they're going to use the static C runtime library or the dynamic C runtime library. You can try doing this before you do the build: set LINK=/nod:msvcrt.lib but I suspect you're going to need to contact the IP2Location people to see if they support Python 2.6 on Windows. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From jckdnk111 at yahoo.com Wed Dec 2 17:37:30 2009 From: jckdnk111 at yahoo.com (tyju tiui) Date: Wed, 2 Dec 2009 08:37:30 -0800 (PST) Subject: [python-win32] compiling IP2Location extention on win32 Message-ID: <370700.51882.qm@web51405.mail.re2.yahoo.com> Hi, I am trying to compile the python C extension from IP2Location: http://www.ip2location.com/python.aspx I'm not sure what I am doing wrong but the full error message is here: http://jckdnk111.pastebin.com/f71e8ff3d I am on Windows 7 32-bit with python 2.6.3 installed from the python.org windows installer. I have MS Visual Studio 2008. Any help or advice would be greatly appreciated. Thanks! Ty From jeffpeery at yahoo.com Fri Dec 4 01:38:22 2009 From: jeffpeery at yahoo.com (Jeff Peery) Date: Thu, 3 Dec 2009 16:38:22 -0800 (PST) Subject: [python-win32] win32com on vista Message-ID: <236632.44150.qm@web43142.mail.sp1.yahoo.com> hello, I've got a wxpython app that uses win32com and I've packaged it all up using py2exe. I'm having a problem because the win32com.client.gencache.py appears to be creating some directories/files in the installation directoy (which is under program files) and a non admin user doesn't have write to do this. why is it creating these files and can I redirect them to another place like that application data folder? ? thanks, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Fri Dec 4 02:06:26 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 04 Dec 2009 12:06:26 +1100 Subject: [python-win32] win32com on vista In-Reply-To: <236632.44150.qm@web43142.mail.sp1.yahoo.com> References: <236632.44150.qm@web43142.mail.sp1.yahoo.com> Message-ID: <4B186092.9020400@gmail.com> On 4/12/2009 11:38 AM, Jeff Peery wrote: > hello, > I've got a wxpython app that uses win32com and I've packaged it all up > using py2exe. I'm having a problem because the > win32com.client.gencache.py appears to be creating some > directories/files in the installation directoy (which is under program > files) and a non admin user doesn't have write to do this. why is it > creating these files and can I redirect them to another place like that > application data folder? The best solution is probably to arrange for the pre-generated modules to be included in the py2exe distribution - there are some docs on this in the py2exe directory. Alternatively, check out win32com\__init__.py and look for how __gen_path__ is setup. HTH, Mark From jeffpeery at yahoo.com Fri Dec 4 18:27:24 2009 From: jeffpeery at yahoo.com (Jeff Peery) Date: Fri, 4 Dec 2009 09:27:24 -0800 (PST) Subject: [python-win32] win32com on vista In-Reply-To: <4B186092.9020400@gmail.com> Message-ID: <553133.54345.qm@web43137.mail.sp1.yahoo.com> ok, >From what I understand the gen_py creates the files needed for the COM object to run. I can?create them ahead of time and put them in the py2exe or I can create them on the fly. I am forced to create them as needed because I don't know exactly which com objects to package up. So,?if I simpy delete the gen_py directory or rename it then the files are created under the user temp directory. this I think would solve the problem. ? My understanding of this is still shakey. I'm not using EnsureDispatch, just win32com.client.Dispatch. Does?it matter? the Py2exe docs discussed only EnsureDispatch. ? thanks! Jeff --- On Thu, 12/3/09, Mark Hammond wrote: From: Mark Hammond Subject: Re: [python-win32] win32com on vista To: "Jeff Peery" Cc: python-win32 at python.org Date: Thursday, December 3, 2009, 5:06 PM On 4/12/2009 11:38 AM, Jeff Peery wrote: > hello, > I've got a wxpython app that uses win32com and I've packaged it all up > using py2exe. I'm having a problem because the > win32com.client.gencache.py appears to be creating some > directories/files in the installation directoy (which is under program > files) and a non admin user doesn't have write to do this. why is it > creating these files and can I redirect them to another place like that > application data folder? The best solution is probably to arrange for the pre-generated modules to be included in the py2exe distribution - there are some docs on this in the py2exe directory. Alternatively, check out win32com\__init__.py and look for how __gen_path__ is setup. HTH, Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Fri Dec 4 23:38:32 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 05 Dec 2009 09:38:32 +1100 Subject: [python-win32] win32com on vista In-Reply-To: <553133.54345.qm@web43137.mail.sp1.yahoo.com> References: <553133.54345.qm@web43137.mail.sp1.yahoo.com> Message-ID: <4B198F68.30803@skippinet.com.au> On 5/12/2009 4:27 AM, Jeff Peery wrote: > ok, > From what I understand the gen_py creates the files needed for the COM > object to run. I can create them ahead of time and put them in the > py2exe or I can create them on the fly. I am forced to create them as > needed because I don't know exactly which com objects to package up. So, > if I simpy delete the gen_py directory or rename it then the files are > created under the user temp directory. this I think would solve the > problem. > My understanding of this is still shakey. I'm not using EnsureDispatch, > just win32com.client.Dispatch. Does it matter? the Py2exe docs discussed > only EnsureDispatch. Simply using Dispatch() should not attempt to generate a file - but regardless of how it is being triggered, things should work fine once you arrange for the gen_py directory to be somewhere writable. HTH, Mark From tomslists at netp.org Sun Dec 6 20:08:36 2009 From: tomslists at netp.org (Tom Pacheco) Date: Sun, 06 Dec 2009 14:08:36 -0500 Subject: [python-win32] Com questions. Message-ID: <4B1C0134.40203@netp.org> how do you manually wrap a com object with an makepy generated class? dyobj = win32com.client.GetObject('DynamicClassName') dyobj is a dynamic and i cant call ref returning functions with it. i have TLB file for interface it supports i ran makepy on it and can load the module. ifmod = win32com.client.gencache.GetModuleForTypelib(typelibCLSID, lcid, major, minor) is it as simple as: pyobj = ifmod.InterfaceClassName(dyobj._oleobj_) is there a way to list the names in the gencache? ie.. 'Word.Application' 'Excel.Application' how do you get the guid from _oleobj_? Thanks - Tom From skippy.hammond at gmail.com Mon Dec 7 04:05:00 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 07 Dec 2009 14:05:00 +1100 Subject: [python-win32] Com questions. In-Reply-To: <4B1C0134.40203@netp.org> References: <4B1C0134.40203@netp.org> Message-ID: <4B1C70DC.2070501@gmail.com> On 7/12/2009 6:08 AM, Tom Pacheco wrote: > > how do you manually wrap a com object with an makepy generated class? > > dyobj = win32com.client.GetObject('DynamicClassName') > dyobj is a dynamic and i cant call ref returning functions with it. > > i have TLB file for interface it supports i ran makepy on it and can > load the module. > ifmod = win32com.client.gencache.GetModuleForTypelib(typelibCLSID, lcid, > major, minor) > > is it as simple as: > pyobj = ifmod.InterfaceClassName(dyobj._oleobj_) Yep. > is there a way to list the names in the gencache? > ie.. > 'Word.Application' > 'Excel.Application' Nope. In many cases the typelib (and therefore the generated file) isn't aware of what names are used to create it. > how do you get the guid from _oleobj_? Similarly, I don't think you can in all cases (but it may be possible if the object is actually a CoClass) Cheers, Mark From planders at gmail.com Mon Dec 7 23:45:42 2009 From: planders at gmail.com (Preston Landers) Date: Mon, 7 Dec 2009 16:45:42 -0600 Subject: [python-win32] ISAPI and threading Message-ID: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> On Tue, Dec 1, 2009 at 5:33 AM, Mark Hammond wrote: > On 1/12/2009 9:13 AM, Preston Landers wrote: >> >> I just thought I'd follow up on my original post about IIS. We >> decided to go ahead and use isapi-wsgi and so far the results are very >> good. It won't go into official production for a while but it looks >> very promising. In order to avoid the threading issue (we do in fact >> use mutable module level variables) we are using the "simple" >> (non-threaded) base class. To achieve concurrency we're using the IIS >> "web garden" feature, which is the config setting Randy mentioned to >> allow multiple worker processes per application pool. We're >> configuring the app pool through ADSI, the same way Python-ISAPI >> configures itself. > > Awesome - thanks for the update. I've CCd the isapi-wsgi list for their > info. I'm running into a problem where it looks like threading is cropping up again, even with the 'simple' WSGI base class. What I am looking for is a way to completely shut off the possibility of multithreading, as my app is not thread safe. I'm using multiple IIS worker processes for concurrency. Most requests seem to be spaced out between different IIS worker processes as desired. However in some cases with closely timed requests I'm seeing two separate threads within the same process handling the requests. I verified this with and without pydev debugging extensions for Eclipse. One thread is labeled MainThread and the other is Dummy-4 or something similar. It looks like the Dummy label is created by threading.py _DummyThread. But I'm not clear where the code is that's launching the thread, or for that matter why it's choosing the 'dummy' implementation. The Python docs suggest that 'alien' threads created through the C API would fall under this category. This suggests that either the PyWin32 ISAPI C code is launching the threads, or the ISAPI framework itself. Someone had mentioned needing to restrict the worker pool to a single thread but indicated they didn't know how to do that. I searched around MSDN and couldn't find anything relevant. I also checked the PyWin32 ISAPI code and didn't see anything that appeared to start a new thread. Does anyone know how to force single threading in this scenario? I've read some general stuff about ISAPI that all seems to say "your stuff must be thread safe." It looks like ISAPI is creating the threads. Unless I missed it I don't see anything in the Python-ISAPI source that is explicitly creating new threads for new requests. I'd prefer to avoid modifying the Python-ISAPI code but if I need to its no big deal. It looks like I could just throw a lock in there somewhere but I think that wouldn't prevent IIS from adding new threads. It would just force them to be handled sequentially. Ideally I'd like a way to flag the process as "busy" and not accept new threads, to force them to go to a different worker process for concurrent handling. And yes, I'm also investigating the possibility of making the app thread safe. But that's potentially a huge job. However if each new ISAPI thread got its own copy of modules, that would solve my problem except for any potential threading bugs in Python built-in modules. But I don't see any obvious way to enable that either. Has anyone looked into this issue before? many thanks, -Preston From mhammond at skippinet.com.au Tue Dec 8 00:35:43 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 08 Dec 2009 10:35:43 +1100 Subject: [python-win32] ISAPI and threading In-Reply-To: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> References: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> Message-ID: <4B1D914F.2010708@skippinet.com.au> On 8/12/2009 9:45 AM, Preston Landers wrote: > Someone had mentioned needing to restrict the worker pool to a single > thread but indicated they didn't know how to do that. I searched > around MSDN and couldn't find anything relevant. I also checked the > PyWin32 ISAPI code and didn't see anything that appeared to start a > new thread. Does anyone know how to force single threading in this > scenario? Finding out where the thread was created should be your first goal. You are correct that pywin32's ISAPI support doesn't create threads except when establishing that thread-pool - which only happens when you explicitly sub-class that threaded implementation. Obviously though, I've no insight into what ISAPI itself does, but it is reasonable to assume it uses threading to ensure a single ISAPI request doesn't block the entire server. thread.get_ident() will tell you indirectly how many threads you are dealing with. The other option is just to use a lock - create a global lock object and have every request acquire it and release it when done. You should then find only 1 thread is ever actually running in your code while the rest are blocked waiting for the lock. As noted above though, this may severely impact performance... HTH, Mark From internet1 at prodigycomputing.com Tue Dec 8 02:47:47 2009 From: internet1 at prodigycomputing.com (Boar Gules) Date: Tue, 08 Dec 2009 02:47:47 +0100 Subject: [python-win32] What happened to python26.dll? Message-ID: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> I just installed Python 2.6.4. For embedded applications I expect that there will be a python26.dll. But the install doesn't seem to have provided it. What am I missing here (besides the file, of course)? From drobinow at gmail.com Tue Dec 8 03:25:21 2009 From: drobinow at gmail.com (David Robinow) Date: Mon, 7 Dec 2009 21:25:21 -0500 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> Message-ID: <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> On Mon, Dec 7, 2009 at 8:47 PM, Boar Gules wrote: > I just installed Python 2.6.4. > > For embedded applications I expect that there will be a python26.dll. But > the install doesn't seem to have provided it. What am I missing here > (besides the file, of course)? Where did you look? Usually it's C:\WINDOWS\system32\python26.dll Actually, %windir%\system32\python26.dll From internet1 at prodigycomputing.com Tue Dec 8 09:38:23 2009 From: internet1 at prodigycomputing.com (Boar Gules) Date: Tue, 08 Dec 2009 09:38:23 +0100 Subject: [python-win32] What happened to python26.dll? References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> Message-ID: <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> Just one of those baffling "security" notions embedded in Explorer, I suppose. Found it at the command line using dir %windir%\system32\python26.dll and also attrib /s C:\python26.dll but Search in Explorer reports "not found" if I tell it to look on "Local Disk (C:)". If I specify C:\WINNT it does report it. > Where did you look? Usually it's C:\WINDOWS\system32\python26.dll From p.f.moore at gmail.com Tue Dec 8 13:59:20 2009 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 8 Dec 2009 12:59:20 +0000 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> Message-ID: <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> 2009/12/8 Boar Gules : > Just one of those baffling "security" notions embedded in Explorer, I > suppose. ?Found it at the command line using > > dir %windir%\system32\python26.dll Are you on 64-bit Windows? Most of these problems seem to be caused by people being baffled by Win64's strange ways of "redirecting" filesystem access for 32-bit apps. But I'm on 32-bit Windows, so I don't know if what I'm saying is even true, let alone helpful :-) Paul. From kevin.horn at gmail.com Tue Dec 8 17:30:01 2009 From: kevin.horn at gmail.com (Kevin Horn) Date: Tue, 8 Dec 2009 10:30:01 -0600 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> Message-ID: <562bcc10912080830l144eec32o2f572b10bddb0265@mail.gmail.com> On Tue, Dec 8, 2009 at 6:59 AM, Paul Moore wrote: > 2009/12/8 Boar Gules : > > Just one of those baffling "security" notions embedded in Explorer, I > > suppose. Found it at the command line using > > > > dir %windir%\system32\python26.dll > > Are you on 64-bit Windows? Most of these problems seem to be caused by > people being baffled by Win64's strange ways of "redirecting" > filesystem access for 32-bit apps. > > But I'm on 32-bit Windows, so I don't know if what I'm saying is even > true, let alone helpful :-) > > Paul. > > Also, I have found that Explorer's search functionality doesn't work worth a damn on any Windows OS late than Win2k. I have seen these types of problems (Explorer search not finding files) on everything WinXP and later (well, I haven't tried Windows 7 yet). I think it has to do with some change to the indexing...it seems to happen more often with new files, but I haven't dug deep enough to actually prove this. Kevin Horn -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Dec 8 18:48:39 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 08 Dec 2009 09:48:39 -0800 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> Message-ID: <4B1E9177.1020509@probo.com> Paul Moore wrote: > 2009/12/8 Boar Gules : > >> Just one of those baffling "security" notions embedded in Explorer, I >> suppose. Found it at the command line using >> >> dir %windir%\system32\python26.dll >> > > Are you on 64-bit Windows? Most of these problems seem to be caused by > people being baffled by Win64's strange ways of "redirecting" > filesystem access for 32-bit apps. > Well, that's an interesting point that's worth bringing up again, but I don't THINK that's the case here. People need to know that, if you install the 32-bit Python on a 64-bit Windows system, the DLL will be installed in %windir%\SysWow64. (Yes, 32-bit DLLs go in SysWow64, and 64-bit DLLs go in System32. Really.) If you use a 64-bit tool to search for it, you would find it in SysWow64. BUT, in a 32-bit process, Windows does magic path redirection. So, if you were to run os.walk in a 32-bit Python process, you would find python26.dll in %windir%\System32. This can be incredibly confusing, since you can go out to a command line and do "dir \windows\system32\python26.dll" and it won't be there. This is, in my opinion, one of the things that Microsoft really botched in the 32-to-64 transition. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Dec 8 20:10:27 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 08 Dec 2009 11:10:27 -0800 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> Message-ID: <4B1EA4A3.6090404@probo.com> Boar Gules wrote: > Just one of those baffling "security" notions embedded in Explorer, I > suppose. Found it at the command line using > > dir %windir%\system32\python26.dll > > and also > > attrib /s C:\python26.dll > > but Search in Explorer reports "not found" if I tell it to look on "Local > Disk (C:)". If I specify C:\WINNT it does report it. > Interesting! Is this a system that was originally Windows 2000 and has been repeatedly upgraded? Otherwise, it's unusual any more to have a Windows directory called C:\WINNT. Explorer on the newer systems (XP and above) hides, by default, the contents of the Windows system directory. You can adjust that option in Explorer, in Tools, Folder Options, View. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kevin.horn at gmail.com Tue Dec 8 20:49:59 2009 From: kevin.horn at gmail.com (Kevin Horn) Date: Tue, 8 Dec 2009 13:49:59 -0600 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <4B1E9177.1020509@probo.com> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> <4B1E9177.1020509@probo.com> Message-ID: <562bcc10912081149g3d36e5c2x1bc6c8f6746119b7@mail.gmail.com> On Tue, Dec 8, 2009 at 11:48 AM, Tim Roberts wrote: > > People need to know that, if you install the 32-bit Python on a 64-bit > Windows system, the DLL will be installed in %windir%\SysWow64. (Yes, > 32-bit DLLs go in SysWow64, and 64-bit DLLs go in System32. Really.) > If you use a 64-bit tool to search for it, you would find it in SysWow64. > > BUT, in a 32-bit process, Windows does magic path redirection. So, if > you were to run os.walk in a 32-bit Python process, you would find > python26.dll in %windir%\System32. This can be incredibly confusing, > since you can go out to a command line and do "dir > \windows\system32\python26.dll" and it won't be there. > > This is, in my opinion, one of the things that Microsoft really botched > in the 32-to-64 transition. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > Ow. I think my head just exploded. Kevin Horn -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan at shragmir.com Tue Dec 8 21:53:54 2009 From: dan at shragmir.com (Daniel Menes) Date: Tue, 08 Dec 2009 15:53:54 -0500 Subject: [python-win32] What happened to python26.dll? In-Reply-To: <562bcc10912080830l144eec32o2f572b10bddb0265@mail.gmail.com> References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> <562bcc10912080830l144eec32o2f572b10bddb0265@mail.gmail.com> Message-ID: <4B1EBCE2.1020605@shragmir.com> Kevin Horn wrote: > Also, I have found that Explorer's search functionality doesn't work > worth a damn on any Windows OS late than Win2k. > > I have seen these types of problems (Explorer search not finding > files) on everything WinXP and later (well, I haven't tried Windows 7 > yet). I think it has to do with some change to the indexing...it > seems to happen more often with new files, but I haven't dug deep > enough to actually prove this. > > Kevin Horn > ------------------------------------------------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > You have encountered one of the most annoying habits of late Windows releases. By default, Windows will not search the contents of any file whose extension it does not recognize. There is a simple fix, but it is not intuitive, and not documented anywhere as far as I know. At my last place of work, an e-mail describing the fix was passed around like a bootleg recording. I apologize if this is OT, but given how many people are frustrated with this problem, and how few people seem to know the answer, I publicize it whenever I can. The solution, (on XP Pro): From Control Panel/Administrative Tools, open "Computer Management" In the tree diagram on the left side of the Computer Management window, locate "Services and Applications/Indexing Service" Right click Indexing Service and select "Properties" In the dialog that pops up, make sure that "Index files with unknown extensions" is checked. Note that this solution works even if the computer is not set to use the Indexing Service for its searches. I do not know if there are similar problems on Vista or 7, or if the fix is similar. Hope y'all will forgive my brief OT digression. --Dan Menes From keating at acm.org Tue Dec 8 18:34:50 2009 From: keating at acm.org (Paul Keating) Date: Tue, 08 Dec 2009 18:34:50 +0100 Subject: [python-win32] What happened to python26.dll? References: <006a01ca77a9$32ed95d0$4801a8c0@vuurpijlhuisje.local> <4eb0089f0912071825i6bd6d1b4s3a34d6a183027662@mail.gmail.com> <007301ca77e2$eb7a5e60$4801a8c0@vuurpijlhuisje.local> <79990c6b0912080459i4e47e36fq5e0da26bc45cfd2@mail.gmail.com> <562bcc10912080830l144eec32o2f572b10bddb0265@mail.gmail.com> Message-ID: <001f01ca782d$a5244700$4801a8c0@vuurpijlhuisje.local> Not even. This _is_ on Win2k >> Also, I have found that Explorer's search functionality doesn't work worth a damn on any Windows OS late than Win2k. From Terry.Rankine at csiro.au Wed Dec 9 02:53:45 2009 From: Terry.Rankine at csiro.au (Terry.Rankine at csiro.au) Date: Wed, 9 Dec 2009 09:53:45 +0800 Subject: [python-win32] Intel Compilers, Intel MKL, math.h vs mathimf.h Message-ID: <4E88C091A57493498EEC9F2A21D5BF4302913D1D6D@EXWA-MBX01.nexus.csiro.au> Hi Guys, Here is an ugly one for you, On Windows XP (VS2008, Intel 10 and 11 series C and F compilers and the intel 10.2 MKL) , I have a software stack which looks like this: Python Numpy Boost My application (eScript) I want to use the intel compilers across the entire stack, and I also want to make use of the intel mkl. The standard windows math.h is missing a lot of functions, and eScript has decided to use the intel mkl's mathimf.h, which is incompatible with math.h, and will abort compilations if you try to mix them. Is it possible to make python use the intel mkl and intels mathimf.h? (I then get to ask the question to boost and numpy guys.) I am not able to work out what keywords matter and google is not finding any answers for me. Any pointers would be great (if this is the wrong list - please point me to the right one) Regards, Terry Rankine -------------- next part -------------- An HTML attachment was scrubbed... URL: From jfabiani at yolo.com Wed Dec 9 18:52:08 2009 From: jfabiani at yolo.com (John) Date: Wed, 9 Dec 2009 09:52:08 -0800 Subject: [python-win32] can't set a property Message-ID: <200912090952.08859.jfabiani@yolo.com> Newbie here. I thought my question would have been a common one but I have checked the archive for the last year and only found one message even close. I'm attempting to use a OCX designed to talk with QuickBooks. ?I'm using win32com for the first time and have discovered an issue that I'm sure others have run into. ?But researching google etc. ?has not helped. obj = win32com.client.Dispatch("InQB.Invoice.1") #In the VB code #obj.ItemName(0) = 'string' #in python I'm trying obj.ItemName[0] = 'string' #error is "Instancemethod object does not support item assignment" I found and ran makepy.py and here is the code it created dealing with my obj. # The method ItemName is actually a property, but must be used as a method to correctly pass the arguments def ItemName(self, ItemIndex=defaultNamedNotOptArg): ? ? ? ? """Line item property: Reference to the kind of item.""" ? ? ? ? # Result is a Unicode object ? ? ? ? return self._oleobj_.InvokeTypes(19, LCID, 2, (8, 0), ((3,1),),ItemIndex ) As I read the above code it can only return a string not assign anything. I'm not sure what "InvokeTypes" does. And "defaultNamedNotOptArg" does not sound good. Just for information the ItemName[0] is an array (I think not a Vb guy) of items on a invoice. ItemName[0] would refer to the first line item on the invoice and ItemName[1] the second and ... So the question is how can I get around this issue? ?I'm sure others need to set properties (arrays/list) in com objects. Thanks in advance, Johnf From timr at probo.com Wed Dec 9 20:06:46 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 09 Dec 2009 11:06:46 -0800 Subject: [python-win32] Intel Compilers, Intel MKL, math.h vs mathimf.h In-Reply-To: <4E88C091A57493498EEC9F2A21D5BF4302913D1D6D@EXWA-MBX01.nexus.csiro.au> References: <4E88C091A57493498EEC9F2A21D5BF4302913D1D6D@EXWA-MBX01.nexus.csiro.au> Message-ID: <4B1FF546.2040002@probo.com> Terry.Rankine at csiro.au wrote: > > Hi Guys, > > Here is an ugly one for you, > > > > On Windows XP (VS2008, Intel 10 and 11 series C and F compilers and > the intel 10.2 MKL) , I have a software stack which looks like this: > > > > Python > > Numpy > > Boost > > My application (eScript) > > > > I want to use the intel compilers across the entire stack, and I also > want to make use of the intel mkl. > > > > The standard windows math.h is missing a lot of functions, and eScript > has decided to use the intel mkl?s mathimf.h, which is incompatible > with math.h, and will abort compilations if you try to mix them. > Where does math.h get invoked? Does that come from including python.h? Are you embedding Python into your app, or is your app an add-on to Python? The key issue with mixing compilers is getting the run-time libraries mixed up. As long as your application links to the same run-time library that VS2008 does, it shouldn't matter what compiler is used to create the binary. > Is it possible to make python use the intel mkl and intels mathimf.h? > (I then get to ask the question to boost and numpy guys.) > You'd have to rebuild them all from source. I don't know that it's impossible, but I'll bet it would be a challenge. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Wed Dec 9 20:21:40 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 09 Dec 2009 11:21:40 -0800 Subject: [python-win32] can't set a property In-Reply-To: <200912090952.08859.jfabiani@yolo.com> References: <200912090952.08859.jfabiani@yolo.com> Message-ID: <4B1FF8C4.4030806@probo.com> John wrote: > ... > I'm attempting to use a OCX designed to talk with QuickBooks. I'm using > win32com for the first time and have discovered an issue that I'm sure others > have run into. But researching google etc. has not helped. > > obj = win32com.client.Dispatch("InQB.Invoice.1") > #In the VB code > #obj.ItemName(0) = 'string' > > #in python I'm trying > obj.ItemName[0] = 'string' > #error is "Instancemethod object does not support item assignment" > ... > Just for information the ItemName[0] is an array (I think not a Vb guy) of > items on a invoice. ItemName[0] would refer to the first line item on the > invoice and ItemName[1] the second and ... > Well, remember that ItemName is not really an array. It's a function that happens to look like an array to VB. The Python COM support will usually provide Set and Get versions for indexed properties. Try this: obj.SetItemName( 0, 'String' ) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jfabiani at yolo.com Thu Dec 10 01:16:47 2009 From: jfabiani at yolo.com (John) Date: Wed, 9 Dec 2009 16:16:47 -0800 Subject: [python-win32] can't set a property In-Reply-To: <4B1FF8C4.4030806@probo.com> References: <200912090952.08859.jfabiani@yolo.com> <4B1FF8C4.4030806@probo.com> Message-ID: <200912091616.47124.jfabiani@yolo.com> On Wednesday 09 December 2009 11:21:40 am Tim Roberts wrote: > John wrote: > > ... > > I'm attempting to use a OCX designed to talk with QuickBooks. I'm using > > win32com for the first time and have discovered an issue that I'm sure > > others have run into. But researching google etc. has not helped. > > > > obj = win32com.client.Dispatch("InQB.Invoice.1") > > #In the VB code > > #obj.ItemName(0) = 'string' > > > > #in python I'm trying > > obj.ItemName[0] = 'string' > > #error is "Instancemethod object does not support item assignment" > > ... > > Just for information the ItemName[0] is an array (I think not a Vb guy) > > of items on a invoice. ItemName[0] would refer to the first line item on > > the invoice and ItemName[1] the second and ... > > Well, remember that ItemName is not really an array. It's a function > that happens to look like an array to VB. > > The Python COM support will usually provide Set and Get versions for > indexed properties. Try this: > obj.SetItemName( 0, 'String' ) Wow Tim thanks that appears to work. But to be honest I don't see where this code is located. Johnf From timr at probo.com Thu Dec 10 01:56:41 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 09 Dec 2009 16:56:41 -0800 Subject: [python-win32] can't set a property In-Reply-To: <200912091616.47124.jfabiani@yolo.com> References: <200912090952.08859.jfabiani@yolo.com> <4B1FF8C4.4030806@probo.com> <200912091616.47124.jfabiani@yolo.com> Message-ID: <4B204749.2000407@probo.com> John wrote: > On Wednesday 09 December 2009 11:21:40 am Tim Roberts wrote: > >> Well, remember that ItemName is not really an array. It's a function >> that happens to look like an array to VB. >> >> The Python COM support will usually provide Set and Get versions for >> indexed properties. Try this: >> obj.SetItemName( 0, 'String' ) >> > > Wow Tim thanks that appears to work. But to be honest I don't see where this > code is located. If you ran makepy, it should be in the generated code. It's handled by DispatchItem in build.py; if it sees a call to a function that starts with Set or Get, and there happens to be a property that matches the rest of the name, it does the Right Thing. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From stuaxo2 at yahoo.com Thu Dec 10 07:05:54 2009 From: stuaxo2 at yahoo.com (Stuart Axon) Date: Wed, 9 Dec 2009 22:05:54 -0800 (PST) Subject: [python-win32] Files in clipboard with DropEffect? Message-ID: <378687.31482.qm@web112110.mail.gq1.yahoo.com> Hi, I made the a script to manipulate files copied into the clipboard from explorer. To know if the file was cut or copied it seems need to get information about the DropEffect - is there a way to do this from win32clipboard ? S++ [pcp.py] import os import sys import win32api from win32con import CF_HDROP from win32clipboard import IsClipboardFormatAvailable, OpenClipboard, GetClipboardData, CloseClipboard def main(): targetdir = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else os.getcwd()) ## Note - Need DropEffect to work out if it's copy or cut OpenClipboard() if (IsClipboardFormatAvailable(CF_HDROP)): files = GetClipboardData(CF_HDROP) else: files = [] CloseClipboard() if os.path.abspath(os.path.commonprefix(files)) == targetdir: print 'Files already in folder [' + targetdir + ']' ## TODO - Check for overwriting for file in files: win32api.MoveFile(file, os.path.join(targetdir, os.path.basename(file))) if __name__ == "__main__": main() From skippy.hammond at gmail.com Fri Dec 11 01:28:54 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 11 Dec 2009 11:28:54 +1100 Subject: [python-win32] Files in clipboard with DropEffect? In-Reply-To: <378687.31482.qm@web112110.mail.gq1.yahoo.com> References: <378687.31482.qm@web112110.mail.gq1.yahoo.com> Message-ID: <4B219246.8030008@gmail.com> On 10/12/2009 5:05 PM, Stuart Axon wrote: > Hi, > I made the a script to manipulate files copied into the clipboard from explorer. > To know if the file was cut or copied it seems need to get information about the DropEffect - is there a way to do this from win32clipboard ? I think you want to look at pythoncom.OleGetClipboard(), then using the IDataObject returned. IIRC, you will need to query for the clipboard format CFSTR_PREFERREDDROPEFFECT and do other non-obvious stuff. The following code seems to work (although note various errors may be raised if what you expect isn't in the clipboard. Note that you don't need to jump through these hoops when you are the "drop target" - the drop target is passed this flag as a param as it is dropped. HTH, Mark from win32com.shell import shellcon import pythoncom import win32clipboard import struct CF_PREFERREDDROPEFFECT = win32clipboard.RegisterClipboardFormat( shellcon.CFSTR_PREFERREDDROPEFFECT) data_obj = pythoncom.OleGetClipboard() # Make a FORMATETC fe = (CF_PREFERREDDROPEFFECT, None, pythoncom.DVASPECT_CONTENT, -1, pythoncom.TYMED_HGLOBAL) medium = data_obj.GetData(fe) de = struct.unpack("i", medium.data[:4])[0] print "Drop effect is", de From skippy.hammond at gmail.com Fri Dec 11 01:35:12 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 11 Dec 2009 11:35:12 +1100 Subject: [python-win32] Files in clipboard with DropEffect? In-Reply-To: <4B219246.8030008@gmail.com> References: <378687.31482.qm@web112110.mail.gq1.yahoo.com> <4B219246.8030008@gmail.com> Message-ID: <4B2193C0.2000102@gmail.com> I think I made that more complicated than necessary - you can probably perform the exact same steps using just win32clipboard - the key is checking is that clipboard format is available, getting the data, then using struct to convert it to an int. Mark On 11/12/2009 11:28 AM, Mark Hammond wrote: > On 10/12/2009 5:05 PM, Stuart Axon wrote: >> Hi, >> I made the a script to manipulate files copied into the clipboard from >> explorer. >> To know if the file was cut or copied it seems need to get information >> about the DropEffect - is there a way to do this from win32clipboard ? > > I think you want to look at pythoncom.OleGetClipboard(), then using the > IDataObject returned. IIRC, you will need to query for the clipboard > format CFSTR_PREFERREDDROPEFFECT and do other non-obvious stuff. > > The following code seems to work (although note various errors may be > raised if what you expect isn't in the clipboard. > > Note that you don't need to jump through these hoops when you are the > "drop target" - the drop target is passed this flag as a param as it is > dropped. > > HTH, > > Mark > > from win32com.shell import shellcon > import pythoncom > import win32clipboard > import struct > > CF_PREFERREDDROPEFFECT = win32clipboard.RegisterClipboardFormat( > shellcon.CFSTR_PREFERREDDROPEFFECT) > > data_obj = pythoncom.OleGetClipboard() > > # Make a FORMATETC > fe = (CF_PREFERREDDROPEFFECT, None, pythoncom.DVASPECT_CONTENT, -1, > pythoncom.TYMED_HGLOBAL) > medium = data_obj.GetData(fe) > de = struct.unpack("i", medium.data[:4])[0] > print "Drop effect is", de From narisipalli at gmail.com Fri Dec 11 05:19:19 2009 From: narisipalli at gmail.com (Gowtham) Date: Thu, 10 Dec 2009 23:19:19 -0500 Subject: [python-win32] Problem with OLE error 0x80041002 Message-ID: Hi All, I have a python script that retrieves the user profile path from the registry using wmi. I am doing this way as win32net.NetUserGetInfo could not somehow find the domain user. Here the code snippet- def GetProfilePath(username): pythoncom.CoInitialize() try: reg = wmi.WMI(find_classes=False, namespace='default').StdRegProv try: unused_result, profilepath = reg.GetExpandedStringValue( hDefKey=_winreg.HKEY_LOCAL_MACHINE, sSubKeyName=('%s\\%s' % (ProfileSettings.PROFILES_KEY, ProfileSettings.ObtainSid(username))), sValueName='ProfileImagePath') except WindowsError: raise NoProfileInfoError( 'The user %s has no Profile Path defined in the registry.' % username) finally: pythoncom.CoUninitialize() return profilepath I am using pythoncom as this request would be able to run from a thread instead from the main thread. This works fine on most of the XP machines but some XP machines throw up this exception- File "wmi.pyc", line 1190, in connect File "wmi.pyc", line 189, in handle_com_error x_wmi: -0x7ffbeffe - OLE error 0x80041002 I see that 0x80041002 is Object not found error but why is wmi not being able to find the object and what could be an alternative? Any tips, appreciated. Gowtham N -------------- next part -------------- An HTML attachment was scrubbed... URL: From narisipalli at gmail.com Fri Dec 11 05:49:58 2009 From: narisipalli at gmail.com (Gowtham) Date: Thu, 10 Dec 2009 23:49:58 -0500 Subject: [python-win32] Problem with OLE error 0x80041002 In-Reply-To: References: Message-ID: I have also tried with win32security instead of using wmi as mentioned in Tim Golden's post- import _winreg import win32security username = 'gowtham' sid = win32security.ConvertSidToStringSid(win32security.LookupAccountName(None, username)[0]) key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" + "\\" + sid) value, type = _winreg.QueryValueEx(key, "ProfileImagePath") print value Output: C:\Users\gowtham This works as intended. Is this advisible method of extracting path or the WMI way? Thanks, Gowtham N On Thu, Dec 10, 2009 at 11:19 PM, Gowtham wrote: > Hi All, > > I have a python script that retrieves the user profile path from the > registry using wmi. I am doing this way as win32net.NetUserGetInfo could not > somehow find the domain user. Here the code snippet- > > def GetProfilePath(username): > pythoncom.CoInitialize() > try: > reg = wmi.WMI(find_classes=False, namespace='default').StdRegProv > try: > unused_result, profilepath = reg.GetExpandedStringValue( > hDefKey=_winreg.HKEY_LOCAL_MACHINE, > sSubKeyName=('%s\\%s' % (ProfileSettings.PROFILES_KEY, > ProfileSettings.ObtainSid(username))), > sValueName='ProfileImagePath') > except WindowsError: > raise NoProfileInfoError( > 'The user %s has no Profile Path defined in the registry.' % > username) > finally: > pythoncom.CoUninitialize() > return profilepath > > I am using pythoncom as this request would be able to run from a thread > instead from the main thread. > > This works fine on most of the XP machines but some XP machines throw up > this exception- > > File "wmi.pyc", line 1190, in connect > File "wmi.pyc", line 189, in handle_com_error > x_wmi: -0x7ffbeffe - OLE error 0x80041002 > > I see that 0x80041002 is Object not found error but why is wmi not being > able to find the object and what could be an alternative? > > Any tips, appreciated. > Gowtham N > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rsyring at inteli-com.com Fri Dec 11 15:09:30 2009 From: rsyring at inteli-com.com (Randy Syring) Date: Fri, 11 Dec 2009 09:09:30 -0500 Subject: [python-win32] Windows "idle" time & killing a process Message-ID: <4B22529A.9040803@inteli-com.com> I use synergy to connect the keyboard and mouse on my desktop to my laptop. However, I have found that synergy keeps my monitors from shutting off when it is running. I often forget to turn synergy off at the end of the day, which means my monitors waste energy and bulb life. I would like to write a script in Python that would check if the computer had been idle (i.e. no user input) for > 1 hour and if so, shut down synergy if it is running. I would appreciate pointers in two areas: * How would I check how long the computer had been idle * How would I kill a process if I only know the name Brief references would be fine, I am happy to go digging. Thanks. -- -------------------------------------- Randy Syring Intelicom 502-644-4776 "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Fri Dec 11 15:16:12 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 11 Dec 2009 14:16:12 +0000 Subject: [python-win32] Problem with OLE error 0x80041002 In-Reply-To: References: Message-ID: <4B22542C.9030709@timgolden.me.uk> Gowtham wrote: > I have a python script that retrieves the user profile path from the > registry using wmi. I am doing this way as win32net.NetUserGetInfo could not > somehow find the domain user. Here the code snippet- {... snipped snippet ...] Does this reveal anything? import _winreg import wmi reg = wmi.WMI (namespace="default").StdRegProv print reg.CheckAccess ( _winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", _winreg.KEY_QUERY_VALUE | _winreg.KEY_ENUMERATE_SUB_KEYS ) result, sids = reg.EnumKey ( _winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ) for sid in sids: print sid On the other hand, WMI doesn't offer you much here: if you have a working solution via the Win32 API, then unless you need to do this on remote machines with specific credentials (which you can't do with the standard API) then perhaps you needn't try too hard... TJG From mail at timgolden.me.uk Fri Dec 11 15:28:07 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 11 Dec 2009 14:28:07 +0000 Subject: [python-win32] Windows "idle" time & killing a process In-Reply-To: <4B22529A.9040803@inteli-com.com> References: <4B22529A.9040803@inteli-com.com> Message-ID: <4B2256F7.8080203@timgolden.me.uk> Randy Syring wrote: > I use synergy to connect the keyboard and mouse on my desktop to my > laptop. However, I have found that synergy keeps my monitors from > shutting off when it is running. I often forget to turn synergy off at > the end of the day, which means my monitors waste energy and bulb life. > > I would like to write a script in Python that would check if the > computer had been idle (i.e. no user input) for > 1 hour and if so, shut > down synergy if it is running. I would appreciate pointers in two areas: > > * How would I check how long the computer had been idle > * How would I kill a process if I only know the name > > Brief references would be fine, I am happy to go digging. Might I recommend these two search URLs? (you'll have to ignore the references to IDLE, the Python development env) site:mail.python.org windows idle python-win32 site:mail.python.org windows kill python-win32 plus, possibly, this example (which isn't quite what you're after but which does at least have some of the pieces you might need): http://timgolden.me.uk/python/win32_how_do_i/find-the-window-for-my-subprocess.html TJG From timr at probo.com Fri Dec 11 19:39:09 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 11 Dec 2009 10:39:09 -0800 Subject: [python-win32] Windows "idle" time & killing a process In-Reply-To: <4B22529A.9040803@inteli-com.com> References: <4B22529A.9040803@inteli-com.com> Message-ID: <4B2291CD.6080200@probo.com> Randy Syring wrote: > I use synergy to connect the keyboard and mouse on my desktop to my > laptop. However, I have found that synergy keeps my monitors from > shutting off when it is running. I often forget to turn synergy off > at the end of the day, which means my monitors waste energy and bulb > life. > > I would like to write a script in Python that would check if the > computer had been idle (i.e. no user input) for > 1 hour and if so, > shut down synergy if it is running. I would appreciate pointers in > two areas: > > * How would I check how long the computer had been idle > * How would I kill a process if I only know the name > > Brief references would be fine, I am happy to go digging. Idle time detection in Windows is surprisingly tricky. You can have a message sent to you when the screensaver fires up, but Synergy might be suppressing that as well. You could change your power management setup to suspend or hibernate after an hour or two of idle time. The only sure-fire method that I'm aware of is to install mouse and keyboard hooks and watch the activity yourself. That cannot (today) be done in Python. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From planders at gmail.com Fri Dec 11 23:31:36 2009 From: planders at gmail.com (Preston Landers) Date: Fri, 11 Dec 2009 16:31:36 -0600 Subject: [python-win32] ISAPI and threading In-Reply-To: <4B1D914F.2010708@skippinet.com.au> References: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> <4B1D914F.2010708@skippinet.com.au> Message-ID: <796c415c0912111431p407c3e35k38f9586f8d2986e2@mail.gmail.com> On Mon, Dec 7, 2009 at 5:35 PM, Mark Hammond wrote: > On 8/12/2009 9:45 AM, Preston Landers wrote: >> >> Someone had mentioned needing to restrict the worker pool to a single >> thread but indicated they didn't know how to do that. I searched >> around MSDN and couldn't find anything relevant. I also checked the >> PyWin32 ISAPI code and didn't see anything that appeared to start a >> new thread. Does anyone know how to force single threading in this >> scenario? > > Finding out where the thread was created should be your first goal. You are > correct that pywin32's ISAPI support doesn't create threads except when > establishing that thread-pool - which only happens when you explicitly > sub-class that threaded implementation. As far as I can tell the threads are created directly by the ISAPI framework without reference to any Python/ISAPI code. They just make a new C thread then call the extension function without further ado. I tried to dig into it a little deeper by compiling a debug version of Python/PyWin32 (x64) but ran into some problems. Everything worked great with my debug build from the command line, including PyWin32 stuff and installing the ISAPI vdir. But when it came to actually running the code through IIS I got mysterious 500 server errors. They appeared very similar to the errors I got when I tried to use a 32 bit version of Python/ISAPI with 64 bit IIS despite setting the 32 bit app pool flag. (By the way, it might be good to note somewhere in the docs that you can't do that, if it doesn't already.) I think it's a generic "DLL could not load" type error but even with the IIS error tracing feature it wasn't very clear. I thought that maybe you also need a debug build of Windows/IIS itself for that to work, but that doesn't sound right. It's possible that since I'm running that debug build right out of the source dir I failed to register it properly or something. Anyway, even if I could identify where the thread was getting created and insert some code there I'm not even sure what it would do. I think forcing each thread to have a different Python interpreter might help. Some other Python web server packages like mod_python seems to do this. But for now I've opted for a simple lock in my WSGI handler function to bypass the whole issue. But I'm a little curious about the purpose of having a WSGI thread pool implementation in light of those facts. If ISAPI will create threads for you anyway, how does a pool help? Is it purely to avoid thread startup overhead? If a thread is being created anyway, you're just adding it to a queue to be handled by a separate thread from the pool. Seems like more overhead, not less. But I'm probably missing something there. Nor have I done a hands on performance test. > > The other option is just to use a lock - create a global lock object and > have every request acquire it and release it when done. You should then > find only 1 thread is ever actually running in your code while the rest are > blocked waiting for the lock. As noted above though, this may severely > impact performance... > Yeah I went ahead and used a lock and it does fully resolve the issue. I'm hoping to avoid or at least mitigate any performance impact by having multiple worker processes configured automatically. IIS does seem to distribute the load pretty evenly in most cases. It will be a while before I have time to run some serious performance / stress tests, but when I do I will be testing a number of different scenarios. Even with the lock, so far performance seems far better than the prior solution we have, which is a byzantine combination of "Classic ASP" Python calling out to external app servers over a proprietary FastCGI-like socket protocol. Anyway, thanks for your input on this issue and all of your other excellent work. It's much appreciated. -Preston From mhammond at skippinet.com.au Sat Dec 12 04:48:13 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 12 Dec 2009 14:48:13 +1100 Subject: [python-win32] ISAPI and threading In-Reply-To: <796c415c0912111431p407c3e35k38f9586f8d2986e2@mail.gmail.com> References: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> <4B1D914F.2010708@skippinet.com.au> <796c415c0912111431p407c3e35k38f9586f8d2986e2@mail.gmail.com> Message-ID: <4B23127D.5020703@skippinet.com.au> On 12/12/2009 9:31 AM, Preston Landers wrote: > But I'm a little curious about the purpose of having a WSGI thread > pool implementation in light of those facts. If ISAPI will create > threads for you anyway, how does a pool help? Is it purely to avoid > thread startup overhead? If a thread is being created anyway, you're > just adding it to a queue to be handled by a separate thread from the > pool. Seems like more overhead, not less. But I'm probably missing > something there. Nor have I done a hands on performance test. That is a very good question :) As you have probably noticed, the thread-pool is taking advantage of the async request options provided by ISAPI - so why that functionality exists in the first place seems the same basic question. I haven't done any measurements on this either - the ISAPI support came with the basic thread-pool implementation when it was contributed. I'd be very interested to know the results of any measurements anyone makes... Cheers, Mark From aahz at pythoncraft.com Sun Dec 13 03:13:46 2009 From: aahz at pythoncraft.com (Aahz) Date: Sat, 12 Dec 2009 18:13:46 -0800 Subject: [python-win32] ISAPI and threading In-Reply-To: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> References: <796c415c0912071445y4e495945ge032996475f343d0@mail.gmail.com> Message-ID: <20091213021346.GA17753@panix.com> [dropping isapi_wsgi-dev because I'm not on it] On Mon, Dec 07, 2009, Preston Landers wrote: > > I'm running into a problem where it looks like threading is cropping > up again, even with the 'simple' WSGI base class. What I am looking > for is a way to completely shut off the possibility of multithreading, > as my app is not thread safe. I'm using multiple IIS worker processes > for concurrency. > > Most requests seem to be spaced out between different IIS worker > processes as desired. However in some cases with closely timed > requests I'm seeing two separate threads within the same process > handling the requests. I verified this with and without pydev > debugging extensions for Eclipse. One thread is labeled MainThread > and the other is Dummy-4 or something similar. It looks like the > Dummy label is created by threading.py _DummyThread. But I'm not > clear where the code is that's launching the thread, or for that > matter why it's choosing the 'dummy' implementation. The Python docs > suggest that 'alien' threads created through the C API would fall > under this category. This suggests that either the PyWin32 ISAPI C > code is launching the threads, or the ISAPI framework itself. Do you have evidence that your Python code is running in multiple threads? I.e. are you sure this isn't just ISAPI running some cleanup work in another thread? -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. From planders at gmail.com Sun Dec 13 18:39:35 2009 From: planders at gmail.com (Preston Landers) Date: Sun, 13 Dec 2009 11:39:35 -0600 Subject: [python-win32] python-win32 Digest, Vol 81, Issue 13 In-Reply-To: References: Message-ID: <796c415c0912130939p389b6bfcgb793314065d828c@mail.gmail.com> On Sun, Dec 13, 2009 at 5:00 AM, wrote: > Do you have evidence that your Python code is running in multiple > threads? ?I.e. are you sure this isn't just ISAPI running some cleanup > work in another thread? Oh yes. There was no doubt. I used a debugger (pydevd) to put a breakpoint at the start of each request. And then ran a section of my app which uses a frameset after limiting the app pool to 1 process. This caused several more or less simultaneous requests. The debugger showed the separate threads with the Dummy-# name label assigned by the Python threading module (plus MainThread) and I could switch back and forth between them in the debugger. I was also seeing other behavior consistent with threaded execution; there are some singleton guards in my app that were getting triggered. I also verified w/o the debugger by having each request log the thread ID via threading.currentThread() as well as the process ID. Everything I've read on ISAPI recently says it's always potentially multithreaded and that extensions must be prepared to run threaded e.g. by locking sensitive objects. At least in my case this wouldn't have been a problem if each thread ran in a separate interpreter (i.e, with separate copies of all modules.) Well, except for any un-thread-safe C extensions and GIL performance issues. For now I am using a thread lock to force sequential behavior within a process and using a multi-process application pool to achieve concurrency. thanks, -Preston From greg.ewing at canterbury.ac.nz Mon Dec 14 11:51:44 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 14 Dec 2009 23:51:44 +1300 Subject: [python-win32] Printing coordinate system problem Message-ID: <4B2618C0.1070209@canterbury.ac.nz> I'm wrestling with printing support for PyGUI on Windows. I'd like to set up the coordinate system during printing so that (0, 0) is at the corner of the paper, so that I can arrange for the margins to have predictable sizes. However, the device context I get from calling PrintDlg() seems to be set up so that the origin is at the corner of the printable area of the page, which is smaller by some amount that depends on the printer being used. If I could find out the limits of the printable area, I could correct for this, but there doesn't seem to be any straightforward way of getting this information. It doesn't seem to appear anywhere in any of the structs returned by PrintDlg(), and I can't find any call that might extract it from the device context. Am I missing something? Surely this an issue that most applications that print have to deal with. How do they do it? -- Greg From vernondcole at gmail.com Mon Dec 14 15:03:16 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 14 Dec 2009 07:03:16 -0700 Subject: [python-win32] [Pygui] Printing coordinate system problem In-Reply-To: <4B2618C0.1070209@canterbury.ac.nz> References: <4B2618C0.1070209@canterbury.ac.nz> Message-ID: In searching for documentation, remember a quirk in Microsoft vocabulary... a "printer" is software, not hardware. The device on the corner of your desk with the paper in it is not a "printer", it is a "printing device." -- Not being an expert on writing Windows printer code, nevertheless let me venture a guess that there may be no way to do what you want. My reasoning hinges on a bad experience I had in the past... Using Crystal Reports, a rather expensive commercial product which uses Windows very well, I designed a very fancy Purchase Order form, which I tested on three or four different Windows printers. When I installed the application, the purchase orders would not print out correctly on another printer -- the one connected to my boss's PC (of course). I had to re-design the report a few pixels narrower. -- Please somebody tell Greg that I'm wrong. -- Vernon On Mon, Dec 14, 2009 at 3:51 AM, Greg Ewing wrote: > I'm wrestling with printing support for PyGUI on Windows. > I'd like to set up the coordinate system during printing > so that (0, 0) is at the corner of the paper, so that I > can arrange for the margins to have predictable sizes. > > However, the device context I get from calling PrintDlg() > seems to be set up so that the origin is at the corner > of the printable area of the page, which is smaller by > some amount that depends on the printer being used. > > If I could find out the limits of the printable area, > I could correct for this, but there doesn't seem to be > any straightforward way of getting this information. > It doesn't seem to appear anywhere in any of the > structs returned by PrintDlg(), and I can't find any > call that might extract it from the device context. > > Am I missing something? Surely this an issue that most > applications that print have to deal with. How do they > do it? > > -- > Greg > _______________________________________________ > Pygui mailing list > Pygui at python.org > http://mail.python.org/mailman/listinfo/pygui > -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Mon Dec 14 23:55:31 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 15 Dec 2009 11:55:31 +1300 Subject: [python-win32] [Pygui] Printing coordinate system problem In-Reply-To: References: <4B2618C0.1070209@canterbury.ac.nz> Message-ID: <4B26C263.6040506@canterbury.ac.nz> Vernon Cole wrote: > In searching for documentation, remember a quirk in Microsoft > vocabulary... a "printer" is software, not hardware. The device on the > corner of your desk with the paper in it is not a "printer", it is a > "printing device." Yes, I know. I'll be happy if I can somehow find out what the driver for whichever printer has been selected in the PrintDlg box thinks the printable area is for the selected paper size. If that doesn't match what the actual printer uses, that's not my problem. :-) Delving a bit further, it looks like I may be able to find out via GetPrinter() and GetForm()... I'll try an experiment shortly. > Using Crystal Reports, a rather expensive commercial product which uses > Windows very well, I designed a very fancy Purchase Order form, which I > tested on three or four different Windows printers. When I installed > the application, the purchase orders would not print out correctly on > another printer Configuring printer drivers on Windows can be a massively confusing and frustrating experience, especially when a network is involved. Chance are there was a setting somewhere in the maze of dialog boxes that would have made it work properly... or maybe not... -- Greg From narisipalli at gmail.com Tue Dec 15 00:04:50 2009 From: narisipalli at gmail.com (Gowtham) Date: Mon, 14 Dec 2009 18:04:50 -0500 Subject: [python-win32] Problem with OLE error 0x80041002 In-Reply-To: <4B22542C.9030709@timgolden.me.uk> References: <4B22542C.9030709@timgolden.me.uk> Message-ID: Inline- On Fri, Dec 11, 2009 at 9:16 AM, Tim Golden wrote: > Gowtham wrote: > >> I have a python script that retrieves the user profile path from the >> registry using wmi. I am doing this way as win32net.NetUserGetInfo could >> not >> somehow find the domain user. Here the code snippet- >> > > {... snipped snippet ...] > > Does this reveal anything? > > > import _winreg > import wmi > > reg = wmi.WMI (namespace="default").StdRegProv > WMI call still throws up the same exception of OLE error. WMI is somehow failing to get a handle. > print reg.CheckAccess ( > _winreg.HKEY_LOCAL_MACHINE, > r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", > _winreg.KEY_QUERY_VALUE | _winreg.KEY_ENUMERATE_SUB_KEYS > ) > result, sids = reg.EnumKey ( > > _winreg.HKEY_LOCAL_MACHINE, > r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" > ) > for sid in sids: > print sid > > > > On the other hand, WMI doesn't offer you much here: if you > have a working solution via the Win32 API, then unless you > need to do this on remote machines with specific credentials > (which you can't do with the standard API) then perhaps you > needn't try too hard... > > TJG > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Tue Dec 15 12:15:50 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Wed, 16 Dec 2009 00:15:50 +1300 Subject: [python-win32] Solved - Printing coordinate system problem In-Reply-To: References: <4B2618C0.1070209@canterbury.ac.nz> Message-ID: <4B276FE6.5040907@canterbury.ac.nz> Thomas Heller wrote: > I would guess that GetDeviceCaps() returns the information that you need. Yep, this turns out to be right, although it's *very* difficult to find this out if you start looking in the area of the docs that talks about printing! My margins are spot-on now. I'm happy. Need sleep now. Thanks, everyone. -- Greg From vernondcole at gmail.com Tue Dec 15 18:52:08 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 15 Dec 2009 10:52:08 -0700 Subject: [python-win32] Solved - Printing coordinate system problem In-Reply-To: <4B276FE6.5040907@canterbury.ac.nz> References: <4B2618C0.1070209@canterbury.ac.nz> <4B276FE6.5040907@canterbury.ac.nz> Message-ID: You're the Man, Thomas! You, too, Greg! Now I have to get my latest upgrade to adodbapi done so I can put some time into really using pygui. -- Vernon On Tue, Dec 15, 2009 at 4:15 AM, Greg Ewing wrote: > Thomas Heller wrote: > > I would guess that GetDeviceCaps() returns the information that you need. >> > > Yep, this turns out to be right, although it's *very* > difficult to find this out if you start looking in > the area of the docs that talks about printing! > > My margins are spot-on now. I'm happy. > > Need sleep now. > > Thanks, everyone. > > -- > Greg > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From RossBoylan at stanfordalumni.org Tue Dec 15 19:12:27 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Tue, 15 Dec 2009 10:12:27 -0800 Subject: [python-win32] registering for power events Message-ID: <1260900747.4502.25.camel@corn.betterworld.us> I would like my application to get notice when the system sleeps, hibernates, or wakes up. http://msdn.microsoft.com/en-us/library/aa373196(VS.85).aspx points me to RegisterPowerSettingNotification, but I do not see this in the latest docs from ActiveState. MSDN only seems to provide a C++ interface; I don't see any COM interface. I think this is new in Vista. Is there a way to do this from Python? Thanks. Ross Boylan From RossBoylan at stanfordalumni.org Tue Dec 15 19:03:16 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Tue, 15 Dec 2009 10:03:16 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) Message-ID: <1260900196.4502.19.camel@corn.betterworld.us> This python script gets no URL overrides and no user settings: PythonWin 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. >>> import win32com.client >>>locator = win32com.client.Dispatch("WbemScripting.SwbemLocator") >>> s = locator.ConnectServer(".", "\\\\.\\ROOT\\CIMV2\\Applications\ \WindowsParentalControls") >>> s.Security_.ImpersonationLevel = 3 >>> x = s.InstancesOf("WpcURLOverride") >>> x.Count 0 >>> x = s.InstancesOf("WpcUserSettings") >>> x.Count 0 >>> s.InstancesOf("WpcSystemSettings") #works OK Numerous false starts deleted. I tried without setting the ImpersonationLevel, and I tried ExecQuery, with the same results. I am running from an admin account on Vista. The comparable VBS script works fine: Set objWMIService = GetObject("winmgmts:\\.\ROOT\CIMV2\Applications \WindowsParentalControls") Set urls = objWMIService.ExecQuery("select * from WpcURLOverride where SID = """ _ & kelsey.SID &"""") WScript.Echo urls.Count I speculate this is a permission issue, since I understand admin accounts have an elevated and a regular privilege token. The parental controls documentation doesn't indicate there are permission issues with read access, however. Why isn't the python working, and what can I do to make it work? Thanks. Ross Boylan From rsyring at inteli-com.com Tue Dec 15 19:27:38 2009 From: rsyring at inteli-com.com (Randy Syring) Date: Tue, 15 Dec 2009 13:27:38 -0500 Subject: [python-win32] adodbapi upgrade Message-ID: <4B27D51A.9000807@inteli-com.com> > You're the Man, Thomas! > You, too, Greg! > Now I have to get my latest upgrade to adodbapi done so I can put some > time into really using pygui. > -- > Vernon Vernon, Just curious, will the upgrades to adodbapi include fixes for the MSSQL stored procedure issues we discussed some time back? -- -------------------------------------- Randy Syring Intelicom 502-644-4776 "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 From timr at probo.com Tue Dec 15 19:28:50 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 15 Dec 2009 10:28:50 -0800 Subject: [python-win32] registering for power events In-Reply-To: <1260900747.4502.25.camel@corn.betterworld.us> References: <1260900747.4502.25.camel@corn.betterworld.us> Message-ID: <4B27D562.5000009@probo.com> Ross Boylan wrote: > I would like my application to get notice when the system sleeps, > hibernates, or wakes up. > http://msdn.microsoft.com/en-us/library/aa373196(VS.85).aspx > points me to RegisterPowerSettingNotification, but I do not see this in > the latest docs from ActiveState. MSDN only seems to provide a C++ > interface; I don't see any COM interface. > > I think this is new in Vista. Is there a way to do this from Python? > It is new in Vista. You can certainly call this through ctypes. It's a simple API. Be sure to wrap the ctypes call in a try/except, in case you happen to run on XP. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mail at timgolden.me.uk Tue Dec 15 19:41:38 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 15 Dec 2009 18:41:38 +0000 Subject: [python-win32] registering for power events In-Reply-To: <1260900747.4502.25.camel@corn.betterworld.us> References: <1260900747.4502.25.camel@corn.betterworld.us> Message-ID: <4B27D862.8030408@timgolden.me.uk> Ross Boylan wrote: > I would like my application to get notice when the system sleeps, > hibernates, or wakes up. > http://msdn.microsoft.com/en-us/library/aa373196(VS.85).aspx > points me to RegisterPowerSettingNotification, but I do not see this in > the latest docs from ActiveState. MSDN only seems to provide a C++ > interface; I don't see any COM interface. > > I think this is new in Vista. Is there a way to do this from Python? FWIW you can do this on XP via WMI: http://timgolden.me.uk/python/wmi/cookbook.html#monitor-multiple-machines-for-power-events TJG From stef.mientki at gmail.com Tue Dec 15 20:45:18 2009 From: stef.mientki at gmail.com (Stef Mientki) Date: Tue, 15 Dec 2009 20:45:18 +0100 Subject: [python-win32] Some questions about network shares ? Message-ID: <4B27E74E.6060500@gmail.com> hello, AFAIK it's not allowed to connect a network share more than once. As my shares can already be connected through by another program, I need to detect if a network share is already connected, So I try to get a list of available network shares, but I don't see the network shares, although they are available. Attempt 1: import wmi c = wmi.WMI () for share in c.Win32_Share (): print 'SSSSSSSSSSSSS', share.Name, share.Path Attempt 2: import win32net import win32netcon COMPUTER_NAME = "" # look at this machine INFO_LEVEL = 2 resume = 0 while 1: (shares, total, resume) = \ win32net.NetShareEnum ( COMPUTER_NAME, INFO_LEVEL, resume, win32netcon.MAX_PREFERRED_LENGTH ) for share in shares: print 'PPPPPP', share['netname'], "=>", share['path'] if not resume: break A workaround, that seems to work correctly : try : os.path.exists ( Share_Name ) return True except : print 'NNNNOOOOOOOOOOOOOOOOOPP', Share_Name ... otherwise try to connect the share Any better ideas ? thanks, Stef Mientki From mail at timgolden.me.uk Tue Dec 15 21:08:36 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 15 Dec 2009 20:08:36 +0000 Subject: [python-win32] Some questions about network shares ? In-Reply-To: <4B27E74E.6060500@gmail.com> References: <4B27E74E.6060500@gmail.com> Message-ID: <4B27ECC4.60508@timgolden.me.uk> Stef Mientki wrote: > AFAIK it's not allowed to connect a network share more than once. > As my shares can already be connected through by another program, > I need to detect if a network share is already connected, > So I try to get a list of available network shares, > but I don't see the network shares, although they are available. There's usually a bit of confusion around the term "network share". In the case of WMI, it refers to the shares which are exposed / exported by the machine in question. (In your example, the local machine). If you actually want the list of (remote or local) shares to which you have connected, you want Win32_MappedLogicalDisk or Win32_LogicalDisk, depending on your precise requirements: import wmi c = wmi.WMI () share_to_connect_to = r"\\handel\public" for d in c.Win32_MappedLogicalDisk ( ProviderName=share_to_connect_to ): print "Already mapped to", d.Caption break else: print "Not mapped" However... it's perfectly possible to connect to the same share several times so I think you're working from a faulty premise. However, I hope the above is informative even if not so necessary. TJG From mail at timgolden.me.uk Tue Dec 15 21:12:26 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 15 Dec 2009 20:12:26 +0000 Subject: [python-win32] Problem with OLE error 0x80041002 In-Reply-To: References: <4B22542C.9030709@timgolden.me.uk> Message-ID: <4B27EDAA.7000503@timgolden.me.uk> Gowtham wrote: > Inline- > > On Fri, Dec 11, 2009 at 9:16 AM, Tim Golden wrote: > >> Gowtham wrote: >> >>> I have a python script that retrieves the user profile path from the >>> registry using wmi. I am doing this way as win32net.NetUserGetInfo could >>> not >>> somehow find the domain user. Here the code snippet- >>> >> {... snipped snippet ...] >> >> Does this reveal anything? >> >> >> import _winreg >> import wmi >> >> reg = wmi.WMI (namespace="default").StdRegProv >> > WMI call still throws up the same exception of OLE error. WMI is somehow > failing to get a handle. I hadn't appreciated that it was failing here. I assumed that it was down below where you try to access the registry keys. If it can't even get to the WMI registry provider, it looks as if the provider isn't installed (unlikely) or is somehow corrupt. Can you attach to the "default" namespace at all? (ie does this work): wmi.WMI (namespace="default") If not, what namespaces are there? If you have the most recent WMI download from my site, there's a wmiweb.py which lets you browse the WMI namespaces fairly easily. TJG From mail at timgolden.me.uk Tue Dec 15 21:21:21 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 15 Dec 2009 20:21:21 +0000 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <1260900196.4502.19.camel@corn.betterworld.us> References: <1260900196.4502.19.camel@corn.betterworld.us> Message-ID: <4B27EFC1.5030203@timgolden.me.uk> Ross Boylan wrote: > This python script gets no URL overrides and no user settings: > PythonWin 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit > (Intel)] on win32. > Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' > for further copyright information. >>>> import win32com.client >>>> locator = win32com.client.Dispatch("WbemScripting.SwbemLocator") >>>> s = locator.ConnectServer(".", "\\\\.\\ROOT\\CIMV2\\Applications\ > \WindowsParentalControls") >>>> s.Security_.ImpersonationLevel = 3 >>>> x = s.InstancesOf("WpcURLOverride") >>>> x.Count > 0 >>>> x = s.InstancesOf("WpcUserSettings") >>>> x.Count > 0 >>>> s.InstancesOf("WpcSystemSettings") #works OK > > > Numerous false starts deleted. I tried without setting the > ImpersonationLevel, and I tried ExecQuery, with the same results. > I am running from an admin account on Vista. > > The comparable VBS script works fine: > Set objWMIService = GetObject("winmgmts:\\.\ROOT\CIMV2\Applications > \WindowsParentalControls") > Set urls = objWMIService.ExecQuery("select * from WpcURLOverride where > SID = """ _ > & kelsey.SID &"""") > WScript.Echo urls.Count > > I speculate this is a permission issue, since I understand admin > accounts have an elevated and a regular privilege token. The parental > controls documentation doesn't indicate there are permission issues with > read access, however. I'm afraid I don't have that particular WMI provider on my XP box, but assuming I read the VBS code aright, this should do the trick (using the wmi module from: http://timgolden.me.uk/python/wmi/index.html import wmi c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") rules = c.WpcURLOverride (Sid=kelsey.SID) print len (rules) Feel free to come back if this doesn't work (or if it does but you're not sure how to proceed with other queries). It's possible that there are permission issues at work, and you can play with the privileges in the wmi.WMI call if you need to, but the VBS script isn't doing anything special there. TJG From Benjamin.Moll at fme.fujitsu.com Tue Dec 15 14:54:08 2009 From: Benjamin.Moll at fme.fujitsu.com (Moll, Benjamin) Date: Tue, 15 Dec 2009 14:54:08 +0100 Subject: [python-win32] help with pywin32 Message-ID: Hey guys, Im working with this script since weeks. Until today everything works fine. I could open, read and modify cells without any problems. since this morning I receive an error that says: Traceback (most recent call last): File "C:\Documents and Settings\USER\Desktop\Code\python\test_file.py", line 129, in EX = excel_com(ROOT, module_name, TEST_CHAPTER, TEST_DESCRIPTION, Scope_defines) File "C:\Documents and Settings\USER\_resources\libs\excel_lib.py", line 88, in __init__ self.xlApp.Workbooks.open(r'C:\Documents and Settings\USER\Testreport\FRT.xlsx') File "C:\Python31\Lib\site-packages\win32com\client\__init__.py", line 462, in __getattr__ raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr)) AttributeError: '' object has no attribute 'open' what happened? whats wrong with my code: self.xlApp = Dispatch('Excel.Application') self.xlApp.Visible = 1 self.xlApp.Workbooks.open(r'C:\Documents and Settings\USER\Testreport\FRT.xlsx') #error here pls help me! ----------------------------------------------------------------- Mit freundlichen Gr??en / With kind regards Benjamin Moll ________________________________________ Gesch?ftsf?hrer/Managing Directors: Dr. Joji Murakami, Brendan Mc Kearney, Satoru Yamaguchi, Yoshihiro Kawase Sitz/Seat: Langen, Hessen; Registergericht/Commercial Register: Offenbach/Main HRB 32725 ________________________________________ This e-mail and any attachment contains information which is private and confidential and is intended for the addressee only. If you are not an addressee, you are not authorised to read, copy or use the e-mail or any attachment. If you have received this e-mail in error, please notify the sender by return e-mail and then delete it. ________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Benjamin.Moll at fme.fujitsu.com Tue Dec 15 16:25:01 2009 From: Benjamin.Moll at fme.fujitsu.com (Moll, Benjamin) Date: Tue, 15 Dec 2009 16:25:01 +0100 Subject: [python-win32] sort in EXCEL via pywin32 Message-ID: How can I sort a column from B14:B24 considering alphabeticaly order? self.xlApp.Range("B14:B24").Sort(Key1=self.sht.Columns( 3 ) , Order1=2, Header=1) don't understand the meaning of key1! Regards and thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- ________________________________________ Gesch?ftsf?hrer/Managing Directors: Dr. Joji Murakami, Brendan Mc Kearney, Satoru Yamaguchi, Yoshihiro Kawase Sitz/Seat: Langen, Hessen; Registergericht/Commercial Register: Offenbach/Main HRB 32725 ________________________________________ This e-mail and any attachment contains information which is private and confidential and is intended for the addressee only. If you are not an addressee, you are not authorised to read, copy or use the e-mail or any attachment. If you have received this e-mail in error, please notify the sender by return e-mail and then delete it. ________________________________________ From vernondcole at gmail.com Tue Dec 15 22:52:01 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 15 Dec 2009 14:52:01 -0700 Subject: [python-win32] adodbapi upgrade In-Reply-To: <4B27D51A.9000807@inteli-com.com> References: <4B27D51A.9000807@inteli-com.com> Message-ID: Randy: Good idea, but I need a test case which gives a reliable failure. The simple test in the test suite works fine. Could I talk you into submitting a copy of adodbapitest.py which will demonstrate the problem which must be fixed? That way the problem, once fixed, can never re-occur. -- Vernon On Tue, Dec 15, 2009 at 11:27 AM, Randy Syring wrote: > You're the Man, Thomas! >> You, too, Greg! >> Now I have to get my latest upgrade to adodbapi done so I can put some >> time into really using pygui. >> -- >> Vernon >> > Vernon, > > Just curious, will the upgrades to adodbapi include fixes for the MSSQL > stored procedure issues we discussed some time back? > > -- > -------------------------------------- > Randy Syring > Intelicom > 502-644-4776 > > "Whether, then, you eat or drink or whatever you do, do all to the glory > of God." 1 Cor 10:31 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ross at biostat.ucsf.edu Tue Dec 15 22:33:29 2009 From: ross at biostat.ucsf.edu (Ross Boylan) Date: Tue, 15 Dec 2009 13:33:29 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) [resolved] In-Reply-To: <4B27EFC1.5030203@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> Message-ID: <1260912809.4502.56.camel@corn.betterworld.us> On Tue, 2009-12-15 at 20:21 +0000, Tim Golden wrote: > Ross Boylan wrote: > > This python script gets no URL overrides and no user settings: > > PythonWin 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit > > (Intel)] on win32. > > Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' > > for further copyright information. > >>>> import win32com.client > >>>> locator = win32com.client.Dispatch("WbemScripting.SwbemLocator") > >>>> s = locator.ConnectServer(".", "\\\\.\\ROOT\\CIMV2\\Applications\ > > \WindowsParentalControls") > > > >>>> s.Security_.ImpersonationLevel = 3 > >>>> x = s.InstancesOf("WpcURLOverride") > >>>> x.Count > > 0 > >>>> x = s.InstancesOf("WpcUserSettings") > >>>> x.Count > > 0 > >>>> s.InstancesOf("WpcSystemSettings") #works OK > > > > > > Numerous false starts deleted. I tried without setting the > > ImpersonationLevel, and I tried ExecQuery, with the same results. > > I am running from an admin account on Vista. > > > > The comparable VBS script works fine: > > Set objWMIService = GetObject("winmgmts:\\.\ROOT\CIMV2\Applications > > \WindowsParentalControls") > > Set urls = objWMIService.ExecQuery("select * from WpcURLOverride where > > SID = """ _ > > & kelsey.SID &"""") > > WScript.Echo urls.Count > > > > I speculate this is a permission issue, since I understand admin > > accounts have an elevated and a regular privilege token. The parental > > controls documentation doesn't indicate there are permission issues with > > read access, however. > > I'm afraid I don't have that particular WMI provider on my XP > box, but assuming I read the VBS code aright, this should do > the trick (using the wmi module from: > > http://timgolden.me.uk/python/wmi/index.html > > > import wmi > > c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") > rules = c.WpcURLOverride (Sid=kelsey.SID) > print len (rules) > > > > Feel free to come back if this doesn't work (or if it does > but you're not sure how to proceed with other queries). It's > possible that there are permission issues at work, and you > can play with the privileges in the wmi.WMI call if you need > to, but the VBS script isn't doing anything special there. > > TJG Thank you for the pointer to the wmi module. Is there a reference for it? I just see the tutorial and cookbook. I installed it via ActiveState's pypm, but it doesn't seem to have installed new documentation in the help browser. The wmi-based code also returned nothing. Then I realized my problem: I did not choose "Run as Administrator" when I launched the pythonwin GUI. When I did that, everything worked. I assume the code I tried would also work in this mode. In contrast, I had launched the command prompt as administrator, so that was the environment cscript ran my VBS in. So that's why it worked, and the python didn't. From timr at probo.com Wed Dec 16 00:32:43 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 15 Dec 2009 15:32:43 -0800 Subject: [python-win32] help with pywin32 In-Reply-To: References: Message-ID: <4B281C9B.6070607@probo.com> Moll, Benjamin wrote: > > Hey guys, > > Im working with this script since weeks. Until today everything works > fine. I could open, read and modify cells without any problems. since > this morning I receive an error that says: > > > > Traceback (most recent call last): > > File "C:\Documents and > Settings\USER\Desktop\Code\python\test_file.py", line 129, in > > EX = excel_com(ROOT, module_name, TEST_CHAPTER, TEST_DESCRIPTION, > Scope_defines) > > File "C:\Documents and Settings\USER\_resources\libs\excel_lib.py", > line 88, in __init__ > > self.xlApp.Workbooks.open(r'C:\Documents and > Settings\USER\Testreport\FRT.xlsx') > > File "C:\Python31\Lib\site-packages\win32com\client\__init__.py", > line 462, in __getattr__ > > raise AttributeError("'%s' object has no attribute '%s'" % > (repr(self), attr)) > > AttributeError: ' Library.Workbooks instance at 0x16287504>' object has no attribute 'open' > > > > what happened? > > whats wrong with my code: > > > > self.xlApp = Dispatch('Excel.Application') > > self.xlApp.Visible = 1 > > self.xlApp.Workbooks.open(r'C:\Documents and > Settings\USER\Testreport\FRT.xlsx') #error here > "Open" needs to be capitalized. "Open", not "open". -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Wed Dec 16 01:02:50 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 15 Dec 2009 16:02:50 -0800 Subject: [python-win32] sort in EXCEL via pywin32 In-Reply-To: References: Message-ID: <4B2823AA.2060409@probo.com> Moll, Benjamin wrote: > > How can I sort a column from B14:B24 considering alphabeticaly order? > > > > /self/.xlApp.Range(/"B14:B24"/).Sort(Key1=/self/.sht.Columns( 3 ) , > Order1=2, Header=1) > > > > don?t understand the meaning of key1! > That says to sort the data based on the 3rd column, which doesn't make sense in your case, since you only have one column. You should just be able to say xlApp.Range("B14:B24").Sort(Key1=xlApp.Range("B14"), Orientation=1) That works for me. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From stef.mientki at gmail.com Wed Dec 16 01:03:04 2009 From: stef.mientki at gmail.com (Stef Mientki) Date: Wed, 16 Dec 2009 01:03:04 +0100 Subject: [python-win32] Some questions about network shares ? In-Reply-To: <4B27ECC4.60508@timgolden.me.uk> References: <4B27E74E.6060500@gmail.com> <4B27ECC4.60508@timgolden.me.uk> Message-ID: <4B2823B8.4070600@gmail.com> Tim Golden wrote: > Stef Mientki wrote: >> AFAIK it's not allowed to connect a network share more than once. >> As my shares can already be connected through by another program, >> I need to detect if a network share is already connected, >> So I try to get a list of available network shares, >> but I don't see the network shares, although they are available. > > There's usually a bit of confusion around the term "network share". > In the case of WMI, it refers to the shares which are exposed / exported > by the machine in question. (In your example, the local machine). > > If you actually want the list of (remote or local) shares to which > you have connected, you want Win32_MappedLogicalDisk or > Win32_LogicalDisk, > depending on your precise requirements: > > > import wmi > > c = wmi.WMI () > > share_to_connect_to = r"\\handel\public" > for d in c.Win32_MappedLogicalDisk ( > ProviderName=share_to_connect_to > ): > print "Already mapped to", d.Caption > break > else: > print "Not mapped" > > > > However... it's perfectly possible to connect to the > same share several times so I think you're working > from a faulty premise. However, I hope the above > is informative even if not so necessary. > thanks Tim, You're right about making more connections to the same network share, it is possible. I was confused because in another program, it wasn't allowed, probably because I wanted to connect it with a different user/pwd. The above code was informative, but didn't answer my needs. I guess the question was not precise enough, I wanted to test connection to share, that are not "mounted" ? to a logical drive letter, like this connection: Result = win32wnet.WNetAddConnection2 ( dwType, lpLocalName, lpRemoteName, lpProvider, lpUsername, lpPassword, dwFlags ) These connections don't show with the given code. But the major fact is that the problem is solved, Thanks again. cheers, Stef From RossBoylan at stanfordalumni.org Wed Dec 16 09:37:25 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Wed, 16 Dec 2009 00:37:25 -0800 Subject: [python-win32] Apparent bug in COM browser on Vista Message-ID: <4B289C45.8060907@stanfordalumni.org> The Python COM browser (pywin32 build 211.1), available from the Tools menu of the PythonWin GUI (downloaded yesterday from active state) doesn't seem to be working so well on Vista. I went to the type libraries, selected one (any one , apparently) and clicked on it's "+". This expands to an IID and a Type Library. The latter has a "+"; when I click on it the console shows Traceback (most recent call last): File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", line 123, in OnTreeItemExpanding self.AddSubList(itemHandle, self.GetSubList(item)) File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", line 137, in AddSubList self.AddItem(parentHandle, item) File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", line 149, in AddItem hitem = self.list.InsertItem(parentHandle, hInsertAfter, (None, None, None, text, bitmapCol, bitmapSel, cItems, 0)) TypeError: The text item must be a string or None (got unicode) The "+" expands to an item that says "The type info can not be loaded." I don't have MSVC, and so don't have another tool handy to do this. Ross Boylan From RossBoylan at stanfordalumni.org Wed Dec 16 09:46:46 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Wed, 16 Dec 2009 00:46:46 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B27EFC1.5030203@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> Message-ID: <4B289E76.4020605@stanfordalumni.org> Tim Golden wrote: > > > > import wmi > > c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") > rules = c.WpcURLOverride (Sid=kelsey.SID) > print len (rules) > > I've encountered a glitch: I can't seem to update the values in the rules I retrieve. The relevant snippet is con = wmi.WMI(namespace=wpcns) rules = con.WpcURLOverride (Sid=kelsey.SID) for r in rules: if r.URL.endswith("facebook.com/"): # flip whether or not the site is allowed r.Allowed = 3 - r.Allowed r.Put_() print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name This never changes the value of Allowed, even between the line where it is set and printed out, much less between runs. The comparable VBS does work: For Each url in urls If re.Execute(url.URL).Count > 0 Then url.Allowed = 3-url.Allowed WScript.Echo url.URL, url.Allowed url.Put_() End If Any ideas (I am running privileged)? Ross From mail at timgolden.me.uk Wed Dec 16 14:22:57 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 16 Dec 2009 13:22:57 +0000 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B289E76.4020605@stanfordalumni.org> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> Message-ID: <4B28DF31.8020909@timgolden.me.uk> Ross Boylan wrote: > Tim Golden wrote: >> >> >> import wmi >> >> c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") >> rules = c.WpcURLOverride (Sid=kelsey.SID) >> print len (rules) >> >> > I've encountered a glitch: I can't seem to update the values in the > rules I retrieve. The relevant snippet is > > con = wmi.WMI(namespace=wpcns) > rules = con.WpcURLOverride (Sid=kelsey.SID) > for r in rules: > if r.URL.endswith("facebook.com/"): > # flip whether or not the site is allowed > r.Allowed = 3 - r.Allowed > r.Put_() > print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name > > This never changes the value of Allowed, even between the line where it > is set and printed out, much less between runs. Curious. FWIW, the Put_ shouldn't be necessary; the underlying setattr code does that for you. (Altho' it won't do any harm). This WMI provider seems to be Vista+ (and I'm on XP). I'll try to get hold of a Vista/W7 machine to check this out on. It's quite possible that there's a bug in the wmi module, not least because very few WMI classes actually allow direct updating. (The Win32_Service class, for example, exposes updates via a method). However, my unit test for this particular operation succeeds against the Win32_Environment instance. The underlying COM Object is held as the .ole_object attribute of the wmi instance (here: r) so as a workaround you could try: (untested) allowed = r.ole_object.Properties_ ("Allowed").Value r.ole_object.Properties_ ("Allowed").Value = 3 - allowed r.ole_object.Put_ () TJG From vernondcole at gmail.com Wed Dec 16 16:22:17 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 16 Dec 2009 08:22:17 -0700 Subject: [python-win32] Apparent bug in COM browser on Vista In-Reply-To: <4B289C45.8060907@stanfordalumni.org> References: <4B289C45.8060907@stanfordalumni.org> Message-ID: Dear Ross: The combined Python package hosted by Active State is convenient, but does not always stay up to date. The current build of pywin32 is 214. Many bug fixes have happened in that time. I just tried the build 214 COM browser on my Vista Basic and it works correctly. You may want to try re-installing python from the official sources: http://python.org/ and http://sourceforge.net/projects/pywin32/ If that does not fix the problem, please let us know here. -- Vernon Cole On Wed, Dec 16, 2009 at 1:37 AM, Ross Boylan wrote: > The Python COM browser (pywin32 build 211.1), available from the Tools menu > of the PythonWin GUI (downloaded yesterday from active state) doesn't seem > to be working so well on Vista. I went to the type libraries, selected one > (any one , apparently) and clicked on it's "+". This expands to an IID and > a Type Library. The latter has a "+"; when I click on it the console shows > > Traceback (most recent call last): > File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", > line 123, in OnTreeItemExpanding > self.AddSubList(itemHandle, self.GetSubList(item)) > File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", > line 137, in AddSubList > self.AddItem(parentHandle, item) > File "C:\Python26\Lib\site-packages\pythonwin\pywin\tools\hierlist.py", > line 149, in AddItem > hitem = self.list.InsertItem(parentHandle, hInsertAfter, (None, None, > None, text, bitmapCol, bitmapSel, cItems, 0)) > TypeError: The text item must be a string or None (got unicode) > > The "+" expands to an item that says "The type info can not be loaded." > > I don't have MSVC, and so don't have another tool handy to do this. > > Ross Boylan > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From RossBoylan at stanfordalumni.org Wed Dec 16 17:44:46 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Wed, 16 Dec 2009 08:44:46 -0800 Subject: [python-win32] Apparent bug in COM browser on Vista In-Reply-To: References: <4B289C45.8060907@stanfordalumni.org> Message-ID: <4B290E7E.2050506@stanfordalumni.org> Vernon Cole wrote: > Dear Ross: > The combined Python package hosted by Active State is convenient, > but does not always stay up to date. The current build of pywin32 is > 214. Many bug fixes have happened in that time. I just tried the > build 214 COM browser "on my Vista Basic and it works correctly. Thank you; that fixed it. In the changelog for 213 mentions much enhanced Unicode support. The log also says "build 213 will not be recommended for production work and should be treated as beta quality. " Is 214 considered reasonably solid? Ross From aahz at pythoncraft.com Wed Dec 16 18:53:42 2009 From: aahz at pythoncraft.com (Aahz) Date: Wed, 16 Dec 2009 09:53:42 -0800 Subject: [python-win32] Apparent bug in COM browser on Vista In-Reply-To: <4B290E7E.2050506@stanfordalumni.org> References: <4B289C45.8060907@stanfordalumni.org> <4B290E7E.2050506@stanfordalumni.org> Message-ID: <20091216175342.GA10457@panix.com> On Wed, Dec 16, 2009, Ross Boylan wrote: > > The log also says "build 213 will not be recommended for production work > and should be treated as beta quality. " Is 214 considered reasonably > solid? I'm using 214 for production work. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ Looking back over the years, after I learned Python I realized that I never really had enjoyed programming before. From vernondcole at gmail.com Wed Dec 16 19:37:55 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 16 Dec 2009 11:37:55 -0700 Subject: [python-win32] Apparent bug in COM browser on Vista In-Reply-To: <4B290E7E.2050506@stanfordalumni.org> References: <4B289C45.8060907@stanfordalumni.org> <4B290E7E.2050506@stanfordalumni.org> Message-ID: On Wed, Dec 16, 2009 at 9:44 AM, Ross Boylan wrote: > Vernon Cole wrote: > >> Dear Ross: >> The combined Python package hosted by Active State is convenient, but >> does not always stay up to date. The current build of pywin32 is 214. Many >> bug fixes have happened in that time. I just tried the build 214 COM >> browser "on my Vista Basic and it works correctly. >> > Thank you; that fixed it. In the changelog for 213 mentions much enhanced > Unicode support. > > The log also says "build 213 will not be recommended for production work > and should be treated as beta quality. " Is 214 considered reasonably > solid? > > Ross > 213 added Python 3 support, and had such a huge number of changes that, even though the test suite said it was good, discretion was a good idea. AFAIK only one or two regressions have shown up in 213 and 214. -- Vernon -------------- next part -------------- An HTML attachment was scrubbed... URL: From RossBoylan at stanfordalumni.org Thu Dec 17 06:21:34 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Wed, 16 Dec 2009 21:21:34 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B28DF31.8020909@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> <4B28DF31.8020909@timgolden.me.uk> Message-ID: <4B29BFDE.5020608@stanfordalumni.org> Tim Golden wrote: > Ross Boylan wrote: >> Tim Golden wrote: >>> >>> >>> import wmi >>> >>> c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") >>> rules = c.WpcURLOverride (Sid=kelsey.SID) >>> print len (rules) >>> >>> >> I've encountered a glitch: I can't seem to update the values in the >> rules I retrieve. The relevant snippet is >> >> con = wmi.WMI(namespace=wpcns) >> rules = con.WpcURLOverride (Sid=kelsey.SID) >> for r in rules: >> if r.URL.endswith("facebook.com/"): >> # flip whether or not the site is allowed >> r.Allowed = 3 - r.Allowed >> r.Put_() >> print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), >> kelsey.name >> >> This never changes the value of Allowed, even between the line where >> it is set and printed out, much less between runs. > > > Curious. FWIW, the Put_ shouldn't be necessary; the underlying > setattr code does that for you. (Altho' it won't do any harm). At least in VBS, Put_ was necessary. Allowed updated fine without it, but the change did not persist. > > This WMI provider seems to be Vista+ (and I'm on XP). I think Parental Controls is new with Vista. It is also unavailable on server class systems, i.e, Windows 7 is the only other system that currently does. > I'll try > to get hold of a Vista/W7 machine to check this out on. It's quite > possible that there's a bug in the wmi module, not least because very > few WMI classes actually allow direct updating. (The Win32_Service > class, for example, exposes updates via a method). However, my > unit test for this particular operation succeeds against the > Win32_Environment instance. > > The underlying COM Object is held as the .ole_object attribute of > the wmi instance (here: r) so as a workaround you could try: (untested) > > allowed = r.ole_object.Properties_ ("Allowed").Value > r.ole_object.Properties_ ("Allowed").Value = 3 - allowed > r.ole_object.Put_ () > I tried that; it didn't help. The following code without the wmi module works (eliding the code that got the kelsey object): import win32com.client, sys # would have been better to use raw strings r"...." topns = "\\\\.\\root\\cimv2" wpcns = topns + "\\Applications\\WindowsParentalControls" locator = win32com.client.Dispatch("WbemScripting.SwbemLocator") con = locator.ConnectServer(".", wpcns) rules = con.InstancesOf("WpcURLOverride") for r in rules: if r.URL.endswith("facebook.com/") and r.SID == kelsey.SID: # flip whether or not the site is allowed print r.Allowed, 3-r.Allowed r.Allowed = 3 - r.Allowed r.Put_() print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name BTW, my attempts at limiting the scope of the queries with lines like con.ExecQuery("select * from WpcURLOverride where SID = %s"%kelsey.SID) always get syntax errors (from within com--the example above might not be valid python, but it's like things that were valid!). Hence the cumbersome procedure above. The other parental controls-specific annoyance is that there doesn't seem to be a way to make a new WpcURLOverride and insert it in the list. The class itself (in its mof file) doesn't permit instantiation (I tried anyway--didn't work), and I don't see any factory methods in other parts of the subsystem. Ross From RossBoylan at stanfordalumni.org Thu Dec 17 08:01:07 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Wed, 16 Dec 2009 23:01:07 -0800 Subject: [python-win32] win32com reference documentation Message-ID: <4B29D733.1050004@stanfordalumni.org> I don't see documentation on many of the core win32com modules, e.g, win32com.client. Dispatch does not appear in the index. More precisely, I see examples and tutorials, but no reference material. There is reference documentation on a few components--apparently mapi and pythoncom, but not in the main ones or win32com. Am I missing something? Google seems to indicate not, but I thought I'd check. Using build 214 of pywin32. Ross From skippy.hammond at gmail.com Thu Dec 17 12:44:17 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 17 Dec 2009 22:44:17 +1100 Subject: [python-win32] win32com reference documentation In-Reply-To: <4B29D733.1050004@stanfordalumni.org> References: <4B29D733.1050004@stanfordalumni.org> Message-ID: <4B2A1991.1010402@gmail.com> On 17/12/2009 6:01 PM, Ross Boylan wrote: > I don't see documentation on many of the core win32com modules, e.g, > win32com.client. > Dispatch does not appear in the index. > > More precisely, I see examples and tutorials, but no reference material. > There is reference documentation on a few components--apparently mapi > and pythoncom, but not in the main ones or win32com. Unfortunately you aren't. Many of the Python implemented modules (including win32com) have reasonable docstrings, but they aren't integrated into the doc build process - ironically the C++ code has more regularly formatted help text thanks to the autoduck markup, so generated reasonable info. There is *some* support for extracting via docstrings (eg, docs on the 'isapi' package), but win32com etc predate that by a long way and would almost certainly need some docstring cleanups for that to be reasonable (help appreciated ;). For now, help(module.function) might work... Mark From mail at timgolden.me.uk Thu Dec 17 15:51:11 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 17 Dec 2009 14:51:11 +0000 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B289E76.4020605@stanfordalumni.org> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> Message-ID: <4B2A455F.1080309@timgolden.me.uk> Ross Boylan wrote: > I've encountered a glitch: I can't seem to update the values in the > rules I retrieve. The relevant snippet is > > con = wmi.WMI(namespace=wpcns) > rules = con.WpcURLOverride (Sid=kelsey.SID) > for r in rules: > if r.URL.endswith("facebook.com/"): > # flip whether or not the site is allowed > r.Allowed = 3 - r.Allowed > r.Put_() > print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name > > This never changes the value of Allowed, even between the line where it > is set and printed out, much less between runs. Just occurs to me: there was a bug in versions < 1.4.6 which would have caused this. Are you using the latest version? (I'll still try to get hold of a Vista/W7 machine to try out on...) TJG From RossBoylan at stanfordalumni.org Thu Dec 17 19:10:09 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Thu, 17 Dec 2009 10:10:09 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B2A455F.1080309@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> <4B2A455F.1080309@timgolden.me.uk> Message-ID: <1261073409.12277.16.camel@corn.betterworld.us> On Thu, 2009-12-17 at 14:51 +0000, Tim Golden wrote: > Ross Boylan wrote: > > I've encountered a glitch: I can't seem to update the values in the > > rules I retrieve. The relevant snippet is > > > > con = wmi.WMI(namespace=wpcns) > > rules = con.WpcURLOverride (Sid=kelsey.SID) > > for r in rules: > > if r.URL.endswith("facebook.com/"): > > # flip whether or not the site is allowed > > r.Allowed = 3 - r.Allowed > > r.Put_() > > print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name > > > > This never changes the value of Allowed, even between the line where it > > is set and printed out, much less between runs. > > > Just occurs to me: there was a bug in versions < 1.4.6 which would have > caused this. Are you using the latest version? (I'll still try to get > hold of a Vista/W7 machine to try out on...) I was using 1.4.5 (via pypm and ActiveState). They have version 1.4.6 now; I installed it. However, it didn't help. Does anybody know which package wins if I install wmi manually? BTW, the title of your web page http://timgolden.me.uk/python/wmi/index.html (as shown in browser frame) still says 1.4.5. Ross From mail at timgolden.me.uk Thu Dec 17 19:26:00 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 17 Dec 2009 18:26:00 +0000 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <1261073409.12277.16.camel@corn.betterworld.us> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> <4B2A455F.1080309@timgolden.me.uk> <1261073409.12277.16.camel@corn.betterworld.us> Message-ID: <4B2A77B8.6060900@timgolden.me.uk> Ross Boylan wrote: > On Thu, 2009-12-17 at 14:51 +0000, Tim Golden wrote: >> Ross Boylan wrote: >>> I've encountered a glitch: I can't seem to update the values in the >>> rules I retrieve. The relevant snippet is >>> >>> con = wmi.WMI(namespace=wpcns) >>> rules = con.WpcURLOverride (Sid=kelsey.SID) >>> for r in rules: >>> if r.URL.endswith("facebook.com/"): >>> # flip whether or not the site is allowed >>> r.Allowed = 3 - r.Allowed >>> r.Put_() >>> print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name >>> >>> This never changes the value of Allowed, even between the line where it >>> is set and printed out, much less between runs. >> >> Just occurs to me: there was a bug in versions < 1.4.6 which would have >> caused this. Are you using the latest version? (I'll still try to get >> hold of a Vista/W7 machine to try out on...) > I was using 1.4.5 (via pypm and ActiveState). They have version 1.4.6 > now; I installed it. However, it didn't help. Curses. Clutching at straws: does wmi.__version__ definitely show "1.4.6"? > > Does anybody know which package wins if I install wmi manually? I don't use pypm so don't know how much messing it does with sys.path (which is what would presumably make the difference...) > > BTW, the title of your web page > http://timgolden.me.uk/python/wmi/index.html (as shown in browser frame) > still says 1.4.5. Thanks. My Sphinx build had got out of sync. Fixed now. TJG From RossBoylan at stanfordalumni.org Thu Dec 17 20:15:04 2009 From: RossBoylan at stanfordalumni.org (Ross Boylan) Date: Thu, 17 Dec 2009 11:15:04 -0800 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B2A77B8.6060900@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> <4B2A455F.1080309@timgolden.me.uk> <1261073409.12277.16.camel@corn.betterworld.us> <4B2A77B8.6060900@timgolden.me.uk> Message-ID: <1261077304.12277.18.camel@corn.betterworld.us> On Thu, 2009-12-17 at 18:26 +0000, Tim Golden wrote: > > Curses. Clutching at straws: does wmi.__version__ definitely show > "1.4.6"? Yes. Ross From narisipalli at gmail.com Sat Dec 19 07:59:58 2009 From: narisipalli at gmail.com (Gowtham) Date: Sat, 19 Dec 2009 01:59:58 -0500 Subject: [python-win32] Setting a netboot within windows OS Message-ID: Hi, I want to try something similar to what Mac has i.e control the startup from the OS. In Mac you can choose to have the next boot to be a network boot or a CD boot or a Firewire boot. Similarly, is there a way in windows using WMI/wbem scripting we can set the next boot in network boot or CD mode instead of local hard disk. Any pointers, appreciate it. Thanks, Gowtham N -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Sun Dec 20 11:58:50 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Sun, 20 Dec 2009 10:58:50 +0000 Subject: [python-win32] python vs vbs with parental controls (security issue?) In-Reply-To: <4B2A455F.1080309@timgolden.me.uk> References: <1260900196.4502.19.camel@corn.betterworld.us> <4B27EFC1.5030203@timgolden.me.uk> <4B289E76.4020605@stanfordalumni.org> <4B2A455F.1080309@timgolden.me.uk> Message-ID: <4B2E036A.5010407@timgolden.me.uk> Tim Golden wrote: > Ross Boylan wrote: >> I've encountered a glitch: I can't seem to update the values in the >> rules I retrieve. The relevant snippet is >> >> con = wmi.WMI(namespace=wpcns) >> rules = con.WpcURLOverride (Sid=kelsey.SID) >> for r in rules: >> if r.URL.endswith("facebook.com/"): >> # flip whether or not the site is allowed >> r.Allowed = 3 - r.Allowed >> r.Put_() >> print r.URL, r.Allowed, "(%s)"%allowInterp(r.Allowed), kelsey.name >> >> This never changes the value of Allowed, even between the line where it >> is set and printed out, much less between runs. > > > Just occurs to me: there was a bug in versions < 1.4.6 which would have > caused this. Are you using the latest version? (I'll still try to get > hold of a Vista/W7 machine to try out on...) Finally managed to persuade someone to lend me a Vista machine to put Python etc. on. Installed virgin copy of Python 2.6, pywin32-214 and wmi 1.4.6 (all from the net). Created dummy non-admin account to which to apply parental controls. Randomly "Allowed" google.com and "Blocked" facebook.com. cmd run as administrator Ad-hoc Python session more-or-less as follows: import wmi sid = "...." c = wmi.WMI (namespace="cimv2/Applications/WindowsParentalControls") for i in c.WpcURLOverride (SID=sid): print i.URL, i.Allowed # # http://google.com 1 # http://facebook.com 2 # for i in c.WpcURLOverride (SID=sid): i.Allowed = 3 - i.Allowed for i in c.WpcURLOverride (SID=sid): print i.URL, i.Allowed # # http://google.com 2 # http://facebook.com 1 # Back to Parental controls admin panel and Google is now forbidden, Facebook allowed. I realise that this doesn't really help you very much if it actually doesn't work for you, but I really wanted to make sure I didn't have a lingering bug in the code there. Not sure what else I can offer at this point but very happy to answer more questions / try more things if it will help. TJG From mail at timgolden.me.uk Mon Dec 21 10:30:11 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 21 Dec 2009 09:30:11 +0000 Subject: [python-win32] Setting a netboot within windows OS In-Reply-To: References: Message-ID: <4B2F4023.9080103@timgolden.me.uk> Gowtham wrote: > I want to try something similar to what Mac has i.e control the startup from > the OS. In Mac you can choose to have the next boot to be a network boot or > a CD boot or a Firewire boot. Similarly, is there a way in windows using > WMI/wbem scripting we can set the next boot in network boot or CD mode > instead of local hard disk. This isn't an authoritative answer but: I doubt it. AFAIK that's something held in the BIOS (if it can even be set at all) and I'm not aware of any way for WMI to write to the BIOS settings. It can read some values. I believe that certain BIOS / HW manufacturers offer software which will write the CMOS-stored values but I can't lay my hands on anything at the moment. TJG From stuaxo2 at yahoo.com Mon Dec 21 18:53:58 2009 From: stuaxo2 at yahoo.com (Stuart Axon) Date: Mon, 21 Dec 2009 09:53:58 -0800 (PST) Subject: [python-win32] Files in clipboard with DropEffect? In-Reply-To: <4B2AA9BA.9030905@skippinet.com.au> References: <378687.31482.qm@web112110.mail.gq1.yahoo.com> <4B219246.8030008@gmail.com> <4B2193C0.2000102@gmail.com> <154808.69405.qm@web112106.mail.gq1.yahoo.com> <4B2AA9BA.9030905@skippinet.com.au> Message-ID: <943568.84636.qm@web112102.mail.gq1.yahoo.com> Cheers, that works great :) CF_PREFERREDDROPEFFECT = win32clipboard.RegisterClipboardFormat( shellcon.CFSTR_PREFERREDDROPEFFECT) effect_str = win32clipboard.GetClipboardData(CF_PREFERREDDROPEFFECT) de = struct.unpack("i", effect_str[:4])[0] ----- Original Message ---- From: Mark Hammond To: Stuart Axon Sent: Thu, December 17, 2009 9:59:22 PM Subject: Re: [python-win32] Files in clipboard with DropEffect? Yeah - something like: CF_PREFERREDDROPEFFECT = win32clipboard.RegisterClipboardFormat( shellcon.CFSTR_PREFERREDDROPEFFECT) effect_str = GetClipboardData(CFSTR_PREFERREDDROPEFFECT) de = struct.unpack("i", effect_str[:4])[0] Cheers, Mark On 18/12/2009 12:50 AM, Stuart Axon wrote: > Cheers, I'll try the first way as I'm a bit new to win32 programming > (I'm guessing your saying I could get do something along the lines of... > > effect = GetClipboardData(CFSTR_PREFERREDDROPEFFECT) ? > > I wasn't quite sure how to get this working though). > > > > > ----- Original Message ---- > From: Mark Hammond > To: mhammond at skippinet.com.au > Cc: Stuart Axon; python-win32 at python.org > Sent: Fri, December 11, 2009 12:35:12 AM > Subject: Re: [python-win32] Files in clipboard with DropEffect? > > I think I made that more complicated than necessary - you can probably > perform the exact same steps using just win32clipboard - the key is > checking is that clipboard format is available, getting the data, then > using struct to convert it to an int. > > Mark > > On 11/12/2009 11:28 AM, Mark Hammond wrote: >> On 10/12/2009 5:05 PM, Stuart Axon wrote: >>> Hi, >>> I made the a script to manipulate files copied into the clipboard from >>> explorer. >>> To know if the file was cut or copied it seems need to get information >>> about the DropEffect - is there a way to do this from win32clipboard ? >> >> I think you want to look at pythoncom.OleGetClipboard(), then using the >> IDataObject returned. IIRC, you will need to query for the clipboard >> format CFSTR_PREFERREDDROPEFFECT and do other non-obvious stuff. >> >> The following code seems to work (although note various errors may be >> raised if what you expect isn't in the clipboard. >> >> Note that you don't need to jump through these hoops when you are the >> "drop target" - the drop target is passed this flag as a param as it is >> dropped. >> >> HTH, >> >> Mark >> >> from win32com.shell import shellcon >> import pythoncom >> import win32clipboard >> import struct >> >> CF_PREFERREDDROPEFFECT = win32clipboard.RegisterClipboardFormat( >> shellcon.CFSTR_PREFERREDDROPEFFECT) >> >> data_obj = pythoncom.OleGetClipboard() >> >> # Make a FORMATETC >> fe = (CF_PREFERREDDROPEFFECT, None, pythoncom.DVASPECT_CONTENT, -1, >> pythoncom.TYMED_HGLOBAL) >> medium = data_obj.GetData(fe) >> de = struct.unpack("i", medium.data[:4])[0] >> print "Drop effect is", de > > > From vernondcole at gmail.com Mon Dec 21 19:21:05 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 21 Dec 2009 11:21:05 -0700 Subject: [python-win32] Setting a netboot within windows OS In-Reply-To: References: Message-ID: Gowtham: I waited before giving this answer, to let the real Windows Gurus answer first. Tims pronouncement is as good is it gets, so here is my hair-brained idea. Perhaps it would actually work. As much as I hate to admit this on a Windows mailing list ... When I have multi-boot things to accomplish, I install a copy of Linux and use GRUB to do the fancy boot stuff. If you want to modify the boot control file from Windows, try: 1) Install Ubuntu in a small (10MB) dedicated partition. (The Ubuntu installer will modify the partition table for you, slide the NTFS as needed and install GRUB for multi-boot.) Use the manual partitioning option to make sure you are using an ext3 (not ext4) file system for '/'. 2) Download and install on your Windows system the ext2 file system package from sourceforge. 3) Mount your '/' partition, go to /boot/grub 4) make a handy Python script to edit /boot/grub/grub.cfg to do the boot you need. -- Vernon On Fri, Dec 18, 2009 at 11:59 PM, Gowtham wrote: > Hi, > > I want to try something similar to what Mac has i.e control the startup > from the OS. In Mac you can choose to have the next boot to be a network > boot or a CD boot or a Firewire boot. Similarly, is there a way in windows > using WMI/wbem scripting we can set the next boot in network boot or CD mode > instead of local hard disk. > > Any pointers, appreciate it. > > Thanks, > Gowtham N > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Dec 22 09:37:11 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 22 Dec 2009 08:37:11 +0000 Subject: [python-win32] Setting a netboot within windows OS In-Reply-To: References: Message-ID: <4B308537.3000706@timgolden.me.uk> Vernon Cole wrote: > Gowtham: > I waited before giving this answer, to let the real Windows Gurus answer > first. Tims pronouncement is as good is it gets, so here is my hair-brained > idea. Perhaps it would actually work. > > As much as I hate to admit this on a Windows mailing list ... > When I have multi-boot things to accomplish, I install a copy of Linux and > use GRUB to do the fancy boot stuff. As a matter of fact we're in the process of testing exactly this solution for the Digital Escalator Panels we run here on the London Underground. The requirement isn't quite the same but, in essence, we needed a degree of boot resilience which we couldn't get without a more configurable boot loader. However... this doesn't help the OP since GRUB runs (depending to configuration) from the MBR of the first bootable device. What the OP wants to do is to determine which device *is* the principal boot device. :) TJG From Sunny.Carter at metaswitch.com Tue Dec 22 17:07:00 2009 From: Sunny.Carter at metaswitch.com (Sunny Carter) Date: Tue, 22 Dec 2009 16:07:00 +0000 Subject: [python-win32] pywintypes.com_error using Python 3.0 Boolean type calling Photoshop API In-Reply-To: <44EE1E31095AE349AC6C3C0B69FFBF02932D18D33C@ENFIMBOX1.ad.datcon.co.uk> References: <44EE1E31095AE349AC6C3C0B69FFBF02932D18D33C@ENFIMBOX1.ad.datcon.co.uk> Message-ID: <44EE1E31095AE349AC6C3C0B69FFBF02932D18D3A4@ENFIMBOX1.ad.datcon.co.uk> I should add (as I have noticed this is misleading below) - that I have also tried Python 3.1.1 and pywin32-214.win32-py3.1.exe with exactly the same results. The trace of the exception below is from this attempt (hence it saying that dynamic.py is in Python31) ________________________________ From: Sunny Carter Sent: 22 December 2009 15:03 To: python-win32 at python.org Cc: Sunny Carter Subject: pywintypes.com_error using Python 3.0 Boolean type calling Photoshop API Hi all, I am writing a Python script to call across to Adobe Photoshop, to automate some image manipulation. (For historical reasons I'm writing using Python rather than javascript or VB) My problem is that my script works fine using Python 2.6, but fails after upgrading to Python 3.0 or 3.1.1. I've converted the script to Python 3.0 format, and it all works except the call across the Photoshop API. The problem seems to be with the win32 API call using a Boolean value (False in my python script) which is not recognised as a Boolean by Photoshop. Details: Script based in part on http://techarttiki.blogspot.com/2008/08/photoshop-scripting-with-python.html Script uses pywin32 from http://sourceforge.net/projects/pywin32/files/ - I have installed pywin32-214.win32-py2.6.exe for Python 2.6 and pywin32-214.win32-py3.0.exe for use with Python 3.0 Subset of the script: import win32com.client psApp = win32com.client.Dispatch('Photoshop.Application') doc = psApp.Open(os.path.abspath(psd_image.psd_filename)) # Here I do the image manipulation which I haven't included here as it is irrelevant (and working fine - # calling Photoshop and making it do stuff) psd_save_options = win32com.client.Dispatch("Photoshop.PNGSaveOptions") psd_save_options.Interlaced = False print("Save as %s" % (os.path.join(output_directory, psd_image.final_filename))) doc.SaveAs(os.path.join(output_directory, psd_image.final_filename), psd_save_options, True, 2) # lower case extension Exception hit: Unexpected error detail: Traceback (most recent call last): File "C:\brander\brander.py", line 6464, in main() File "C:\brander\brander.py", line 6407, in main recf) File "C:\brander\brander.py", line 4303, in createBranding brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1999, in reconstructImageDirectory new_color_palette) File "C:\brander\brander.py", line 2519, in reconstructPSDImageFile psd_save_options.Interlaced = False File "C:\Program Files\Python31\lib\site-packages\win32com\client\dynamic.py", line 550, in __setattr__ self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop' , 'Boolean value expected', None, 0, -2147220276), None) Investigation tracing from pywintypes.py The dll being loaded is C:\WINDOWS\system32\pywintypes30.dll Things tried so far I've already tried setting psd_save_options.Interlaced to True, "False", 0, 1 and None. In this, None gets further on in the script but then fails on the SaveAs call. If I delete the psd_save_options.Interlaced line, then the script fails in exactly the same way on the SaveAs call (this time the parameter True is the culprit). As I say - the same script works fine using Python 2.6 and pywin32-214.win32-py2.6.exe. I am running on Windows XP. Help? If anyone can help with a solution that would be great. If there is no way of fixing, is it possible to run my python script using Python 2.6 but call out to a separate script running Python 3.0 for the part where I require 3.0? (not included here) Thanks so much, Sunny Carter -------------- next part -------------- An HTML attachment was scrubbed... URL: From narisipalli at gmail.com Tue Dec 22 19:49:49 2009 From: narisipalli at gmail.com (Gowtham) Date: Tue, 22 Dec 2009 13:49:49 -0500 Subject: [python-win32] Setting a netboot within windows OS In-Reply-To: <4B308537.3000706@timgolden.me.uk> References: <4B308537.3000706@timgolden.me.uk> Message-ID: I will look if Lenovo Thinkpad provides any control to modify the BIOS parameters. Thank you all for your inputs :) On Tue, Dec 22, 2009 at 3:37 AM, Tim Golden wrote: > Vernon Cole wrote: > >> Gowtham: >> I waited before giving this answer, to let the real Windows Gurus answer >> first. Tims pronouncement is as good is it gets, so here is my >> hair-brained >> idea. Perhaps it would actually work. >> >> As much as I hate to admit this on a Windows mailing list ... >> When I have multi-boot things to accomplish, I install a copy of Linux and >> use GRUB to do the fancy boot stuff. >> > > As a matter of fact we're in the process of testing exactly > this solution for the Digital Escalator Panels we run here > on the London Underground. The requirement isn't quite the > same but, in essence, we needed a degree of boot resilience > which we couldn't get without a more configurable boot loader. > > However... this doesn't help the OP since GRUB runs (depending > to configuration) from the MBR of the first bootable device. What > the OP wants to do is to determine which device *is* the > principal boot device. > > :) > > TJG > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From narisipalli at gmail.com Tue Dec 22 20:23:35 2009 From: narisipalli at gmail.com (Gowtham) Date: Tue, 22 Dec 2009 14:23:35 -0500 Subject: [python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup Message-ID: I am trying to unjoin a machine from the domain and attempted with the following code import wmi wm = wmi.WMI() wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', 'DOMAIN\ADMINUSER') Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ handle_com_error (error_info) File "C:\Python24\Lib\site-packages\wmi.py", line 189, in handle_com_error raise x_wmi, "\n".join (exception_string) wmi.x_wmi: -0x7ffdfff7 - Exception occurred. Error in: SWbemObjectEx -0x7ffbefd1 - Invalid method Parameter(s) I dont understand why its calling these Invalid method parameters. All that it wants is an (Int, Str, Str) when using thru Python otherwise it is (Str, Str, int) as described here. http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx Any pointer? Thanks, Gowtham N -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Dec 22 20:42:53 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 22 Dec 2009 11:42:53 -0800 Subject: [python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup In-Reply-To: References: Message-ID: <4B31213D.4010702@probo.com> Gowtham wrote: > I am trying to unjoin a machine from the domain and attempted with the > following code > > > import wmi > wm = wmi.WMI() > wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', > 'DOMAIN\ADMINUSER') > > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ > handle_com_error (error_info) > File "C:\Python24\Lib\site-packages\wmi.py", line 189, in > handle_com_error > raise x_wmi, "\n".join (exception_string) > wmi.x_wmi: -0x7ffdfff7 - Exception occurred. > Error in: SWbemObjectEx > -0x7ffbefd1 - Invalid method Parameter(s) > > I dont understand why its calling these Invalid method parameters. All > that it wants is an (Int, Str, Str) when using thru Python otherwise > it is (Str, Str, int) as described here. > http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx > Why do you believe the parameter list needs to be different when calling from Python? Also, for safety, if you really do have the literal strings in your code, you need to protect the backslash in your domain. Either make it 'DOMAIN\\ADMINUSER' or use a raw string, r'DOMAIN\ADMINUSER'. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From narisipalli at gmail.com Tue Dec 22 21:41:08 2009 From: narisipalli at gmail.com (Gowtham) Date: Tue, 22 Dec 2009 15:41:08 -0500 Subject: [python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup In-Reply-To: <4B31213D.4010702@probo.com> References: <4B31213D.4010702@probo.com> Message-ID: Hi Tim, Inline- On Tue, Dec 22, 2009 at 2:42 PM, Tim Roberts wrote: > Gowtham wrote: > > I am trying to unjoin a machine from the domain and attempted with the > > following code > > > > > > import wmi > > wm = wmi.WMI() > > wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', > > 'DOMAIN\ADMINUSER') > > > > Traceback (most recent call last): > > File "", line 1, in ? > > File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ > > handle_com_error (error_info) > > File "C:\Python24\Lib\site-packages\wmi.py", line 189, in > > handle_com_error > > raise x_wmi, "\n".join (exception_string) > > wmi.x_wmi: -0x7ffdfff7 - Exception occurred. > > Error in: SWbemObjectEx > > -0x7ffbefd1 - Invalid method Parameter(s) > > > > I dont understand why its calling these Invalid method parameters. All > > that it wants is an (Int, Str, Str) when using thru Python otherwise > > it is (Str, Str, int) as described here. > > http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx > > > > Why do you believe the parameter list needs to be different when calling > from Python? > > Because- >>> wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup (ReturnValue)> The parameter sequence says FUnjoinOption, Password and Username while MOF says uint32 UnjoinDomainOrWorkgroup( [in] string Password, [in] string UserName, [in] uint32 FUnjoinOptions = 0 ); This is confusion for this reason. Thanks. > Also, for safety, if you really do have the literal strings in your > code, you need to protect the backslash in your domain. Either make it > 'DOMAIN\\ADMINUSER' or use a raw string, r'DOMAIN\ADMINUSER'. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sunny.Carter at metaswitch.com Tue Dec 22 16:03:27 2009 From: Sunny.Carter at metaswitch.com (Sunny Carter) Date: Tue, 22 Dec 2009 15:03:27 +0000 Subject: [python-win32] pywintypes.com_error using Python 3.0 Boolean type calling Photoshop API Message-ID: <44EE1E31095AE349AC6C3C0B69FFBF02932D18D33C@ENFIMBOX1.ad.datcon.co.uk> Hi all, I am writing a Python script to call across to Adobe Photoshop, to automate some image manipulation. (For historical reasons I'm writing using Python rather than javascript or VB) My problem is that my script works fine using Python 2.6, but fails after upgrading to Python 3.0 or 3.1.1. I've converted the script to Python 3.0 format, and it all works except the call across the Photoshop API. The problem seems to be with the win32 API call using a Boolean value (False in my python script) which is not recognised as a Boolean by Photoshop. Details: Script based in part on http://techarttiki.blogspot.com/2008/08/photoshop-scripting-with-python.html Script uses pywin32 from http://sourceforge.net/projects/pywin32/files/ - I have installed pywin32-214.win32-py2.6.exe for Python 2.6 and pywin32-214.win32-py3.0.exe for use with Python 3.0 Subset of the script: import win32com.client psApp = win32com.client.Dispatch('Photoshop.Application') doc = psApp.Open(os.path.abspath(psd_image.psd_filename)) # Here I do the image manipulation which I haven't included here as it is irrelevant (and working fine - # calling Photoshop and making it do stuff) psd_save_options = win32com.client.Dispatch("Photoshop.PNGSaveOptions") psd_save_options.Interlaced = False print("Save as %s" % (os.path.join(output_directory, psd_image.final_filename))) doc.SaveAs(os.path.join(output_directory, psd_image.final_filename), psd_save_options, True, 2) # lower case extension Exception hit: Unexpected error detail: Traceback (most recent call last): File "C:\brander\brander.py", line 6464, in main() File "C:\brander\brander.py", line 6407, in main recf) File "C:\brander\brander.py", line 4303, in createBranding brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1961, in reconstructImageDirectory brand_widgets) File "C:\brander\brander.py", line 1999, in reconstructImageDirectory new_color_palette) File "C:\brander\brander.py", line 2519, in reconstructPSDImageFile psd_save_options.Interlaced = False File "C:\Program Files\Python31\lib\site-packages\win32com\client\dynamic.py", line 550, in __setattr__ self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop' , 'Boolean value expected', None, 0, -2147220276), None) Investigation tracing from pywintypes.py The dll being loaded is C:\WINDOWS\system32\pywintypes30.dll Things tried so far I've already tried setting psd_save_options.Interlaced to True, "False", 0, 1 and None. In this, None gets further on in the script but then fails on the SaveAs call. If I delete the psd_save_options.Interlaced line, then the script fails in exactly the same way on the SaveAs call (this time the parameter True is the culprit). As I say - the same script works fine using Python 2.6 and pywin32-214.win32-py2.6.exe. I am running on Windows XP. Help? If anyone can help with a solution that would be great. If there is no way of fixing, is it possible to run my python script using Python 2.6 but call out to a separate script running Python 3.0 for the part where I require 3.0? (not included here) Thanks so much, Sunny Carter -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Wed Dec 23 10:03:44 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 23 Dec 2009 09:03:44 +0000 Subject: [python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup In-Reply-To: References: Message-ID: <4B31DCF0.3060403@timgolden.me.uk> Gowtham wrote: > I am trying to unjoin a machine from the domain and attempted with the > following code > > > import wmi > wm = wmi.WMI() > wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', > 'DOMAIN\ADMINUSER') > > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ > handle_com_error (error_info) > File "C:\Python24\Lib\site-packages\wmi.py", line 189, in handle_com_error > raise x_wmi, "\n".join (exception_string) > wmi.x_wmi: -0x7ffdfff7 - Exception occurred. > Error in: SWbemObjectEx > -0x7ffbefd1 - Invalid method Parameter(s) > > I dont understand why its calling these Invalid method parameters. All that > it wants is an (Int, Str, Str) when using thru Python otherwise it is (Str, > Str, int) as described here. > http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx Just to cut the small Gordian knot, you can pass the parameters by name rather than by position: (as long as you're using a reasonably recent version of the wmi module, >= 1.3.2 IIRC). w.Win32_ComputerSystem.UnjoinDomainOrWorkgroup ( UserName="blah", Password="blah", FUnjoinOptions=0 ) Unfortunately, the method definition picks up the parameters in the order in which WMI returns them. Under the covers it's basically doing this: in_params = [(i.Name, i.Array) for i in method.InParameters.Properties_] I've got no idea if there is any guarantee about the order of parameters. As you say, the MOF / schema suggests a different order. FWIW, you can see it without having to load the MOF file like this: print w.Win32_ComputerSystem (Granted, you have to hunt for the method you're after...) Glancing at a few other method definitions, it does seem as though WMI is consistently returning params in the reverse order of their definition in the MOF. If this turns out to be the case across the board I can easily reverse them as they come out of WMI, but this will break anyone's code which has used the old positions. I shall have to consider this... TJG From mail at timgolden.me.uk Wed Dec 23 10:24:31 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 23 Dec 2009 09:24:31 +0000 Subject: [python-win32] Invalid method parameters with UnjoinDomainOrWorkgroup In-Reply-To: <4B31DCF0.3060403@timgolden.me.uk> References: <4B31DCF0.3060403@timgolden.me.uk> Message-ID: <4B31E1CF.1080309@timgolden.me.uk> Tim Golden wrote: > Gowtham wrote: >> I am trying to unjoin a machine from the domain and attempted with the >> following code >> >> >> import wmi >> wm = wmi.WMI() >> wm.Win32_ComputerSystem.UnjoinDomainOrWorkgroup(2, 'ADMINPASSWORD', >> 'DOMAIN\ADMINUSER') >> >> Traceback (most recent call last): >> File "", line 1, in ? >> File "C:\Python24\Lib\site-packages\wmi.py", line 396, in __call__ >> handle_com_error (error_info) >> File "C:\Python24\Lib\site-packages\wmi.py", line 189, in handle_com_error >> raise x_wmi, "\n".join (exception_string) >> wmi.x_wmi: -0x7ffdfff7 - Exception occurred. >> Error in: SWbemObjectEx >> -0x7ffbefd1 - Invalid method Parameter(s) >> >> I dont understand why its calling these Invalid method parameters. All that >> it wants is an (Int, Str, Str) when using thru Python otherwise it is (Str, >> Str, int) as described here. >> http://msdn.microsoft.com/en-us/library/aa393942(VS.85).aspx > > Just to cut the small Gordian knot, you can pass the parameters > by name rather than by position: > (as long as you're using a reasonably recent version of the > wmi module, >= 1.3.2 IIRC). > > w.Win32_ComputerSystem.UnjoinDomainOrWorkgroup ( > UserName="blah", > Password="blah", > FUnjoinOptions=0 > ) Sorry; of course that example (and your code above) should be using a Win32_ComputerSystem *instance*, not the class itself: for sys in c.Win32_ComputerSystem (): sys.UnjoinDomainOrWorkgroup ( ... ) TJG From sinisa at studionebo.com Wed Dec 23 12:28:32 2009 From: sinisa at studionebo.com (Sinisa Barisic) Date: Wed, 23 Dec 2009 12:28:32 +0100 Subject: [python-win32] classic asp, pywin32, python 3.1 Message-ID: <4B31FEE0.8030401@studionebo.com> Hi to all, Can anyone help with this (classic asp, activex scripting, language="python") 1. manually installation of python 3.1 and pywin32-3.1 = HTTP error 500. activepython usually solve this, but last build from them is without pywin... pyscript.py says "Registered: Python" and thats all. 2. How to get bytes from an form "multipart/data-form" into python context, asp page.. Request.BinaryRead ? 3. I am an old user of classic.asp and python puts smile on my face when working with it but things that bothers me are: - IIS- win 2003 , any scenario proved to be stable on this setup ? (wsgi,fastcgi,cgi....) - Apache- win 2003, better-worst-same ? benefits? If someone have experience with all of this, please tell something.. thank you Sinisa Barisic From Eli.Sandler at vanadium-soft.com Thu Dec 24 08:26:55 2009 From: Eli.Sandler at vanadium-soft.com (Eli Sandler) Date: Thu, 24 Dec 2009 09:26:55 +0200 Subject: [python-win32] Problems retrieving SACL of registry key from remote machine Message-ID: Hi, I have a problem retrieving SACL of a registry key from a remote machine. It fails with the exception: (14, 'RegGetKeySecurity', 'Not enough storage is available to complete this operation.') Here is the code snippet: logon_type = win32security.LOGON32_LOGON_INTERACTIVE default_provider = win32security.LOGON32_PROVIDER_DEFAULT handle = win32security.LogonUser(user, domain, password, logon_type, default_provider) win32security.ImpersonateLoggedOnUser(handle) regHandle = win32api.RegConnectRegistry(ip, hive_const) keyHandle = win32api.RegOpenKey(regHandle, key) sd = win32api.RegGetKeySecurity(keyHandle, win32security.SACL_SECURITY_INFORMATION) Any help will be appreciated. -- Eliyahu Sandler Software Engineer Vanadium Software Ltd. www.vanadium-soft.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjgritter at atlantic-aero.com Thu Dec 24 15:40:27 2009 From: rjgritter at atlantic-aero.com (RJ Gritter) Date: Thu, 24 Dec 2009 09:40:27 -0500 Subject: [python-win32] DDE Client Scripting Message-ID: <85D17B9A69604D75907EA2B568A3604F@RJGCATV5> Hey all, I'm working on a project that involves DDE communication and I'm using the DDE module in pywin32 to accomplish this communication. I've been playing with the example DDE scripts provided with pywin but I'm having some trouble. I have a functioning client script that successfully reads data from my DDE server, but now I need to be able to send data back to the server. I can't seem to find an example of how to write data from a client to a server, only read. Can anyone point me in the right direction here? Any advice or script examples would be extremely helpful. Thanks in advance, RJ Gritter -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Tue Dec 29 14:44:26 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 29 Dec 2009 13:44:26 +0000 Subject: [python-win32] odbc version Message-ID: <4B3A07BA.1090009@chamonix.reportlab.co.uk> I'm trying to use the odbc extension in a cross-python version. The problem is that recent pythons/win32 versions have changed the odbc dbi interface. Is there a way to check whether I should be importing dbi to find the type of date to be used or just assuming datetime is used? In the modern context just importing dbi causes a warning so I would prefer to avoid testing the result of dbi.dbiDate(..) etc etc -- Robin Becker From vernondcole at gmail.com Tue Dec 29 15:34:33 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 29 Dec 2009 07:34:33 -0700 Subject: [python-win32] odbc version In-Reply-To: <4B3A07BA.1090009@chamonix.reportlab.co.uk> References: <4B3A07BA.1090009@chamonix.reportlab.co.uk> Message-ID: Robin: A quick reminder -- odbc (in pywin32) is db api version 1.0 compliant. adodbapi is db api version 2.0 compliant, and uses odbc DSN connections by default if you use a simple connection string. Select your db module by deciding what level of api compliance you need. If you use adodbapi, the module will return datetime.datetime by default. You can request time.datetime (let the programmer beware) or mxdatetime if you wish. I cannot give an authoritative answer for odbc (sorry). -- Vernon On Tue, Dec 29, 2009 at 6:44 AM, Robin Becker wrote: > I'm trying to use the odbc extension in a cross-python version. The problem > is that recent pythons/win32 versions have changed the odbc dbi interface. > > Is there a way to check whether I should be importing dbi to find the type > of date to be used or just assuming datetime is used? > > In the modern context just importing dbi causes a warning so I would prefer > to avoid testing the result of dbi.dbiDate(..) etc etc > -- > Robin Becker > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Tue Dec 29 21:42:45 2009 From: python at bdurham.com (python at bdurham.com) Date: Tue, 29 Dec 2009 15:42:45 -0500 Subject: [python-win32] Read USB memory stick serial number Message-ID: <1262119365.6175.1352156657@webmail.messagingengine.com> Apparently retrieving the serial number of a USB memory stick is much more complicated than one would think. Is there a published Python recipe for determining a USB memory stick's device level serial number under Windows and/or Linux/Mac? My Windows research follows my signature. Any feedback appreciated. Regards, Malcolm 1. Here's a VBS script that attempts to use WMI to retrieve a USB serial number. This script reports my USB drive as PHYSICALDRIVE4 with an empty serial number. Based on this experiment, it looks like WMI does not have access to the information we're looking for. set svc = getobject ( "winmgmts:root\cimv2" ) set objEnum = svc.execQuery ( "select SerialNumber from win32_physicalMedia ") s1 = "" for each obj in objEnum s1 = s1 + obj.GetObjectText_ + VBCR next wscript.echo s1 2. Here's what I found on my 64-bit Windows 7 Professional registry using the following registry key I discovered during my research on this topic[1]: - Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\USBSTOR\Enum - Value: 0 = USB\VID_13FE&PID_1D00\5B7A11000302 Here's how the above value breaks out (text in parentheses are my own notes): - VID: 13FE (vendor id; Kingston Technology Company Inc.) - PID: 1D00 (product id; DataTraveler 2.0 1GB/4GB Flash Drive) - S/N: 5B7A11000302 Unfortunately, I don't know how one would identify a specific device if multiple devices were present (I don't have multiple memory sticks to test against yet). I assume that one technique would be to enumerate against similar keys and/or values (0...N)? I also don't know how portable this technique (key/value) is across various flavors of Windows. 3. Here's what VOL returns from CMD shell via VOL D: Volume serial number: 7644-2554 This serial number can be changed by a user via the LABEL command. This serial number does not appear to be mathematically related to the USB serial number. References: [1] USBDeview is a small utility that lists all USB devices that are currently connected to your computer, as well as all USB devices that you previously used. For each USB device, extended information is displayed: Device name/description, device type, serial number (for mass storage devices), the date/time that device was added, VendorID, ProductID, and more. http://www.nirsoft.net/utils/usb_devices_view.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Dec 29 22:01:27 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 29 Dec 2009 21:01:27 +0000 Subject: [python-win32] Read USB memory stick serial number In-Reply-To: <1262119365.6175.1352156657@webmail.messagingengine.com> References: <1262119365.6175.1352156657@webmail.messagingengine.com> Message-ID: <4B3A6E27.1020803@timgolden.me.uk> python at bdurham.com wrote: > Apparently retrieving the serial number of a USB memory stick is > much more complicated than one would think. > > Is there a published Python recipe for determining a USB memory > stick's device level serial number under Windows and/or > Linux/Mac? > 1. Here's a VBS script that attempts to use WMI to retrieve a USB > serial number. This script reports my USB drive as PHYSICALDRIVE4 > with an empty serial number. Based on this experiment, it looks > like WMI does not have access to the information we're looking > for. Try using Win32_DiskDrive instead. I'm not 100% sure (read: I'm about 1% sure) what constitutes the USB serial number. The only thing I'm fairly sure about is that it's *not* the volume label. The PNPDeviceID looks good, even if it might need a bit of parsing: import wmi c = wmi.WMI () for usb in c.Win32_DiskDrive (InterfaceType="USB"): print usb.PNPDeviceID TJG From python at bdurham.com Wed Dec 30 00:19:02 2009 From: python at bdurham.com (python at bdurham.com) Date: Tue, 29 Dec 2009 18:19:02 -0500 Subject: [python-win32] Read USB memory stick serial number In-Reply-To: <4B3A6E27.1020803@timgolden.me.uk> References: <1262119365.6175.1352156657@webmail.messagingengine.com> <4B3A6E27.1020803@timgolden.me.uk> Message-ID: <1262128742.29248.1352186161@webmail.messagingengine.com> Tim, Cheers for the great solution!! Your code gives me an easy to parse string containing the same serial number as reported by USBDeview.exe. Thank you very much, Malcolm Try using Win32_DiskDrive instead. I'm not 100% sure (read: I'm about 1% sure) what constitutes the USB serial number. The only thing I'm fairly sure about is that it's *not* the volume label. The PNPDeviceID looks good, even if it might need a bit of parsing: import wmi c = wmi.WMI () for usb in c.Win32_DiskDrive (InterfaceType="USB"): print usb.PNPDeviceID From timr at probo.com Wed Dec 30 01:03:02 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 29 Dec 2009 16:03:02 -0800 Subject: [python-win32] Read USB memory stick serial number In-Reply-To: <1262128742.29248.1352186161@webmail.messagingengine.com> References: <1262119365.6175.1352156657@webmail.messagingengine.com> <4B3A6E27.1020803@timgolden.me.uk> <1262128742.29248.1352186161@webmail.messagingengine.com> Message-ID: <4B3A98B6.1010001@probo.com> python at bdurham.com wrote: > Cheers for the great solution!! > > Your code gives me an easy to parse string containing the same serial > number as reported by USBDeview.exe. > As a driver writer, I am now required by law to give you the "party line" speech. For USB devices that have a serial number descriptor, the PnP device ID (in the "device path") happens to include that serial number. However, the format of the device ID is undocumented and, officially, subject to change at any time. Those of us who have been working with it know that this format has remained the same since PnP was introduced, and it is vanishingly unlikely that it will ever change in the future. However, the official word is that you should treat the device path as an opaque token. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From robin at reportlab.com Wed Dec 30 11:10:58 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 30 Dec 2009 10:10:58 +0000 Subject: [python-win32] odbc version In-Reply-To: References: <4B3A07BA.1090009@chamonix.reportlab.co.uk> Message-ID: <4B3B2732.2050602@chamonix.reportlab.co.uk> On 29/12/2009 14:34, Vernon Cole wrote: > Robin: > A quick reminder -- odbc (in pywin32) is db api version 1.0 compliant. > adodbapi is db api version 2.0 compliant, and uses odbc DSN connections by > default if you use a simple connection string. > Select your db module by deciding what level of api compliance you need. > > If you use adodbapi, the module will return datetime.datetime by default. > You can request time.datetime (let the programmer beware) or mxdatetime if > you wish. > I didn't even know about adodbapi, but it's on my machine anyway. The layer above the database is pretty simple and we are attempting to use mxodbc/odbc/mysql/csv so the api at level 1.0 is probably sufficient (at least it has been up to now). I think the problem is to decide whether odbc will return datetime.datetime or PyTime. If the worst comes to the worst I can just turn off the warning during the import. > I cannot give an authoritative answer for odbc (sorry). > -- > Vernon > > On Tue, Dec 29, 2009 at 6:44 AM, Robin Becker wrote: > >> I'm trying to use the odbc extension in a cross-python version. The problem >> is that recent pythons/win32 versions have changed the odbc dbi interface. >> >> Is there a way to check whether I should be importing dbi to find the type >> of date to be used or just assuming datetime is used? >> >> In the modern context just importing dbi causes a warning so I would prefer >> to avoid testing the result of dbi.dbiDate(..) etc etc >> -- >> Robin Becker >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > -- Robin Becker From sabdelrazak at symbyo.com Wed Dec 30 22:09:34 2009 From: sabdelrazak at symbyo.com (Sarah Abdel Razak) Date: Wed, 30 Dec 2009 23:09:34 +0200 Subject: [python-win32] Python com server error Message-ID: Hi all, I have a problem when registering a Python com server, I got a message box that says : " Invalid command line argument. This programs provides LocalServer com support for Python COM objects. It is typically run automatically by COM, passing passing as arguments The ProgID or CLSID of the Python server(s) to be hosted " Although the same server was registered successfully on other machines that has different windows OS, I would appreciate any help. Thanks, -- Sarah Abdelrazak -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Dec 30 22:20:25 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 30 Dec 2009 13:20:25 -0800 Subject: [python-win32] Python com server error In-Reply-To: References: Message-ID: <4B3BC419.1080502@probo.com> Sarah Abdel Razak wrote: > Hi all, > > I have a problem when registering a Python com server, I got a > message box that says : > > " Invalid command line argument. > This programs provides LocalServer com support for Python COM objects. > It is typically run automatically by COM, passing passing as > arguments The ProgID or CLSID of the Python server(s) to be hosted " > > Although the same server was registered successfully on other machines > that has different windows OS, I would appreciate any help. Please show us exactly what you typed that led to this. My first guess is that you have a mistake on the command line. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Wed Dec 30 23:16:55 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 30 Dec 2009 14:16:55 -0800 Subject: [python-win32] Python com server error In-Reply-To: References: <4B3BC419.1080502@probo.com> Message-ID: <4B3BD157.5030400@probo.com> Sarah Abdel Razak wrote: > I have a batch file that has the following line " Server.py > --regitser " and the command worked on other machines and it is on > the same location as the server file . > and when I run the file from the Pythonwin IDE and give it > "--regitser " as an argument it hangs. > I even tried to run it from the IDLE and also failed. That's misspelled. It should be "--register". -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Dec 31 00:18:57 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 30 Dec 2009 15:18:57 -0800 Subject: [python-win32] Python com server error In-Reply-To: References: Message-ID: <4B3BDFE1.8010601@probo.com> Sarah Abdel Razak wrote: > > I have a problem when registering a Python com server, I got a message > box that says : > > " Invalid command line argument. > This programs provides LocalServer com support for Python COM objects. > It is typically run automatically by COM, passing passing as > arguments The ProgID or CLSID of the Python server(s) to be hosted " > > Although the same server was registered successfully on other machines > that has different windows OS, I would appreciate any help. Is this the same script you were working on in July? For a local server, some of the processing is up to you. If you want to register, you call win32com.server.register.UseCommandLine. If you want to run the server, you call win32com.server.localserver.serve. Do you have code to do that? What does your Server.py code look like? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Dec 31 18:40:55 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 31 Dec 2009 09:40:55 -0800 Subject: [python-win32] Python com server error In-Reply-To: References: <4B3BDFE1.8010601@probo.com> Message-ID: <4B3CE227.2070303@probo.com> Sarah Abdel Razak wrote: > That is how I register and run the server. > > if __name__=='__main__': > if '--register' in sys.argv[1:] or '--unregister' in sys.argv[1:]: > import win32com.server.register > win32com.server.register.UseCommandLine(SpssAnalysis, > debug=debugging) > else: > # start the server. > from win32com.server import localserver > localserver.main() Note that "--register" must be spelled exactly like that in order for this to work. I suggest you add this just after the "if __name__" statement: from pprint import pprint pprint( sys.argv ) That, at least, will let you see exactly what the parameters are. > And I start the server from .Net > .... Yes, but it's the registration that's failing, right? You won't ever be able to start the object if it isn't registered. > I was think that there can be a problem with the Windows itself or > its registry on that machine which runs Vista , as the same server > registered successfully on other machines with different OS Windows > XP, Vista and even Windows 7. Well, that might be a problem if registration succeeded but you were unable to instantiate it. As I understand it, your problem is happening much earlier than that. Are you running this as an administrative user? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Thu Dec 31 19:07:28 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 31 Dec 2009 11:07:28 -0700 Subject: [python-win32] odbc version In-Reply-To: <4B3B2732.2050602@chamonix.reportlab.co.uk> References: <4B3A07BA.1090009@chamonix.reportlab.co.uk> <4B3B2732.2050602@chamonix.reportlab.co.uk> Message-ID: On Wed, Dec 30, 2009 at 3:10 AM, Robin Becker wrote: > On 29/12/2009 14:34, Vernon Cole wrote: > >> Robin: >> A quick reminder -- odbc (in pywin32) is db api version 1.0 compliant. >> adodbapi is db api version 2.0 compliant, and uses odbc DSN connections >> by >> default if you use a simple connection string. >> Select your db module by deciding what level of api compliance you need. >> >> If you use adodbapi, the module will return datetime.datetime by default. >> You can request time.datetime (let the programmer beware) or mxdatetime if >> you wish. >> >> > I didn't even know about adodbapi, but it's on my machine anyway. The layer > above the database is pretty simple and we are attempting to use > mxodbc/odbc/mysql/csv so the api at level 1.0 is probably sufficient (at > least it has been up to now). I think the problem is to decide whether odbc > will return datetime.datetime or PyTime. If the worst comes to the worst I > can just turn off the warning during the import. > > Robin: adodbapi has been included with the last few releases of pywin32, so you have your chioce: adodbapi - api v 2.0 - pure Python - Microsoft ADO - open source odbc - api v 1.0 - implemented in C - Microsoft ODBC - open source mxodbc - api v 2.0 - implemented in C - Microsoft ODBC - proprietary license Both adodbapi and mxodbc are tested against MySQL. According to eGenix documentation, mxodbc returns date and time values in mxDateTime format. In past years, before python's datetime module was invented, the only tool in the shed was the old unix style PyTime format. It dreadfully needed replacement, and I do not recommend it for production work. It gets lost when time zones and/or daylight saving time gets involved sometimes giving an error of a whole day. eGenix invented mxDateTime to overcome the limitations of PyTime, and it does a fine job. The original db api version 2.0 spec requests that mxDataTime format be used if possible. (This is not strange given that the author of the specification, Marc-Andr? Lemburg, works for eGenix, and also it was clearly the best choice at the time.) The current edition of the 2.0 spec says: > Date/time objects can be implemented as Python datetime module > objects (available since Python 2.3, with a C API since 2.4) or > using the mxDateTime package (available for all Python versions > since 1.5.2). They both provide all necessary constructors and > > methods at Python and C level. > > Which causes a surprise in the current version of adodbapi in that if you install mxtools on a workstation, your next database access will suddenly return mxDateTime values. The version I am now working on will change its default to datetime.datetime whether or not mxtools is installed. (Note to self: write a pending depreciation warning.) Current versions of mxtools will correctly compare mxDateTime objects with datetime.datetime objects. If you are licensed to use mxodbc, you should import the eGenix module (not the odbc module from pywin32) like: >>> import mx.ODBC.Windows >>> db = mx.ODBC.Windows.DriverConnect('DSN=database;UID=user;PWD=passwd' The equivalent in adodbapi is probably: >>> import adodbapi >>> db = adodbapi.connect'(DSN=database, UID=user, PWD=passwd') # if you want mxDateTime >>>adodbapi.adodbapi.dateconverter = adodbapi.adodbapi.mxDateTimeConverter() # to force datetime.datetime >>>adodbapi.adodbapi.dateconverter = adodbapi.adodbapi.pythonDateTimeConverter() Also, I note you spicified csv as one of your storage types. You may find that the csv.py module works better than the ODBC csv driver if the csv format is at all unusual. Yes, you can ignore the warning, but remember that the reason it is there is to encourage you to switch to a more modern api. -- Vernon > > I cannot give an authoritative answer for odbc (sorry). >> -- >> Vernon >> >> On Tue, Dec 29, 2009 at 6:44 AM, Robin Becker >> wrote: >> >> I'm trying to use the odbc extension in a cross-python version. The >>> problem >>> is that recent pythons/win32 versions have changed the odbc dbi >>> interface. >>> >>> Is there a way to check whether I should be importing dbi to find the >>> type >>> of date to be used or just assuming datetime is used? >>> >>> In the modern context just importing dbi causes a warning so I would >>> prefer >>> to avoid testing the result of dbi.dbiDate(..) etc etc >>> -- >>> Robin Becker >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >>> >>> >> > > -- > Robin Becker > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kelvin.lomboy at rgonline.com Thu Dec 31 17:58:53 2009 From: kelvin.lomboy at rgonline.com (Kelvin Lomboy Mendez) Date: Thu, 31 Dec 2009 12:58:53 -0400 Subject: [python-win32] Question concerning wmi c.CIM_DataFile Message-ID: <2E8EE617FF5865459F6EF9217BC466E2063E3C@opr-pr-exc-01.rgfc.main> I'm currently writing a script to access approximately 400 computers for removing a particular app from the system. I'm having problems getting results using the wmi c.CIM_DataFile (name=file). When I use file as a variable which equals to the path to the app I want to remove I don't get nothing back, however, if I hard code the path, I get results. See snippet below for an example of what I'm talking about. I appreciate in advance for any help I can get. Thank you. import wmi import re def queryFile(file, host): print '[Debug nukeXmas()]:' + file c = wmi.WMI(host) for f in c.CIM_DataFile (name=file): print 'Install Date:', f.InstallDate def queryFile2(file, host): print '[Debug nukeXmas()]:' + file c = wmi.WMI(host) for f in c.CIM_DataFile (name="C:\\DOCUME~1\\profileName\\LOCALS~1\\Temp\\Temporary Directory 1 for deluxetreee (2).zip\\Christmas.exe"): print 'Install Date:', f.InstallDate #File to query string = "C:\DOCUME~1\profileName\LOCALS~1\Temp\\Temporary Directory 1 for deluxetreee (2).zip\Christmas.exe" #Substitute "\" to "\\" path = re.sub('\\\\', '\\\\\\\\', string) #Close query path with double quotes file = '"'+path+'"' #I'm having problems here, query brings back nothing queryFile(file, '172.27.1.5') #Here, I hard code the path to the exe and it works queryFile2(file, '172.27.1.5') Kelvin Lomboy Security+, OSCP, CEH Information Security Specialist R-G Financial Corporation Phone: (787) 288-1800 x3161 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ This communication and any attachments included herein contain information that belongs to R-G FINANCIAL CORP., and/or its subsidiaries that may be confidential and/or legally privileged. The information is intended only for the use of the individual or entity named above. If you have received this communication by error please delete or destroy it and notify the sender immediately. Its unauthorized disclosure, copying or distribution is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: