From santosh.mce at gmail.com Mon Jun 1 11:43:19 2009 From: santosh.mce at gmail.com (Santosh Mohan) Date: Mon, 1 Jun 2009 15:13:19 +0530 Subject: [python-win32] Problem in install Distutils/python-sybase-0.39 Message-ID: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> Hi, I am facing problem in installing python-sybase-0.39 and Distutils. python-sybase-0.39 requires Distutils. ------------------------------------------------------------------------------------------------------- *santosh-r4c:~/python-sybase-0.38 # ls* .cvsignore LICENCE Sybase.py blk.c conn.c databuf.c datetime.c examples iodesc.c money.c numeric.c sybasect.c ChangeLog PKG-INFO TODO cmd.c ctx.c datafmt.c doc freetds.h locale.c msgs.c setup.py sybasect.h * santosh-r4c:~/python-sybase-0.38 # python setup.py install* Traceback (most recent call last): File "setup.py", line 12, in ? import distutils ImportError: No module named distutils *santosh-r4c:~/Distutils-1.0.2 # ls* CHANGES.txt MANIFEST.in PKG-INFO README.txt TODO USAGE.txt distutils doc examples misc setup.cfg setup.py *santosh-r4c:~/Distutils-1.0.2 # python setup.py build* Traceback (most recent call last): File "setup.py", line 30, in ? packages = ['distutils', 'distutils.command'], File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup _setup_distribution = dist = klass(attrs) File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ setattr(self, method_name, getattr(self.metadata, method_name)) AttributeError: DistributionMetadata instance has no attribute 'get___doc__' *santosh-r4c:~/Distutils-1.0.2 # python setup.py install* Traceback (most recent call last): File "setup.py", line 30, in ? packages = ['distutils', 'distutils.command'], File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup _setup_distribution = dist = klass(attrs) File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ setattr(self, method_name, getattr(self.metadata, method_name)) AttributeError: DistributionMetadata instance has no attribute 'get___doc__' srm-srv-r4c:~/Distutils-1.0.2 # Can someone help me! -- Regards, Santosh M -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerdusvanzyl at gmail.com Mon Jun 1 11:58:45 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Mon, 1 Jun 2009 11:58:45 +0200 Subject: [python-win32] Problem in install Distutils/python-sybase-0.39 In-Reply-To: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> References: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> Message-ID: <91882ea90906010258y535c019ei707ea9b08549039b@mail.gmail.com> what python version are you running? and from where did you get python? distutils should be part of your python since it's part of the standard library. On Mon, Jun 1, 2009 at 11:43 AM, Santosh Mohan wrote: > Hi, > > I am facing problem in installing python-sybase-0.39 and Distutils. > > python-sybase-0.39 requires Distutils. > > ------------------------------------------------------------------------------------------------------- > santosh-r4c:~/python-sybase-0.38 # ls > .cvsignore ?LICENCE ? Sybase.py ?blk.c ?conn.c ?databuf.c ?datetime.c > ?examples ? iodesc.c ?money.c ?numeric.c ?sybasect.c > ChangeLog ? PKG-INFO ?TODO ? ? ? cmd.c ?ctx.c ? datafmt.c ?doc > freetds.h ?locale.c ?msgs.c ? setup.py ? sybasect.h > > santosh-r4c:~/python-sybase-0.38 # python setup.py install > Traceback (most recent call last): > ?File "setup.py", line 12, in ? > ? ?import distutils > ImportError: No module named distutils > > > santosh-r4c:~/Distutils-1.0.2 # ls > CHANGES.txt ?MANIFEST.in ?PKG-INFO ?README.txt ?TODO ?USAGE.txt ?distutils > ?doc ?examples ?misc ?setup.cfg ?setup.py > santosh-r4c:~/Distutils-1.0.2 # python setup.py build > Traceback (most recent call last): > ?File "setup.py", line 30, in ? > ? ?packages = ['distutils', 'distutils.command'], > ?File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup > ? ?_setup_distribution = dist = klass(attrs) > ?File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ > ? ?setattr(self, method_name, getattr(self.metadata, method_name)) > AttributeError: DistributionMetadata instance has no attribute 'get___doc__' > > santosh-r4c:~/Distutils-1.0.2 # python setup.py install > Traceback (most recent call last): > ? File "setup.py", line 30, in ? > ??? packages = ['distutils', 'distutils.command'], > ? File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup > ??? _setup_distribution = dist = klass(attrs) > ? File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ > ??? setattr(self, method_name, getattr(self.metadata, method_name)) > AttributeError: DistributionMetadata instance has no attribute 'get___doc__' > srm-srv-r4c:~/Distutils-1.0.2 # > > Can someone help me! > > -- > Regards, > Santosh M > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From santosh.mce at gmail.com Mon Jun 1 13:13:38 2009 From: santosh.mce at gmail.com (Santosh Mohan) Date: Mon, 1 Jun 2009 16:43:38 +0530 Subject: [python-win32] Problem in install Distutils/python-sybase-0.39 In-Reply-To: <91882ea90906010258y535c019ei707ea9b08549039b@mail.gmail.com> References: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> <91882ea90906010258y535c019ei707ea9b08549039b@mail.gmail.com> Message-ID: <427239420906010413n4fd36b2cw6e0d7df3311f343@mail.gmail.com> Python is the same of SLES10 distro santosh-r4c:~ # python -V Python 2.4.2 On Mon, Jun 1, 2009 at 3:28 PM, Gerdus van Zyl wrote: > what python version are you running? and from where did you get > python? distutils should be part of your python since it's part of the > standard library. > > On Mon, Jun 1, 2009 at 11:43 AM, Santosh Mohan > wrote: > > Hi, > > > > I am facing problem in installing python-sybase-0.39 and Distutils. > > > > python-sybase-0.39 requires Distutils. > > > > > ------------------------------------------------------------------------------------------------------- > > santosh-r4c:~/python-sybase-0.38 # ls > > .cvsignore LICENCE Sybase.py blk.c conn.c databuf.c datetime.c > > examples iodesc.c money.c numeric.c sybasect.c > > ChangeLog PKG-INFO TODO cmd.c ctx.c datafmt.c doc > > freetds.h locale.c msgs.c setup.py sybasect.h > > > > santosh-r4c:~/python-sybase-0.38 # python setup.py install > > Traceback (most recent call last): > > File "setup.py", line 12, in ? > > import distutils > > ImportError: No module named distutils > > > > > > santosh-r4c:~/Distutils-1.0.2 # ls > > CHANGES.txt MANIFEST.in PKG-INFO README.txt TODO USAGE.txt > distutils > > doc examples misc setup.cfg setup.py > > santosh-r4c:~/Distutils-1.0.2 # python setup.py build > > Traceback (most recent call last): > > File "setup.py", line 30, in ? > > packages = ['distutils', 'distutils.command'], > > File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup > > _setup_distribution = dist = klass(attrs) > > File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ > > setattr(self, method_name, getattr(self.metadata, method_name)) > > AttributeError: DistributionMetadata instance has no attribute > 'get___doc__' > > > > santosh-r4c:~/Distutils-1.0.2 # python setup.py install > > Traceback (most recent call last): > > File "setup.py", line 30, in ? > > packages = ['distutils', 'distutils.command'], > > File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup > > _setup_distribution = dist = klass(attrs) > > File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ > > setattr(self, method_name, getattr(self.metadata, method_name)) > > AttributeError: DistributionMetadata instance has no attribute > 'get___doc__' > > srm-srv-r4c:~/Distutils-1.0.2 # > > > > Can someone help me! > > > > -- > > Regards, > > Santosh M > > > > > > _______________________________________________ > > python-win32 mailing list > > python-win32 at python.org > > http://mail.python.org/mailman/listinfo/python-win32 > > > > > -- Regards, Santosh M -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerdusvanzyl at gmail.com Mon Jun 1 13:41:32 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Mon, 1 Jun 2009 13:41:32 +0200 Subject: [python-win32] Problem in install Distutils/python-sybase-0.39 In-Reply-To: <427239420906010413n4fd36b2cw6e0d7df3311f343@mail.gmail.com> References: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> <91882ea90906010258y535c019ei707ea9b08549039b@mail.gmail.com> <427239420906010413n4fd36b2cw6e0d7df3311f343@mail.gmail.com> Message-ID: <91882ea90906010441t4d4bee84nae584fd2a909e481@mail.gmail.com> Ok try installing the python-devel package. On Mon, Jun 1, 2009 at 1:13 PM, Santosh Mohan wrote: > Python is the same of SLES10 distro > > santosh-r4c:~ # python -V > Python 2.4.2 > > > On Mon, Jun 1, 2009 at 3:28 PM, Gerdus van Zyl > wrote: >> >> what python version are you running? and from where did you get >> python? distutils should be part of your python since it's part of the >> standard library. >> >> On Mon, Jun 1, 2009 at 11:43 AM, Santosh Mohan >> wrote: >> > Hi, >> > >> > I am facing problem in installing python-sybase-0.39 and Distutils. >> > >> > python-sybase-0.39 requires Distutils. >> > >> > >> > ------------------------------------------------------------------------------------------------------- >> > santosh-r4c:~/python-sybase-0.38 # ls >> > .cvsignore ?LICENCE ? Sybase.py ?blk.c ?conn.c ?databuf.c ?datetime.c >> > ?examples ? iodesc.c ?money.c ?numeric.c ?sybasect.c >> > ChangeLog ? PKG-INFO ?TODO ? ? ? cmd.c ?ctx.c ? datafmt.c ?doc >> > freetds.h ?locale.c ?msgs.c ? setup.py ? sybasect.h >> > >> > santosh-r4c:~/python-sybase-0.38 # python setup.py install >> > Traceback (most recent call last): >> > ?File "setup.py", line 12, in ? >> > ? ?import distutils >> > ImportError: No module named distutils >> > >> > >> > santosh-r4c:~/Distutils-1.0.2 # ls >> > CHANGES.txt ?MANIFEST.in ?PKG-INFO ?README.txt ?TODO ?USAGE.txt >> > ?distutils >> > ?doc ?examples ?misc ?setup.cfg ?setup.py >> > santosh-r4c:~/Distutils-1.0.2 # python setup.py build >> > Traceback (most recent call last): >> > ?File "setup.py", line 30, in ? >> > ? ?packages = ['distutils', 'distutils.command'], >> > ?File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup >> > ? ?_setup_distribution = dist = klass(attrs) >> > ?File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ >> > ? ?setattr(self, method_name, getattr(self.metadata, method_name)) >> > AttributeError: DistributionMetadata instance has no attribute >> > 'get___doc__' >> > >> > santosh-r4c:~/Distutils-1.0.2 # python setup.py install >> > Traceback (most recent call last): >> > ? File "setup.py", line 30, in ? >> > ??? packages = ['distutils', 'distutils.command'], >> > ? File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup >> > ??? _setup_distribution = dist = klass(attrs) >> > ? File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in __init__ >> > ??? setattr(self, method_name, getattr(self.metadata, method_name)) >> > AttributeError: DistributionMetadata instance has no attribute >> > 'get___doc__' >> > srm-srv-r4c:~/Distutils-1.0.2 # >> > >> > Can someone help me! >> > >> > -- >> > Regards, >> > Santosh M >> > >> > >> > _______________________________________________ >> > python-win32 mailing list >> > python-win32 at python.org >> > http://mail.python.org/mailman/listinfo/python-win32 >> > >> > > > > > -- > Regards, > Santosh M > From emin.shopper at gmail.com Mon Jun 1 16:32:23 2009 From: emin.shopper at gmail.com (Emin.shopper Martinian.shopper) Date: Mon, 1 Jun 2009 10:32:23 -0400 Subject: [python-win32] how to use CreateProcessWithLogonW Message-ID: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> Dear Experts, Can someone provide an example of how to use CreateProcessWithLogonW? I am having some issues with the subprocess module and how it interacts with win32security.ImpersonateLoggedOnUser. Specifically, I use the latter to change users but the new user does not seem to be properly inherited when I spawn further subprocesses. I am doing something like import win32security, win32con handle = win32security.LogonUser( user,domain,password,win32con.LOGON32_LOGON_INTERACTIVE, win32con.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(handle) Then spawning subprocesses but the subprocesses cannot read the same UNC paths that that the parent could. I believe the problem is because the subprocess module calls CreateProcess but CreateProcess does not inherit what ImpersonateLoggedOnUser does. I believe using CreateProcessWithLogonW may solve the problem but am willing to try other alternatives. Any advice on either spawning subprocesses which inherit parent user properly or changing users in a better way on Windows would be greatly appreciated. Thanks, -Emin From timr at probo.com Mon Jun 1 19:32:56 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 01 Jun 2009 10:32:56 -0700 Subject: [python-win32] how to use CreateProcessWithLogonW In-Reply-To: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> References: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> Message-ID: <4A2410C8.6030801@probo.com> Emin.shopper Martinian.shopper wrote: > Dear Experts, > > Can someone provide an example of how to use CreateProcessWithLogonW? > It's really just a combination of LogonUser and CreateProcess. It uses the first four parameters you passed to LogonUser, plus the parameters you would have passed to CreateProcess. You can look at the source code to subprocess to see how they call CreateProcess. In fact, perhaps you could use that as a base, passing in your login credentials as an additional parameter. Processes created by CreateProcessAsUser don't have access to the desktop, by default. Do you need UI? If so, you'll need to read http://msdn.microsoft.com/en-us/library/aa379308.aspx > Any advice on either spawning subprocesses which inherit parent user > properly or changing users in a better way on Windows would be greatly > appreciated. > Unfortunately, this is a maze of twisty passages, all alike. It is a complicated and not well known part of the Windows API, and you will end up doing a lot of very frustrating experimentation. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gerdusvanzyl at gmail.com Tue Jun 2 15:13:54 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Tue, 2 Jun 2009 15:13:54 +0200 Subject: [python-win32] Problem in install Distutils/python-sybase-0.39 In-Reply-To: <427239420906020535s7efc5f12t2779deecdf4ff831@mail.gmail.com> References: <427239420906010243o234b478dye7221bde2207e6f0@mail.gmail.com> <91882ea90906010258y535c019ei707ea9b08549039b@mail.gmail.com> <427239420906010413n4fd36b2cw6e0d7df3311f343@mail.gmail.com> <91882ea90906010441t4d4bee84nae584fd2a909e481@mail.gmail.com> <427239420906020535s7efc5f12t2779deecdf4ff831@mail.gmail.com> Message-ID: <91882ea90906020613q536d7e99l8eaef3273f38a379@mail.gmail.com> Well that's a problem with the sybase module itself. So try asking on the relevant mailing list or forum/ stackoverflow . Also just noticed you are on linux while this is a python on windows list, so it might not be the most helpful. Just off the top of my head try putting the sybase headers in an include folder see if it helps. Further I can't help since I don't use sybase. ~Gerdus On Tue, Jun 2, 2009 at 2:35 PM, Santosh Mohan wrote: > Hi Gerdus, > > I am facing problem while installing python-sybase module. > There was distutils dependency, i resolved it. > Now its another problem. > santosh-r4c:~/python-sybase-0.39/python-sybase-0.39 # python setup.py > install > Directory /root/python-sybase-0.39/python-sybase-0.39/include does not exist > - cannot build. > > CAn you help me! > > Thanks, > Santosh > > On Mon, Jun 1, 2009 at 5:11 PM, Gerdus van Zyl > wrote: >> >> Ok try installing the python-devel package. >> >> On Mon, Jun 1, 2009 at 1:13 PM, Santosh Mohan >> wrote: >> > Python is the same of SLES10 distro >> > >> > santosh-r4c:~ # python -V >> > Python 2.4.2 >> > >> > >> > On Mon, Jun 1, 2009 at 3:28 PM, Gerdus van Zyl >> > wrote: >> >> >> >> what python version are you running? and from where did you get >> >> python? distutils should be part of your python since it's part of the >> >> standard library. >> >> >> >> On Mon, Jun 1, 2009 at 11:43 AM, Santosh Mohan >> >> wrote: >> >> > Hi, >> >> > >> >> > I am facing problem in installing python-sybase-0.39 and Distutils. >> >> > >> >> > python-sybase-0.39 requires Distutils. >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------- >> >> > santosh-r4c:~/python-sybase-0.38 # ls >> >> > .cvsignore ?LICENCE ? Sybase.py ?blk.c ?conn.c ?databuf.c ?datetime.c >> >> > ?examples ? iodesc.c ?money.c ?numeric.c ?sybasect.c >> >> > ChangeLog ? PKG-INFO ?TODO ? ? ? cmd.c ?ctx.c ? datafmt.c ?doc >> >> > freetds.h ?locale.c ?msgs.c ? setup.py ? sybasect.h >> >> > >> >> > santosh-r4c:~/python-sybase-0.38 # python setup.py install >> >> > Traceback (most recent call last): >> >> > ?File "setup.py", line 12, in ? >> >> > ? ?import distutils >> >> > ImportError: No module named distutils >> >> > >> >> > >> >> > santosh-r4c:~/Distutils-1.0.2 # ls >> >> > CHANGES.txt ?MANIFEST.in ?PKG-INFO ?README.txt ?TODO ?USAGE.txt >> >> > ?distutils >> >> > ?doc ?examples ?misc ?setup.cfg ?setup.py >> >> > santosh-r4c:~/Distutils-1.0.2 # python setup.py build >> >> > Traceback (most recent call last): >> >> > ?File "setup.py", line 30, in ? >> >> > ? ?packages = ['distutils', 'distutils.command'], >> >> > ?File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup >> >> > ? ?_setup_distribution = dist = klass(attrs) >> >> > ?File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in >> >> > __init__ >> >> > ? ?setattr(self, method_name, getattr(self.metadata, method_name)) >> >> > AttributeError: DistributionMetadata instance has no attribute >> >> > 'get___doc__' >> >> > >> >> > santosh-r4c:~/Distutils-1.0.2 # python setup.py install >> >> > Traceback (most recent call last): >> >> > ? File "setup.py", line 30, in ? >> >> > ??? packages = ['distutils', 'distutils.command'], >> >> > ? File "/root/Distutils-1.0.2/distutils/core.py", line 101, in setup >> >> > ??? _setup_distribution = dist = klass(attrs) >> >> > ? File "/root/Distutils-1.0.2/distutils/dist.py", line 130, in >> >> > __init__ >> >> > ??? setattr(self, method_name, getattr(self.metadata, method_name)) >> >> > AttributeError: DistributionMetadata instance has no attribute >> >> > 'get___doc__' >> >> > srm-srv-r4c:~/Distutils-1.0.2 # >> >> > >> >> > Can someone help me! >> >> > >> >> > -- >> >> > Regards, >> >> > Santosh M >> >> > >> >> > >> >> > _______________________________________________ >> >> > python-win32 mailing list >> >> > python-win32 at python.org >> >> > http://mail.python.org/mailman/listinfo/python-win32 >> >> > >> >> > >> > >> > >> > >> > -- >> > Regards, >> > Santosh M >> > > > > > -- > Regards, > Santosh M > From emin.shopper at gmail.com Tue Jun 2 21:02:35 2009 From: emin.shopper at gmail.com (Emin.shopper Martinian.shopper) Date: Tue, 2 Jun 2009 15:02:35 -0400 Subject: [python-win32] how to use CreateProcessWithLogonW In-Reply-To: <4A2410C8.6030801@probo.com> References: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> <4A2410C8.6030801@probo.com> Message-ID: <32e43bb70906021202i2bd45265q641f8b8f1dfbfd07@mail.gmail.com> On Mon, Jun 1, 2009 at 1:32 PM, Tim Roberts wrote: > Emin.shopper Martinian.shopper wrote: >> Dear Experts, >> >> Can someone provide an example of how to use CreateProcessWithLogonW? >> > > It's really just a combination of LogonUser and CreateProcess. Right, the problem is that I don't see it in win32process. Where do I get CreateProcessWithLogonW? > Processes created by CreateProcessAsUser don't have access to the > desktop, by default. Do you need UI? If so, you'll need to read > http://msdn.microsoft.com/en-us/library/aa379308.aspx Thanks for the warning. It's *amazing* how complicated windows can make such a simple concept. I guess its useful to have all that complexity for something. For the time being I've found a work around to avoid requiring being able to create a process as a different user or change user in an intelligent way. If I ever have time to figure out how to do this right, I'll post back to the list so others do not have to share my pain. Thanks, -Emin From timr at probo.com Tue Jun 2 23:00:08 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Jun 2009 14:00:08 -0700 Subject: [python-win32] how to use CreateProcessWithLogonW In-Reply-To: <32e43bb70906021202i2bd45265q641f8b8f1dfbfd07@mail.gmail.com> References: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> <4A2410C8.6030801@probo.com> <32e43bb70906021202i2bd45265q641f8b8f1dfbfd07@mail.gmail.com> Message-ID: <4A2592D8.4060804@probo.com> Emin.shopper Martinian.shopper wrote: > On Mon, Jun 1, 2009 at 1:32 PM, Tim Roberts wrote: > >> Emin.shopper Martinian.shopper wrote: >> >>> Dear Experts, >>> >>> Can someone provide an example of how to use CreateProcessWithLogonW? >>> >> It's really just a combination of LogonUser and CreateProcess. >> > > Right, the problem is that I don't see it in win32process. Where do I > get CreateProcessWithLogonW? > Well, there's always ctypes... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mvilas at gmail.com Tue Jun 2 23:38:49 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Tue, 2 Jun 2009 18:38:49 -0300 Subject: [python-win32] how to use CreateProcessWithLogonW In-Reply-To: <4A2592D8.4060804@probo.com> References: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> <4A2410C8.6030801@probo.com> <32e43bb70906021202i2bd45265q641f8b8f1dfbfd07@mail.gmail.com> <4A2592D8.4060804@probo.com> Message-ID: <3fbf862f0906021438u224c6d69u1cd1b72fe81279f5@mail.gmail.com> How about this? import ctypes NULL = 0 TRUE = 1 FALSE = 0 INVALID_HANDLE_VALUE = -1 WORD = ctypes.c_ushort DWORD = ctypes.c_uint LPSTR = ctypes.c_char_p LPBYTE = LPSTR HANDLE = DWORD # typedef struct _PROCESS_INFORMATION { # HANDLE hProcess; # HANDLE hThread; # DWORD dwProcessId; # DWORD dwThreadId; # } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; class PROCESS_INFORMATION(Structure): _pack_ = 1 _fields_ = [ ('hProcess', HANDLE), ('hThread', HANDLE), ('dwProcessId', DWORD), ('dwThreadId', DWORD), ] # typedef struct _STARTUPINFO { # DWORD cb; # LPSTR lpReserved; # LPSTR lpDesktop; # LPSTR lpTitle; # DWORD dwX; # DWORD dwY; # DWORD dwXSize; # DWORD dwYSize; # DWORD dwXCountChars; # DWORD dwYCountChars; # DWORD dwFillAttribute; # DWORD dwFlags; # WORD wShowWindow; # WORD cbReserved2; # LPBYTE lpReserved2; # HANDLE hStdInput; # HANDLE hStdOutput; # HANDLE hStdError; # } STARTUPINFO, *LPSTARTUPINFO; class STARTUPINFO(Structure): _pack_ = 1 _fields_ = [ ('cb', DWORD), ('lpReserved', DWORD), # LPSTR ('lpDesktop', LPSTR), ('lpTitle', LPSTR), ('dwX', DWORD), ('dwY', DWORD), ('dwXSize', DWORD), ('dwYSize', DWORD), ('dwXCountChars', DWORD), ('dwYCountChars', DWORD), ('dwFillAttribute', DWORD), ('dwFlags', DWORD), ('wShowWindow', WORD), ('cbReserved2', WORD), ('lpReserved2', DWORD), # LPBYTE ('hStdInput', DWORD), ('hStdOutput', DWORD), ('hStdError', DWORD), ] # BOOL WINAPI CreateProcessWithLogonW( # __in LPCWSTR lpUsername, # __in_opt LPCWSTR lpDomain, # __in LPCWSTR lpPassword, # __in DWORD dwLogonFlags, # __in_opt LPCWSTR lpApplicationName, # __inout_opt LPWSTR lpCommandLine, # __in DWORD dwCreationFlags, # __in_opt LPVOID lpEnvironment, # __in_opt LPCWSTR lpCurrentDirectory, # __in LPSTARTUPINFOW lpStartupInfo, # __out LPPROCESS_INFORMATION lpProcessInfo # ); def CreateProcessWithLogonW(lpUsername = None, lpDomain = None, lpPassword = None, dwLogonFlags = 0, lpApplicationName = None, lpCommandLine = None, dwCreationFlags = 0, lpEnvironment = None, lpCurrentDirectory = None, lpStartupInfo = None): if not lpUsername: lpUsername = NULL else: lpUsername = ctypes.c_wchar_p(lpUsername) if not lpDomain: lpDomain = NULL else: lpDomain = ctypes.c_wchar_p(lpDomain) if not lpPassword: lpPassword = NULL else: lpPassword = ctypes.c_wchar_p(lpPassword) if not lpApplicationName: lpApplicationName = NULL else: lpApplicationName = ctypes.c_wchar_p(lpApplicationName) if not lpCommandLine: lpCommandLine = NULL else: lpCommandLine = ctypes.create_unicode_buffer(lpCommandLine) if not lpEnvironment: lpEnvironment = NULL else: lpEnvironment = ctypes.c_wchar_p(lpEnvironment) if not lpCurrentDirectory: lpCurrentDirectory = NULL else: lpCurrentDirectory = ctypes.c_wchar_p(lpCurrentDirectory) if not lpStartupInfo: lpStartupInfo = STARTUPINFO() lpStartupInfo.cb = sizeof(STARTUPINFO) lpStartupInfo.lpReserved = 0 lpStartupInfo.lpDesktop = 0 lpStartupInfo.lpTitle = 0 lpStartupInfo.dwFlags = 0 lpStartupInfo.cbReserved2 = 0 lpStartupInfo.lpReserved2 = 0 lpProcessInformation = PROCESS_INFORMATION() lpProcessInformation.hProcess = INVALID_HANDLE_VALUE lpProcessInformation.hThread = INVALID_HANDLE_VALUE lpProcessInformation.dwProcessId = 0 lpProcessInformation.dwThreadId = 0 success = ctypes.windll.advapi32.CreateProcessWithLogonW(lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, ctypes.byref(lpCommandLine), dwCreationFlags, lpEnvironment, lpCurrentDirectory, ctypes.byref(lpStartupInfo), ctypes.byref(lpProcessInformation)) if success == FALSE: raise ctypes.WinError() return lpProcessInformation On Tue, Jun 2, 2009 at 6:00 PM, Tim Roberts wrote: > Emin.shopper Martinian.shopper wrote: >> On Mon, Jun 1, 2009 at 1:32 PM, Tim Roberts wrote: >> >>> Emin.shopper Martinian.shopper wrote: >>> >>>> Dear Experts, >>>> >>>> Can someone provide an example of how to use CreateProcessWithLogonW? >>>> >>> It's really just a combination of LogonUser and CreateProcess. >>> >> >> Right, the problem is that I don't see it in win32process. Where do I >> get CreateProcessWithLogonW? >> > > Well, there's always ctypes... > > -- > 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 > -- HONEY: I want to? put some powder on my nose. GEORGE: Martha, won?t you show her where we keep the euphemism? -------------- next part -------------- An HTML attachment was scrubbed... URL: From emin.shopper at gmail.com Wed Jun 3 17:35:38 2009 From: emin.shopper at gmail.com (Emin.shopper Martinian.shopper) Date: Wed, 3 Jun 2009 11:35:38 -0400 Subject: [python-win32] how to use CreateProcessWithLogonW In-Reply-To: <3fbf862f0906021438u224c6d69u1cd1b72fe81279f5@mail.gmail.com> References: <32e43bb70906010732u3773d711t81dd02cbc9c4d067@mail.gmail.com> <4A2410C8.6030801@probo.com> <32e43bb70906021202i2bd45265q641f8b8f1dfbfd07@mail.gmail.com> <4A2592D8.4060804@probo.com> <3fbf862f0906021438u224c6d69u1cd1b72fe81279f5@mail.gmail.com> Message-ID: <32e43bb70906030835g2efb24eaw3373661e6e401688@mail.gmail.com> Thanks! That is awesome! I just had to search and replace Structure with ctypes.Structure and sizeof with ctypes.sizeof, save as logonw.py and then was able to successfully test via x = logonw.CreateProcessWithLogonW(user,domain,password,0,'C:\\Python25\python.exe','C:\\Python25\python.exe -i') Thanks again for the help. -Emin On Tue, Jun 2, 2009 at 5:38 PM, Mario Alejandro Vilas Jerez wrote: > How about this? > > import ctypes > > NULL? = 0 > TRUE? = 1 > FALSE = 0 > > INVALID_HANDLE_VALUE = -1 > > WORD?? = ctypes.c_ushort > DWORD? = ctypes.c_uint > LPSTR? = ctypes.c_char_p > LPBYTE = LPSTR > HANDLE = DWORD > > # typedef struct _PROCESS_INFORMATION { > # ? ? HANDLE hProcess; > # ? ? HANDLE hThread; > # ? ? DWORD dwProcessId; > # ? ? DWORD dwThreadId; > # } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; > class PROCESS_INFORMATION(Structure): > ? ?_pack_?? = 1 > ? ?_fields_ = [ > ? ? ? ?('hProcess', ? ?HANDLE), > ? ? ? ?('hThread', ? ? HANDLE), > ? ? ? ?('dwProcessId', DWORD), > ? ? ? ?('dwThreadId', ?DWORD), > ? ?] > > # typedef struct _STARTUPINFO { > # ? ? DWORD ? cb; > # ? ? LPSTR ? lpReserved; > # ? ? LPSTR ? lpDesktop; > # ? ? LPSTR ? lpTitle; > # ? ? DWORD ? dwX; > # ? ? DWORD ? dwY; > # ? ? DWORD ? dwXSize; > # ? ? DWORD ? dwYSize; > # ? ? DWORD ? dwXCountChars; > # ? ? DWORD ? dwYCountChars; > # ? ? DWORD ? dwFillAttribute; > # ? ? DWORD ? dwFlags; > # ? ? WORD ? ?wShowWindow; > # ? ? WORD ? ?cbReserved2; > # ? ? LPBYTE ?lpReserved2; > # ? ? HANDLE ?hStdInput; > # ? ? HANDLE ?hStdOutput; > # ? ? HANDLE ?hStdError; > # } STARTUPINFO, *LPSTARTUPINFO; > class STARTUPINFO(Structure): > ? ?_pack_ ? = 1 > ? ?_fields_ = [ > ? ? ? ?('cb', ? ? ? ? ? ? ?DWORD), > ? ? ? ?('lpReserved', ? ? ?DWORD), ? ? # LPSTR > ? ? ? ?('lpDesktop', ? ? ? LPSTR), > ? ? ? ?('lpTitle', ? ? ? ? LPSTR), > ? ? ? ?('dwX', ? ? ? ? ? ? DWORD), > ? ? ? ?('dwY', ? ? ? ? ? ? DWORD), > ? ? ? ?('dwXSize', ? ? ? ? DWORD), > ? ? ? ?('dwYSize', ? ? ? ? DWORD), > ? ? ? ?('dwXCountChars', ? DWORD), > ? ? ? ?('dwYCountChars', ? DWORD), > ? ? ? ?('dwFillAttribute', DWORD), > ? ? ? ?('dwFlags', ? ? ? ? DWORD), > ? ? ? ?('wShowWindow', ? ? WORD), > ? ? ? ?('cbReserved2', ? ? WORD), > ? ? ? ?('lpReserved2', ? ? DWORD), ? ? # LPBYTE > ? ? ? ?('hStdInput', ? ? ? DWORD), > ? ? ? ?('hStdOutput', ? ? ?DWORD), > ? ? ? ?('hStdError', ? ? ? DWORD), > ? ?] > > # BOOL WINAPI CreateProcessWithLogonW( > # ? __in ? ? ? ? LPCWSTR lpUsername, > # ? __in_opt ? ? LPCWSTR lpDomain, > # ? __in ? ? ? ? LPCWSTR lpPassword, > # ? __in ? ? ? ? DWORD dwLogonFlags, > # ? __in_opt ? ? LPCWSTR lpApplicationName, > # ? __inout_opt ?LPWSTR lpCommandLine, > # ? __in ? ? ? ? DWORD dwCreationFlags, > # ? __in_opt ? ? LPVOID lpEnvironment, > # ? __in_opt ? ? LPCWSTR lpCurrentDirectory, > # ? __in ? ? ? ? LPSTARTUPINFOW lpStartupInfo, > # ? __out ? ? ? ?LPPROCESS_INFORMATION lpProcessInfo > # ); > def CreateProcessWithLogonW(lpUsername = None, lpDomain = None, lpPassword = > None, dwLogonFlags = 0, lpApplicationName = None, lpCommandLine = None, > dwCreationFlags = 0, lpEnvironment = None, lpCurrentDirectory = None, > lpStartupInfo = None): > ? ?if not lpUsername: > ? ? ? ?lpUsername ? ? ? ? ?= NULL > ? ?else: > ? ? ? ?lpUsername ? ? ? ? ?= ctypes.c_wchar_p(lpUsername) > ? ?if not lpDomain: > ? ? ? ?lpDomain ? ? ? ? ? ?= NULL > ? ?else: > ? ? ? ?lpDomain ? ? ? ? ? ?= ctypes.c_wchar_p(lpDomain) > ? ?if not lpPassword: > ? ? ? ?lpPassword ? ? ? ? ?= NULL > ? ?else: > ? ? ? ?lpPassword ? ? ? ? ?= ctypes.c_wchar_p(lpPassword) > ? ?if not lpApplicationName: > ? ? ? ?lpApplicationName ? = NULL > ? ?else: > ? ? ? ?lpApplicationName ? = ctypes.c_wchar_p(lpApplicationName) > ? ?if not lpCommandLine: > ? ? ? ?lpCommandLine ? ? ? = NULL > ? ?else: > ? ? ? ?lpCommandLine ? ? ? = ctypes.create_unicode_buffer(lpCommandLine) > ? ?if not lpEnvironment: > ? ? ? ?lpEnvironment ? ? ? = NULL > ? ?else: > ? ? ? ?lpEnvironment ? ? ? = ctypes.c_wchar_p(lpEnvironment) > ? ?if not lpCurrentDirectory: > ? ? ? ?lpCurrentDirectory ?= NULL > ? ?else: > ? ? ? ?lpCurrentDirectory ?= ctypes.c_wchar_p(lpCurrentDirectory) > ? ?if not lpStartupInfo: > ? ? ? ?lpStartupInfo ? ? ? ? ? ? ?= STARTUPINFO() > ? ? ? ?lpStartupInfo.cb ? ? ? ? ? = sizeof(STARTUPINFO) > ? ? ? ?lpStartupInfo.lpReserved ? = 0 > ? ? ? ?lpStartupInfo.lpDesktop ? ?= 0 > ? ? ? ?lpStartupInfo.lpTitle ? ? ?= 0 > ? ? ? ?lpStartupInfo.dwFlags ? ? ?= 0 > ? ? ? ?lpStartupInfo.cbReserved2 ?= 0 > ? ? ? ?lpStartupInfo.lpReserved2 ?= 0 > ? ?lpProcessInformation ? ? ? ? ? ? ?= PROCESS_INFORMATION() > ? ?lpProcessInformation.hProcess ? ? = INVALID_HANDLE_VALUE > ? ?lpProcessInformation.hThread ? ? ?= INVALID_HANDLE_VALUE > ? ?lpProcessInformation.dwProcessId ?= 0 > ? ?lpProcessInformation.dwThreadId ? = 0 > ? ?success = ctypes.windll.advapi32.CreateProcessWithLogonW(lpUsername, > lpDomain, lpPassword, dwLogonFlags, lpApplicationName, > ctypes.byref(lpCommandLine), dwCreationFlags, lpEnvironment, > lpCurrentDirectory, ctypes.byref(lpStartupInfo), > ctypes.byref(lpProcessInformation)) > ? ?if success == FALSE: > ? ? ? ?raise ctypes.WinError() > ? ?return lpProcessInformation > > On Tue, Jun 2, 2009 at 6:00 PM, Tim Roberts wrote: >> Emin.shopper Martinian.shopper wrote: >>> On Mon, Jun 1, 2009 at 1:32 PM, Tim Roberts wrote: >>> >>>> Emin.shopper Martinian.shopper wrote: >>>> >>>>> Dear Experts, >>>>> >>>>> Can someone provide an example of how to use CreateProcessWithLogonW? >>>>> >>>> It's really just a combination of LogonUser and CreateProcess. >>>> >>> >>> Right, the problem is that I don't see it in win32process. Where do I >>> get CreateProcessWithLogonW? >>> >> >> Well, there's always ctypes... >> >> -- >> 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 >> > > > > -- > HONEY: I want to? put some powder on my nose. > GEORGE: Martha, won?t you show her where we keep the euphemism? > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From skippy.hammond at gmail.com Thu Jun 4 00:48:13 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 04 Jun 2009 08:48:13 +1000 Subject: [python-win32] CreateURLMonikerEx and Win2000 In-Reply-To: <4A1678C4.3090105@laposte.net> References: <4A1678C4.3090105@laposte.net> Message-ID: <4A26FDAD.5010201@gmail.com> le dahut wrote: > Hello, > > On Windows 2000 SP4, since pywin32-213 I get an error : > "CreateURLMonikerEx could not be located" > on a program that ran fine with pywin32-212. > > What's happening ? It is a bug in build 213 which has been fixed in CVS. Cheers, Mark From fernando.romagnoli at embraer.com.br Wed Jun 3 14:40:11 2009 From: fernando.romagnoli at embraer.com.br (fernando.romagnoli at embraer.com.br) Date: Wed, 3 Jun 2009 09:40:11 -0300 Subject: [python-win32] Phyton editor Message-ID: Dears, I am looking for a friendly Phyton editor, like the VBA editor inside the Excel. I prefer to work in an enviroment that points to me the errors, suggests to me the complete command syntax, and help me when we are debugging the code. Sugestions? Regards Fernando Romagnoli R & D Structures / Materials EMBRAER - S?o Jos? dos Campos Phone: +55 12 3927 66 96 Fax: +55 12 3927 27 23

This message is intended solely for the use of its addressee and may contain privileged or confidential information. If you are not the addressee you should not distribute, copy or file this message. In this case, please notify the sender and destroy its contents immediately.
Esta mensagem ? para uso exclusivo de seu destinat?rio e pode conter informa??es privilegiadas e confidenciais. Se voc? n?o ? o destinat?rio n?o deve distribuir, copiar ou arquivar a mensagem. Neste caso, por favor, notifique o remetente da mesma e destrua imediatamente a mensagem.
-------------- next part -------------- An HTML attachment was scrubbed... URL: From steven.james at gmail.com Thu Jun 4 00:57:51 2009 From: steven.james at gmail.com (Steven James) Date: Wed, 3 Jun 2009 18:57:51 -0400 Subject: [python-win32] Fwd: Phyton editor In-Reply-To: References: Message-ID: I like SPE and Wing. Wing isn't free though. http://pythonide.blogspot.com/ http://www.wingware.com/ Steven James ---------- Forwarded message ---------- From: Date: Wed, Jun 3, 2009 at 8:40 AM Subject: [python-win32] Phyton editor To: python-win32 at python.org Dears, I am looking for a friendly Phyton editor, like the VBA editor inside the Excel. I prefer to work in an enviroment that points to me the errors, suggests to me the complete command syntax, and help me when we are debugging the code. Sugestions? Regards Fernando Romagnoli R & D Structures / Materials EMBRAER - S?o Jos? dos Campos Phone: +55 12 3927 66 96 Fax: +55 12 3927 27 23 * ------------------------------ This message is intended solely for the use of its addressee and may contain privileged or confidential information. If you are not the addressee you should not distribute, copy or file this message. In this case, please notify the sender and destroy its contents immediately. Esta mensagem ? para uso exclusivo de seu destinat?rio e pode conter informa??es privilegiadas e confidenciais. Se voc? n?o ? o destinat?rio n?o deve distribuir, copiar ou arquivar a mensagem. Neste caso, por favor, notifique o remetente da mesma e destrua imediatamente a mensagem.* _______________________________________________ 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 randy at rcs-comp.com Thu Jun 4 03:27:17 2009 From: randy at rcs-comp.com (Randy Syring) Date: Wed, 03 Jun 2009 21:27:17 -0400 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> References: <49F4278A.7010402@canterbury.ac.nz> <2d07a6f90904261510yd821f8aifc392e55674faae2@mail.gmail.com> <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> Message-ID: <4A2722F5.7020705@rcs-comp.com> I am wondering if the problems with build 213 have ever been resolved on Windows. Or was I mistaken that build 213 was the problem? Thanks. -------------------------------------- Randy Syring RCS Computers & Web Solutions 502-644-4776 http://www.rcs-comp.com "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 Randy Syring wrote: > Greg, > > I have done some testing and reverting to pywin build 212 allows the > demo to run without the previously seen exception. > > -- > -------------------------------------- > Randy Syring > RCS Computers & Web Solutions > 502-644-4776 > http://www.rcs-comp.com > > "Whether, then, you eat or drink or whatever you do, do all to the > glory of God." 1 Cor 10:31 > > > On Sun, Apr 26, 2009 at 6:10 PM, Randy Syring > wrote: > > Greg, > > I have tested 12-scroll.py on both Vista Professional and Windows > XP Pro SP3 both with Python 2.5.4 and pywin build 213. Said test > fails with the "the object has been destroyed" exception. > > > -- > -------------------------------------- > Randy Syring > RCS Computers & Web Solutions > 502-644-4776 > http://www.rcs-comp.com > > "Whether, then, you eat or drink or whatever you do, do all to the > glory of God." 1 Cor 10:31 > > > On Sun, Apr 26, 2009 at 5:21 AM, Greg Ewing > > > wrote: > > PyGUI 2.0.5 is available: > > http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > More bug fixes for various platforms. > > Still no idea what's causing the "object has been destroyed" > error on Windows XP, though. Does this happen for everyone? > Is there anyone who *has* got 12-scroll.py working for them > on XP? > > > What is PyGUI? > -------------- > > PyGUI is a cross-platform GUI toolkit designed to be lightweight > and have a highly Pythonic API. > > -- > Gregory Ewing > greg.ewing at canterbury.ac.nz > http://www.cosc.canterbury.ac.nz/greg.ewing/ > _______________________________________________ > 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 mvilas at gmail.com Thu Jun 4 03:54:22 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Wed, 3 Jun 2009 22:54:22 -0300 Subject: [python-win32] Fwd: Phyton editor In-Reply-To: References: Message-ID: <3fbf862f0906031854q4790a250v312c3253fe17d09a@mail.gmail.com> I like Python Scripter, it's free but it's got a small bug or two. The 1.7 version is better than the newer 1.9. http://www.mmm-experts.com/Downloads.aspx?ProductId=4 On Wed, Jun 3, 2009 at 7:57 PM, Steven James wrote: > I like SPE and Wing. Wing isn't free though. > > http://pythonide.blogspot.com/ > http://www.wingware.com/ > > Steven James > > ---------- Forwarded message ---------- > From: > Date: Wed, Jun 3, 2009 at 8:40 AM > Subject: [python-win32] Phyton editor > To: python-win32 at python.org > > > Dears, > > I am looking for a friendly Phyton editor, like the VBA editor inside the > Excel. > > I prefer to work in an enviroment that points to me the errors, suggests to > me the complete command syntax, and help me when we are debugging the code. > > Sugestions? > > Regards > > Fernando Romagnoli > R & D Structures / Materials > EMBRAER - S?o Jos? dos Campos > Phone: +55 12 3927 66 96 Fax: +55 12 3927 27 23 > * > ------------------------------ > This message is intended solely for the use of its addressee and may > contain privileged or confidential information. If you are not the addressee > you should not distribute, copy or file this message. In this case, please > notify the sender and destroy its contents immediately. > Esta mensagem ? para uso exclusivo de seu destinat?rio e pode conter > informa??es privilegiadas e confidenciais. Se voc? n?o ? o destinat?rio n?o > deve distribuir, copiar ou arquivar a mensagem. Neste caso, por favor, > notifique o remetente da mesma e destrua imediatamente a mensagem.* > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- HONEY: I want to? put some powder on my nose. GEORGE: Martha, won?t you show her where we keep the euphemism? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cappy2112 at gmail.com Thu Jun 4 06:01:08 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Wed, 3 Jun 2009 21:01:08 -0700 Subject: [python-win32] Fwd: Phyton editor Message-ID: <8249c4ac0906032101n77f6eb1bpb4728a98d136bb0a@mail.gmail.com> Message: 4 Date: Wed, 3 Jun 2009 18:57:51 -0400 From: Steven James To: python-win32 at python.org Subject: [python-win32] Fwd: Phyton editor Message-ID: Content-Type: text/plain; charset="iso-8859-1" >>I like SPE and Wing. Wing isn't free though. >>http://pythonide.blogspot.com/ >>http://www.wingware.com/ There is a free basic version of Wing, but why bother? Buy the Pro version, get a great debugger/IDE. It's worth every penny. You don't use Wing for its editing abilities, you use it because it has great debugging features. From santosh.mce at gmail.com Thu Jun 4 07:28:42 2009 From: santosh.mce at gmail.com (Santosh Mohan) Date: Thu, 4 Jun 2009 10:58:42 +0530 Subject: [python-win32] Phyton editor Message-ID: <427239420906032228l207910bax49e4f5e638d9d7c0@mail.gmail.com> Try PythonWin (http://starship.python.net/crew/mhammond/win32/Downloads.html ) -- Regards, Santosh M -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Thu Jun 4 04:24:51 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Thu, 04 Jun 2009 14:24:51 +1200 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: <4A2722F5.7020705@rcs-comp.com> References: <49F4278A.7010402@canterbury.ac.nz> <2d07a6f90904261510yd821f8aifc392e55674faae2@mail.gmail.com> <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> <4A2722F5.7020705@rcs-comp.com> Message-ID: <4A273073.4090500@canterbury.ac.nz> Randy Syring wrote: > I am wondering if the problems with build 213 have ever been resolved on > Windows. Or was I mistaken that build 213 was the problem? I don't know. I haven't heard any more about it from anyone since then. Has anyone else out there that's having this problem successfully cured it by reverting to 212? If so, I could look into what's changed between 212 and 213 to see if it gives any clue to what's going on. -- Greg From gerdusvanzyl at gmail.com Thu Jun 4 10:45:00 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Thu, 4 Jun 2009 10:45:00 +0200 Subject: [python-win32] Phyton editor In-Reply-To: <427239420906032228l207910bax49e4f5e638d9d7c0@mail.gmail.com> References: <427239420906032228l207910bax49e4f5e638d9d7c0@mail.gmail.com> Message-ID: <91882ea90906040145w35016ac4jd60614115e668a01@mail.gmail.com> My favourites are in order of preference: nbPython - http://wiki.netbeans.org/Python (get a latest development build) pydev - http://pydev.sourceforge.net/ ~Gerdus From stef.mientki at gmail.com Thu Jun 4 23:47:34 2009 From: stef.mientki at gmail.com (Stef Mientki) Date: Thu, 04 Jun 2009 23:47:34 +0200 Subject: [python-win32] Fwd: Phyton editor In-Reply-To: <3fbf862f0906031854q4790a250v312c3253fe17d09a@mail.gmail.com> References: <3fbf862f0906031854q4790a250v312c3253fe17d09a@mail.gmail.com> Message-ID: <4A2840F6.5090602@gmail.com> Mario Alejandro Vilas Jerez wrote: > I like Python Scripter, it's free but it's got a small bug or two. The > 1.7 version is better than the newer 1.9. > > http://www.mmm-experts.com/Downloads.aspx?ProductId=4 > > On Wed, Jun 3, 2009 at 7:57 PM, Steven James > wrote: > > I like SPE and Wing. Wing isn't free though. > > http://pythonide.blogspot.com/ > http://www.wingware.com/ > > Steven James > > ---------- Forwarded message ---------- > From: > > Date: Wed, Jun 3, 2009 at 8:40 AM > Subject: [python-win32] Phyton editor > To: python-win32 at python.org > > > Dears, > > I am looking for a friendly Phyton editor, like the VBA editor > inside the Excel. > > I prefer to work in an enviroment that points to me the errors, > suggests to me the complete command syntax, and help me when we > are debugging the code. > PyScripter is build in and derived from Delphi, the better / smarter brother of Visual Basic ;-) cheers, Stef From popisjo at yahoo.com Fri Jun 5 22:25:43 2009 From: popisjo at yahoo.com (pop davis) Date: Fri, 5 Jun 2009 13:25:43 -0700 (PDT) Subject: [python-win32] Question? Message-ID: <833600.14194.qm@web30906.mail.mud.yahoo.com> Hello. I have a Question About python2.2 pywin 32.? What is python all about. I have never used it. But is is no my computer,And taking up a lot of my disk space,?Does it have something to do??with my computer. Will my computer operate without it. If so. Then I want to delete it off my computer. Thank you kindly. J. Davis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Sat Jun 6 01:03:20 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 05 Jun 2009 16:03:20 -0700 Subject: [python-win32] Question? In-Reply-To: <833600.14194.qm@web30906.mail.mud.yahoo.com> References: <833600.14194.qm@web30906.mail.mud.yahoo.com> Message-ID: <4A29A438.4010604@probo.com> pop davis wrote: > Hello. I have a Question About python2.2 pywin 32. What is python all > about. I have never used it. But is is no my computer,And taking up a > lot of my disk space, Does it have something to do with my computer. > Will my computer operate without it. If so. Then I want to delete it > off my computer. Thank you kindly. J. Davis. > Python is a computer language, used for programming your computer. It is possible that some other package that you installed is written in Python, and the authors chose to install the whole thing. It is not "taking up a lot of [your] disk space". I have quite a number of extra packages installed, and my entire Python directory is only 133 megabytes. At today's disk prices, that's less than 8 cents worth of disk space. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vikas.nv at gmail.com Mon Jun 8 09:55:08 2009 From: vikas.nv at gmail.com (Vikas NV) Date: Mon, 8 Jun 2009 13:25:08 +0530 Subject: [python-win32] Query on - win32 impersonate user Message-ID: <2826dd0906080055v455ecde0u17d2d70d7f0ea287@mail.gmail.com> Hi, I have been trying to use the Impersonate user code that you have in the PyWin32.chm document. The code that I am trying is : import win32security import win32con import win32api class Impersonate: def __init__(self,login,password): self.domain='BLAHBLAH' self.login=login self.password=password def logon(self): self.handel=win32security.LogonUser (self.login,self.domain,self.password,win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(self.handel) def logoff(self): win32security.RevertToSelf() #terminates impersonation self.handel.Close() #guarantees cleanup if __name__ == '__main__': import os import sys sys.stdout.write ('Start process as ') obj = Impersonate('another_user', '01928348') obj.logon() print win32api.GetUserName() os.system('bash sleep.sh') obj.logoff() The sleep.sh this script uses has these commands "touch file1; sleep 300" I am running this on Windows XP and with MKS toolkit installed on it (so i can use 'bash', as in the code). I am currently logged in as Vikas. So when I see the task manager while the python script runs, the sleep.sh is invoked as user 'Vikas' instead as 'another_user'. And also the file that sleep.sh touches 'file1' has owner as 'Vikas' instead of 'another_user' So my query is that why is sleep.sh run as Vikas even though I impersonate as 'another_user' ? Following the question, why is the owner of file1 is 'Vikas' instead of 'another_user' ? -- Vikas N V mob: 9900107434 Visit my BLOG: http://techdiary-viki.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Mon Jun 8 12:36:44 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 08 Jun 2009 11:36:44 +0100 Subject: [python-win32] Query on - win32 impersonate user In-Reply-To: <2826dd0906080055v455ecde0u17d2d70d7f0ea287@mail.gmail.com> References: <2826dd0906080055v455ecde0u17d2d70d7f0ea287@mail.gmail.com> Message-ID: <4A2CE9BC.6070606@timgolden.me.uk> Vikas NV wrote: > Hi, > > I have been trying to use the Impersonate user code that you have in > the PyWin32.chm document. [... snip ...] > obj = Impersonate('another_user', '01928348') > obj.logon() > print win32api.GetUserName() > os.system('bash sleep.sh') > obj.logoff() Unfortunately when you do os.system, Windows uses the original user, not the impersonating user. By good fortune, this issue came up just last week and someone posted a ctypes implementation of CreateProcessWithLogonW: http://mail.python.org/pipermail/python-win32/2009-June/009192.html Hopefully you can take it from there... TJG From mail at timgolden.me.uk Mon Jun 8 15:04:59 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 08 Jun 2009 14:04:59 +0100 Subject: [python-win32] MAPI CopyMessages Message-ID: <4A2D0C7B.4070105@timgolden.me.uk> Has anyone had success using the PyIMAPIFolder CopyMessages method? The spambayes source looks as tho' it's using it happily, so I can't imagine there's any fundamental problem. Only... it doesn't work for me. :( I have a reproducible test case attached which is -- in the way of the extended MAPI code -- a bit wordy. But I believe it is self-contained and could be run by anyone with an Exchange account and a folder called "Docs". The code is also on pastebin: http://pastebin.com/m575adec6 In short, I find my Inbox and my Docs folder and attempt to copy an arbitrary message from the one to the other. The code completes without error, but nothing seems to be happening. There's nothing to suggest that any "commit"-type action is necessary. Just in case, I've tried various combinations of SaveChanges to no avail. I look in the Docs folder on Outlook and nothing's there. All suggestions gratefully received. TJG -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: copy-messages.py URL: From mail at timgolden.me.uk Mon Jun 8 17:11:45 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 08 Jun 2009 16:11:45 +0100 Subject: [python-win32] MAPI CopyMessages In-Reply-To: <4A2D0C7B.4070105@timgolden.me.uk> References: <4A2D0C7B.4070105@timgolden.me.uk> Message-ID: <4A2D2A31.7000706@timgolden.me.uk> Tim Golden wrote: > Has anyone had success using the PyIMAPIFolder CopyMessages method? > The spambayes source looks as tho' it's using it happily, so I can't > imagine there's any fundamental problem. Only... it doesn't work for > me. :( [... snip ...] Don't you hate it when that happens? Of course, you have to open the folder with the MAPI_MODIFY flag, otherwise you can't write to it. That said, it does fail silently; but at least I can move forward now. TJG From vikas.nv at gmail.com Sun Jun 7 15:25:37 2009 From: vikas.nv at gmail.com (Vikas NV) Date: Sun, 7 Jun 2009 18:55:37 +0530 Subject: [python-win32] pywin32 query ... Message-ID: <2826dd0906070625i29ef0bdbh56846d0669a9341c@mail.gmail.com> Hi, I have been trying to use the Impersonate user code that you have in the PyWin32.chm document. The code that I am trying is : import win32security import win32con import win32api class Impersonate: def __init__(self,login,password): self.domain='BLAHBLAH' self.login=login self.password=password def logon(self): self.handel=win32security.LogonUser (self.login,self.domain,self.password,win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(self.handel) def logoff(self): win32security.RevertToSelf() #terminates impersonation self.handel.Close() #guarantees cleanup if __name__ == '__main__': import os import sys sys.stdout.write ('Start process as ') obj = Impersonate('another_user', '01928348') obj.logon() print win32api.GetUserName() os.system('bash sleep.sh') obj.logoff() The sleep.sh this script uses has these commands "touch file1; sleep 300" I am running this on Windows XP and with MKS toolkit installed on it (so i can use 'bash', as in the code). I am currently logged in as Vikas. So when I see the task manager while the python script runs, the sleep.sh is invoked as user 'Vikas' instead as 'another_user'. And also the file that sleep.sh touches 'file1' has owner as 'Vikas' instead of 'another_user' So my query is that why is sleep.sh run as Vikas even though I impersonate as 'another_user' ? Following the question, why is the owner of file1 is 'Vikas' instead of 'another_user' ? -- Vikas N V mob: 9900107434 Visit my BLOG: http://techdiary-viki.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From drobinow at gmail.com Tue Jun 9 15:51:31 2009 From: drobinow at gmail.com (David Robinow) Date: Tue, 9 Jun 2009 09:51:31 -0400 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: <4A273073.4090500@canterbury.ac.nz> References: <49F4278A.7010402@canterbury.ac.nz> <2d07a6f90904261510yd821f8aifc392e55674faae2@mail.gmail.com> <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> <4A2722F5.7020705@rcs-comp.com> <4A273073.4090500@canterbury.ac.nz> Message-ID: <4eb0089f0906090651r40dc2c1ao8bc9791ded3f84b2@mail.gmail.com> On Wed, Jun 3, 2009 at 10:24 PM, Greg Ewing wrote: > Randy Syring wrote: >> >> I am wondering if the problems with build 213 have ever been resolved on >> Windows. ?Or was I mistaken that build 213 was the problem? > > I don't know. I haven't heard any more about it from > anyone since then. > > Has anyone else out there that's having this problem > successfully cured it by reverting to 212? > > If so, I could look into what's changed between 212 > and 213 to see if it gives any clue to what's going > on. > I have. The problem exists using Python 2.5.4 and Python 2.6.2 on Windows XP Professional and Windows Vista Home Premium. No problems with 212. See below for what happens using 213. Reverting to 212 works fine. c:\home\PyGUI-2.0.5\Tests>\python26\python 12-scroll.py Traceback (most recent call last): File "12-scroll.py", line 38, in win = TestWindow() File "12-scroll.py", line 9, in __init__ width = 300, height = 300, scrolling = 'hv') File "c:\home\PyGUI-2.0.5\Tests\TestScrollableViews.py", line 16, in __init__ ScrollableView.__init__(self, **kwds) File "c:\home\PyGUI-2.0.5\GUI\Win32\ScrollableViews.py", ilne 31, in __init__ GScrollableView.__init__(self, _win = win) win32ui.error: The object has been destroyed. c:\home\PyGUI-2.0.5\Tests> From greg.antal at ata-e.com Thu Jun 11 03:24:57 2009 From: greg.antal at ata-e.com (Greg Antal) Date: Wed, 10 Jun 2009 18:24:57 -0700 Subject: [python-win32] VARIANT type not supported error Message-ID: <4A305CE9.90102@ata-e.com> An HTML attachment was scrubbed... URL: From hibikikanzaki at gmail.com Thu Jun 11 22:58:11 2009 From: hibikikanzaki at gmail.com (Hibiki Kanzaki) Date: Thu, 11 Jun 2009 13:58:11 -0700 Subject: [python-win32] win32com gencache InvokeTypes and OUT/ByRef parameters Message-ID: <8c237ea80906111358w67b2353crb66558bcab7752f2@mail.gmail.com> I am using a COM library from Python. The methods have OUT parameters, so I am using the gencache/makepy facility of win32com. When it generates the wrapper files, there are function definitions like this one (this is for accessing Visual SourceSafe COM Automation) # Result is of type IVSSItem # The method VSSItem is actually a property, but must be used as a method to correctly pass the arguments def VSSItem(self, Spec=defaultNamedNotOptArg, Deleted=False): ret = self._oleobj_.InvokeTypes(6, LCID, 2, (9, 0), ((8, 1), (11, 49)),Spec , Deleted, ppIVSSItem) if ret is not None: ret = Dispatch(ret, u'VSSItem', '{2A0DE0E7-2E9F-11D0-9236-00AA00A1EB95}') return ret When VSSItem() is called, it gets an error that ppVSSItem is not defined... and as far as I can tell that is correct, I do not see anything anywhere in the wrapper files where it appears to define any "ppIVSSItem". In this particular case, I can manually edit that file and simply remove that last argument, and then it works fine. That code is in a wrapper for VSSDatabase (IVSSDatabase). When the VSSItem object is created, a new file IVSSItem.py is created which has the same problem-- InvokeTypes is passed arguments which are names of variables which do not seem to exist. I am not sure if I can get away with editing files this way... especially in cases where the method does not simply have one trailing OUT parameter. it would be nice if I did not, especially since I do not get all the wrappers at once-- they are generated only when I try to instantiate another type of COM object (indirectly, by calling methods of the other objects). I am curious what is going on here... it looks like maybe the wrapper is generated by MakeDispatchFuncMethod in win32com/client/build.py, by code which looks like this: retDesc = fdesc[8][:2] argsDesc = tuple([what[:2] for what in fdesc[2]]) # The runtime translation of the return types is expensive, so when we know the # return type of the function, there is no need to check the type at runtime. # To qualify, this function must return a "simple" type, and have no byref args. # Check if we have byrefs or anything in the args which mean we still need a translate. param_flags = [what[1] for what in fdesc[2]] bad_params = [flag for flag in param_flags if flag & (pythoncom.PARAMFLAG_FOUT | pythoncom.PARAMFLAG_FRETVAL)!=0] s = None if len(bad_params)==0 and len(retDesc)==2 and retDesc[1]==0: rd = retDesc[0] if rd in NoTranslateMap: s = '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names)) elif rd in [pythoncom.VT_DISPATCH, pythoncom.VT_UNKNOWN]: s = '%s\tret = self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, repr(argsDesc), _BuildArgList(fdesc, names)) s = s + '%s\tif ret is not None:\n' % (linePrefix,) if rd == pythoncom.VT_UNKNOWN: s = s + "%s\t\t# See if this IUnknown is really an IDispatch\n" % (linePrefix,) s = s + "%s\t\ttry:\n" % (linePrefix,) s = s + "%s\t\t\tret = ret.QueryInterface(pythoncom.IID_IDispatch)\n" % (linePrefix,) s = s + "%s\t\texcept pythoncom.error:\n" % (linePrefix,) s = s + "%s\t\t\treturn ret\n" % (linePrefix,) s = s + '%s\t\tret = Dispatch(ret, %s, %s)\n' % (linePrefix,repr(name), resclsid) s = s + '%s\treturn ret' % (linePrefix) elif rd == pythoncom.VT_BSTR: s = "%s\t# Result is a Unicode object\n" % (linePrefix,) s = s + '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, repr(argsDesc), _BuildArgList(fdesc, names)) # else s remains None This code is opaque for me since I have no familiarity with the code, or what is the correct behavior... By the way this is build213 running with Python 2.6. I have the same problem with build212. From skippy.hammond at gmail.com Fri Jun 12 07:55:15 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 12 Jun 2009 15:55:15 +1000 Subject: [python-win32] win32com gencache InvokeTypes and OUT/ByRef parameters In-Reply-To: <8c237ea80906111358w67b2353crb66558bcab7752f2@mail.gmail.com> References: <8c237ea80906111358w67b2353crb66558bcab7752f2@mail.gmail.com> Message-ID: <4A31EDC3.2090405@gmail.com> On 12/06/2009 6:58 AM, Hibiki Kanzaki wrote: > I am using a COM library from Python. The methods > have OUT parameters, so I am using the gencache/makepy > facility of win32com. When it generates the wrapper > files, there are function definitions like this one > (this is for accessing Visual SourceSafe COM Automation) > > # Result is of type IVSSItem > # The method VSSItem is actually a property, but must be used as a > method to correctly pass the arguments > def VSSItem(self, Spec=defaultNamedNotOptArg, Deleted=False): > ret = self._oleobj_.InvokeTypes(6, LCID, 2, (9, 0), ((8, 1), (11, 49)),Spec > , Deleted, ppIVSSItem) > if ret is not None: > ret = Dispatch(ret, u'VSSItem', '{2A0DE0E7-2E9F-11D0-9236-00AA00A1EB95}') > return ret Thanks for the detailed report and analysis. Sadly I can't reproduce this problem. I even found the IDL for VSSItem at http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.sourcesafe.interop.ivssdatabase.vssitem(VS.80).aspx and added the same IDL to the test suite (which already had something *very* close), but it works fine. In that same module you mentioned, _BuildArgList() is reponsible for that extra name: def _BuildArgList(fdesc, names): "Builds list of args to the underlying Invoke method." # Word has TypeInfo for Insert() method, but says "no args" numArgs = max(fdesc[6], len(fdesc[2])) ... but what should be happening is that 'ppIVSSItem' should not appear in the list of 'names' at all - it is a return value. It should also not appear in 'fdesc[6]' (a list of tuples, one for each arg) and it isn't - the generated code you pasted shows fdesc[6] is '((8, 1), (11, 49))', so correctly has only 2 args. after lots of going around in circles, I suspect that last line above is the problem: if you change that to simply: numArgs = len(fdesc[2]) does the problem go away? I'm not sure that is the correct solution in all cases, but it would be good to know how it works in this case... Cheers, Mark From skippy.hammond at gmail.com Fri Jun 12 09:49:01 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 12 Jun 2009 17:49:01 +1000 Subject: [python-win32] VARIANT type not supported error In-Reply-To: <4A305CE9.90102@ata-e.com> References: <4A305CE9.90102@ata-e.com> Message-ID: <4A32086D.6090507@gmail.com> On 11/06/2009 11:24 AM, Greg Antal wrote: > Greetings, Experts: > > I've run into this error and wonder if any of you can help. > > First I get this message: > [snip]\lib\site-packages\win32com\client\__init__.py:480: > RuntimeWarning: tp_compare didn't return -1 or -2 for exception > elif type(obj)==TupleType: > > Something then raises an exception (NOT a pythoncom.com_error), from > which I extract this traceback, exception type, and value: > [snip] > iRet, nOpen, liOpen = zFem.feAppGetAllModels () > In feAppGetAllModels, "PyFemap.py" line 14661, > , nModelID) > In _ApplyTypes_, "__init__.py" line 449, > user, resultCLSID) > In _get_good_object_, "__init__.py" line 467, > return _get_good_object_(obj, obUserName, resultCLSID) > In _get_good_object_, "__init__.py" line 480, > elif type(obj)==TupleType: > > - The VARIANT type 0x14 is not supported > for SAFEARRAYS I think the "noise" before this error was already fixed, but yeah, there isn't support in pythoncom for 64bit ints - mainly as the SDK header files indicate they aren't value. However, the MIDL compiler accepts them, so I just checked in a fix for this. Unfortunately though, this means you need to wait for the next build, or build it yourself from CVS. Cheers, Mark From greg.antal at ata-e.com Fri Jun 12 17:56:01 2009 From: greg.antal at ata-e.com (Greg Antal) Date: Fri, 12 Jun 2009 08:56:01 -0700 Subject: [python-win32] VARIANT type not supported error In-Reply-To: <4A32086D.6090507@gmail.com> References: <4A305CE9.90102@ata-e.com> <4A32086D.6090507@gmail.com> Message-ID: <4A327A91.6010602@ata-e.com> Mark: Thanks for the confirmation, and thanks for the fix. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.antal at ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) Mark Hammond wrote, On 6/12/2009 12:49 AM: > On 11/06/2009 11:24 AM, Greg Antal wrote: >> Greetings, Experts: >> >> I've run into this error and wonder if any of you can help. >> >> First I get this message: >> [snip]\lib\site-packages\win32com\client\__init__.py:480: >> RuntimeWarning: tp_compare didn't return -1 or -2 for exception >> elif type(obj)==TupleType: >> >> Something then raises an exception (NOT a pythoncom.com_error), from >> which I extract this traceback, exception type, and value: >> [snip] >> iRet, nOpen, liOpen = zFem.feAppGetAllModels () >> In feAppGetAllModels, "PyFemap.py" line 14661, >> , nModelID) >> In _ApplyTypes_, "__init__.py" line 449, >> user, resultCLSID) >> In _get_good_object_, "__init__.py" line 467, >> return _get_good_object_(obj, obUserName, resultCLSID) >> In _get_good_object_, "__init__.py" line 480, >> elif type(obj)==TupleType: >> >> - The VARIANT type 0x14 is not supported >> for SAFEARRAYS > > I think the "noise" before this error was already fixed, but yeah, > there isn't support in pythoncom for 64bit ints - mainly as the SDK > header files indicate they aren't value. However, the MIDL compiler > accepts them, so I just checked in a fix for this. Unfortunately > though, this means you need to wait for the next build, or build it > yourself from CVS. > > Cheers, > > Mark From cappy2112 at gmail.com Mon Jun 15 07:39:44 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 14 Jun 2009 22:39:44 -0700 Subject: [python-win32] FIle I/O on Windows XP Message-ID: <8249c4ac0906142239s2a468feakdd06474e31b3ae15@mail.gmail.com> I was trying to see if I could speed up processing huge files (in the 10's of Gigabytes) by passing various values to the readline() method of the file object. No matter what I passed to readline() each call was slower and slower than passing no argument at all. I've used a SATA bus analyzer to see what kind of block sizes WIndows was using for the reads, and typically for non-AHCI reads, the block sizes were surpsingly small. 8 blocks were typical. It's somewhat difficult to separate I/O traffic that windows is routinely doing even when you're not reading a specific file, so putting the file on a secondary drive will eliminate most of that traffic. Can anyone explain why passing any non-negative values > 0 to readline() makes the file processing slower instead of faster? From davea at ieee.org Mon Jun 15 15:23:21 2009 From: davea at ieee.org (Dave Angel) Date: Mon, 15 Jun 2009 09:23:21 -0400 Subject: [python-win32] FIle I/O on Windows XP In-Reply-To: References: Message-ID: <4A364B49.1010802@ieee.org> Tony Cappellini wrote: > I was trying to see if I could speed up processing huge files (in the > 10's of Gigabytes) > by passing various values to the readline() method of the file object. > > No matter what I passed to readline() each call was slower and slower > than passing no argument at all. > > I've used a SATA bus analyzer to see what kind of block sizes WIndows > was using for the reads, and typically for non-AHCI reads, the block > sizes were surpsingly small. 8 blocks were typical. > > It's somewhat difficult to separate I/O traffic that windows is > routinely doing even when you're not reading a specific file, so > putting the file on a secondary drive will eliminate most of that > traffic. > > Can anyone explain why passing any non-negative values > 0 to > readline() makes the file processing slower instead of faster? > > Critical question, what version of Python? Print out sys.version for us. Have you actually measured to be sure the bulk of the time is not spent in processing the lines? And if you have, have you also measured the time spent in a dummy loop of simple read() calls, to make sure it isn't mostly the disk time? I'll assume you've somehow narrowed it down to readline() itself. If you haven't, this is mostly a waste of time. (eg. If half the time is spent waiting for the disk, you're a candidate for multi-threading, and get_line() specifically allows threads for overlapping I/O.) file.readline is apparently written in C; you could look up the sources to it. I could make a wild guess and say that any tight loop that's checking two termination conditions instead of one would be slower. If it were my code, I might read into a buffer, append a newline to the buffer, and search the buffer for successive newlines. If the user gives me a count, it would slow down that inner loop. But I'm guessing your performance is being hampered by the newline logic. For example, specifiying "u" on the open call will slow things down. What are you doing to make that quicker? Are the files in ASCII, are they in Unix or in Windows mode (the "b" flag on open) ? Are you interpreting the file as UTF-8? Are you in Python 2.x or 3.x ? For example, if you're opening a Windows/style text file, with crlf at the end of each line, you might try timing readline() with the "b" flag on, even though that'll give you \r\n instead of \n at the end of each line. Depending on how you're parsing the line, that might not slow down your other logic at all. So if it speeds up readline() it might be worth it. Have you investigated using readlines(), with a specified buffer size? Obviously you can't (on Win32 anyway) do a single call with the default argument. But that call is mentioned (in fileinput.py) as "a significant speedup." And elsewhere I think the docs imply that "for line in myfile" would be fastest. Looking at the source: in Objects\fileobject.c, function file_readline() seems to be the one we want; it delegates to get_line(). get_line() has a very simple loop if you're not in universal newline mode. Another interesting tidbit in that file: /* A larger buffer size may actually decrease performance. */ #define READAHEAD_BUFSIZE 8192 From python at bdurham.com Mon Jun 15 16:56:26 2009 From: python at bdurham.com (python at bdurham.com) Date: Mon, 15 Jun 2009 10:56:26 -0400 Subject: [python-win32] FIle I/O on Windows XP In-Reply-To: <8249c4ac0906142239s2a468feakdd06474e31b3ae15@mail.gmail.com> References: <8249c4ac0906142239s2a468feakdd06474e31b3ae15@mail.gmail.com> Message-ID: <1245077786.20290.1320458621@webmail.messagingengine.com> Hi Tony, > I was trying to see if I could speed up processing huge files (in the 10's of Gigabytes) by passing various values to the readline() method of the file object. We also work with large sized text files (we use Python for ETL jobs in the 100-200 Gb range) and have noticed similar behaviors. We're currently running 32 and 64 bit versions of Python 2.6.1 on Windows XP (32-bit/2 Gb) and Windows 2008 (64-bit/48 Gb) with SCSI and eSATA drives. All our file access is local (vs. over a network) and the boxes our jobs run on are dedicated machines running nothing else but our Python scripts. Our boxes are on an isolated network and we have no virus checking software running in the background. Since our boxes are maxed out with memory, we thought that supplying large buffer sizes to open() would improve performance. Like you, we were surprised that this strategy significantly slowed down our processing. We're currently opening our text files via open() and allowing Python to choose the default buffer size. My experience with Python is that many performance enhancement techniques are not (initially) intuitive - but my gut tells me that the behavior we are both seeing is *NOT* one of these cases, eg. something smells fishy. I'm happy to run experiments on our side if anyone has suggestions. Thanks for bringing this up. Regards, Malcolm From zweetboy at live.com Mon Jun 15 17:52:41 2009 From: zweetboy at live.com (Sweet Boy) Date: Mon, 15 Jun 2009 09:52:41 -0600 Subject: [python-win32] help, ImportError: MemoryLoadLibrary failed loading win32ui.pyd!!! Message-ID: hi, well i got this exception when i run my .exe Traceback (most recent call last): File "new.py", line 2, in (module) File "zipextimporter.pyc", line 98, in load_module ImportError: MemoryLoadLibrary failed loading win32ui.pydthis is my script to make .py to .exe: from distutils.core import setup import py2exe setup(console=["new.py"], options={"py2exe": {"bundle_files": 1}}, ) how i can fix this problem? _________________________________________________________________ More than messages?check out the rest of the Windows Live?. http://www.microsoft.com/windows/windowslive/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeanpierreda at gmail.com Tue Jun 16 03:23:33 2009 From: jeanpierreda at gmail.com (Devin Jeanpierre) Date: Mon, 15 Jun 2009 18:23:33 -0700 Subject: [python-win32] win32file.CreateSymbolicLink and SYMLINK_FLAG_DIRECTORY Message-ID: I'm new to pywin32 development, but wanted to toy with creating symlinks (and related new things) with a similar API to the current os module. The documentation in pywin32 states that the only flag is "SYMLINK_FLAG_DIRECTORY" (MSDN docs state that in the C++ API, the only flag is "SYMBOLIC_LINK_FLAG_DIRECTORY"). I don't know where to find it; the examples that were provided showed flags being in the same module, such as "win32pdh.PERF_DETAIL_WIZARD", but there is no win32file.SYMLINK_FLAG_DIRECTORY on my install, nor is there a win32file.SYMBOLIC_LINK_FLAG_DIRECTORY (in fact, nothing of the form win32file.SYM*). I could find no dedicated constants/flags module or submodule. I would appreciate some help finding the constant (for now, I am using the magic number 1 as described in the MSDN docs). Also, it appears that CreateSymbolicLink raises an exception in some failure circumstances (when the location that the symlink would be is already taken up by something), but not others (when the user doesn't have the appropriate permissions for creating symbolic links). Devin Jeanpierre From bertosmailbox at gmail.com Tue Jun 16 04:40:51 2009 From: bertosmailbox at gmail.com (Roberto Aguilar) Date: Mon, 15 Jun 2009 19:40:51 -0700 Subject: [python-win32] Building msi with python 2.6.2 Message-ID: <2E851D8B-D57D-43CF-9FCB-3B144921933F@gmail.com> Hello everyone, I've been able to successfully build a MSI of pywin32 under Python 2.6.2. But, when trying to use python, e.g. "import win32api", after installing the MSI I get: ImportError: DLL load failed: The specified module could not be found. With the help of a colleague, I discovered the problem is due to python not finding pywintypes26.dll. This file was installed by the MSI. It's in: C:\Python26\Lib\site-packages\pywin32_system32 but that location is not being searched when importing. I can either: - set PATH=c:\Python26\Lib\site-packages\pywin32_system32;%PATH% - then importing win32api works fine. or - move pywintypes26.dll to c:\Python26\Lib\site-packages\win32 - then importing win32api works fine. Any suggestions as to the "right" way to fix this, as well as what to switch up in the setup.py file so the MSI is built in a manner that will work out of the box? Thanks! -Roberto. From ah.kode at gmail.com Tue Jun 16 07:50:38 2009 From: ah.kode at gmail.com (a h) Date: Tue, 16 Jun 2009 11:20:38 +0530 Subject: [python-win32] Regarding build of code using Visual Studio in python Message-ID: Hi all I have a C source code, i want to build it using Visual Studio without using its IDE. Actually i want to know that how do i write code/script in python so that it builds my "source.c" file and provides me "source.obj" and "source.exe" files. Thanx in advance. thnx & regds ah -------------- next part -------------- An HTML attachment was scrubbed... URL: From ah.kode at gmail.com Mon Jun 15 16:39:57 2009 From: ah.kode at gmail.com (a h) Date: Mon, 15 Jun 2009 20:09:57 +0530 Subject: [python-win32] Regarding build of code using Visual Studio in python Message-ID: Hi all I have a C source code, i want to build it using Visual Studio without using its IDE. Actually i want to know that how do i write code/script in python so that it builds my "source.c" file and provides me "source.obj" and "source.exe" files. Thanx in advance. thnx & regds ah -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Jun 16 09:54:44 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 16 Jun 2009 08:54:44 +0100 Subject: [python-win32] Regarding build of code using Visual Studio in python In-Reply-To: References: Message-ID: <4A374FC4.4090302@timgolden.me.uk> a h wrote: > I have a C source code, i want to build it using Visual Studio without using > its IDE. Actually i want to know that how do i write code/script in python > so that it builds my "source.c" file and provides me "source.obj" and > "source.exe" files. If that's really all you want, you don't really need much of a tool. But since it's easy enough, have a look at scons: http://www.scons.org/ TJG From skippy.hammond at gmail.com Tue Jun 16 10:41:42 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 16 Jun 2009 18:41:42 +1000 Subject: [python-win32] Building msi with python 2.6.2 In-Reply-To: <2E851D8B-D57D-43CF-9FCB-3B144921933F@gmail.com> References: <2E851D8B-D57D-43CF-9FCB-3B144921933F@gmail.com> Message-ID: <4A375AC6.3020802@gmail.com> On 16/06/2009 12:40 PM, Roberto Aguilar wrote: > Hello everyone, > > I've been able to successfully build a MSI of pywin32 under Python > 2.6.2. But, when trying to use python, e.g. "import win32api", after > installing the MSI I get: > > ImportError: DLL load failed: The specified module could not be found. > > With the help of a colleague, I discovered the problem is due to python > not finding pywintypes26.dll. This file was installed by the MSI. It's in: > > C:\Python26\Lib\site-packages\pywin32_system32 > > but that location is not being searched when importing. > > I can either: > > - set PATH=c:\Python26\Lib\site-packages\pywin32_system32;%PATH% > - then importing win32api works fine. > > or > > - move pywintypes26.dll to c:\Python26\Lib\site-packages\win32 > - then importing win32api works fine. Or arrange to execute 'pywin32-postinstall.py -install' at the end of the install, which will copy those files somewhere suitable (either system32, or to the python dir). I'd be happy to make that script friendlier for MSI if necessary (and hopefully you will contribute the MSI process back to pywin32 ;) Cheers, Mark From mdriscoll at co.marshall.ia.us Tue Jun 16 18:15:27 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 16 Jun 2009 11:15:27 -0500 Subject: [python-win32] help, ImportError: MemoryLoadLibrary failed loading win32ui.pyd!!! In-Reply-To: References: Message-ID: <4A37C51F.1070103@co.marshall.ia.us> Sweet Boy wrote: > hi, well i got this exception when i run my .exe > > Traceback (most recent call last): > File "new.py", line 2, in (module) > File "zipextimporter.pyc", line 98, in load_module > ImportError: MemoryLoadLibrary failed loading win32ui.pyd > this is my script to make .py to .exe: > > from distutils.core import setup > import py2exe > setup(console=["new.py"], > options={"py2exe": {"bundle_files": 1}}, > ) > > how i can fix this problem? > This is more of a py2exe issue than a pywin32 issue. Try setting the bundle_files option to "3" instead. I've found that option "1" can be problematic. - Mike From timr at probo.com Tue Jun 16 19:05:03 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 16 Jun 2009 10:05:03 -0700 Subject: [python-win32] Regarding build of code using Visual Studio in python In-Reply-To: References: Message-ID: <4A37D0BF.4050005@probo.com> a h wrote: > > I have a C source code, i want to build it using Visual Studio without > using its IDE. Actually i want to know that how do i write code/script > in python so that it builds my "source.c" file and provides me > "source.obj" and "source.exe" files. As long as you have the environment variables set up properly (by calling vcvarsall.bat or vcvars32.bat, depending on the version), it's just a matter of calling the command line compiler using subprocess or os.system: cl source.c -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Jun 16 19:17:23 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 16 Jun 2009 10:17:23 -0700 Subject: [python-win32] win32file.CreateSymbolicLink and SYMLINK_FLAG_DIRECTORY In-Reply-To: References: Message-ID: <4A37D3A3.4060108@probo.com> Devin Jeanpierre wrote: > I'm new to pywin32 development, but wanted to toy with creating > symlinks (and related new things) with a similar API to the current os > module. The documentation in pywin32 states that the only flag is > "SYMLINK_FLAG_DIRECTORY" (MSDN docs state that in the C++ API, the > only flag is "SYMBOLIC_LINK_FLAG_DIRECTORY"). I don't know where to > find it; the examples that were provided showed flags being in the > same module, such as "win32pdh.PERF_DETAIL_WIZARD", but there is no > win32file.SYMLINK_FLAG_DIRECTORY on my install, nor is there a > win32file.SYMBOLIC_LINK_FLAG_DIRECTORY (in fact, nothing of the form > win32file.SYM*). I could find no dedicated constants/flags module or > submodule. I would appreciate some help finding the constant (for now, > I am using the magic number 1 as described in the MSDN docs). > Many Windows constants are gathered in win32con. Give that a try. I can't test it myself, because my version of pywin32 does not include the CreateSymbolicLink API at all. If that fails, then you are safe in using the value 1. That's what's defined in the SDK header files. If you are considering distributing this, remember that CreateSymbolicLink requires at least Vista. It is not present in XP. > Also, it appears that CreateSymbolicLink raises an exception in some > failure circumstances (when the location that the symlink would be is > already taken up by something), but not others (when the user doesn't > have the appropriate permissions for creating symbolic links). > Hmm. Does the API return anything in those cases? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mvilas at gmail.com Tue Jun 16 20:22:47 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Tue, 16 Jun 2009 15:22:47 -0300 Subject: [python-win32] WinAppDbg version 1.2 is out! Message-ID: <3fbf862f0906161122k176a9508r73db80e53912e0fe@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? =========================== The WinAppDbg project is currently hosted at Sourceforge, and can be found at: http://winappdbg.sourceforge.net/ It's also hosted at the Python Package Index (PyPi): http://pypi.python.org/pypi/winappdbg/1.2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvilas at gmail.com Tue Jun 16 20:45:27 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Tue, 16 Jun 2009 15:45:27 -0300 Subject: [python-win32] [Full-disclosure] WinAppDbg version 1.2 is out! In-Reply-To: <4A37E3E0.4080605@crucialsecurity.com> References: <3fbf862f0906161122k176a9508r73db80e53912e0fe@mail.gmail.com> <4A37E3E0.4080605@crucialsecurity.com> Message-ID: <3fbf862f0906161145p6c5c59edvf193f4842c262b52@mail.gmail.com> Basically it's got some different features than PyDbg and a more complete documentation. If you have an *existing* project built upon PyDbg it's probably not worth switching (unless you've hit some very bad problem with it) but I believe it's better for newer projects, as this new library is more flexible and scalable. It doesn't have a fuzzing platform like Sulley. It does however have some tools that can be useful when fuzzing, particularly one that attaches to a program as a debugger and logs the crashes it finds, using some simple heuristics to avoid logging the same crash twice. Let me know if you decide to give it a try, I'll help in anything I can :) Cheers, -Mario On Tue, Jun 16, 2009 at 3:26 PM, Jared DeMott wrote: > Can you compare/contrast with pydbg so I can understand why I might want > to give it a try? Do you have a fuzzing platform like Sulley for it as > well? Thx! > Jared -- HONEY: I want to? put some powder on my nose. GEORGE: Martha, won?t you show her where we keep the euphemism? From jdemott at crucialsecurity.com Tue Jun 16 20:26:40 2009 From: jdemott at crucialsecurity.com (Jared DeMott) Date: Tue, 16 Jun 2009 14:26:40 -0400 Subject: [python-win32] [Full-disclosure] WinAppDbg version 1.2 is out! In-Reply-To: <3fbf862f0906161122k176a9508r73db80e53912e0fe@mail.gmail.com> References: <3fbf862f0906161122k176a9508r73db80e53912e0fe@mail.gmail.com> Message-ID: <4A37E3E0.4080605@crucialsecurity.com> Mario Alejandro Vilas Jerez wrote: > What is WinAppDbg? > ================== > > The WinAppDbg python module allows developers to quickly code instrumentation > scripts in Python under a Windows environment. Can you compare/contrast with pydbg so I can understand why I might want to give it a try? Do you have a fuzzing platform like Sulley for it as well? Thx! Jared > > 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? > =========================== > > The WinAppDbg project is currently hosted at Sourceforge, and can be found at: > > http://winappdbg.sourceforge.net/ > > It's also hosted at the Python Package Index (PyPi): > > http://pypi.python.org/pypi/winappdbg/1.2 > > > From timr at probo.com Wed Jun 17 00:22:16 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 16 Jun 2009 15:22:16 -0700 Subject: [python-win32] win32file.CreateSymbolicLink and SYMLINK_FLAG_DIRECTORY In-Reply-To: References: <4A37D3A3.4060108@probo.com> Message-ID: <4A381B18.3040406@probo.com> Devin Jeanpierre wrote: >> Hmm. Does the API return anything in those cases? >> > It returns None in all cases, so for now to cover that I check > GetLastError, and if it's non-zero (0 being ERROR_SUCCESS, meaning > there was no error-- another constant I don't know where to find), use > FormatMessage to create an exception message and raise WindowsError. > The problem here is that I now have my error-handling code in two > places where I would prefer it to be in only one. > Unfortunately, that's not safe. GetLastError is not set to 0 when an API succeeds. The "last error" value is only updated when an error actually occurs. When a boolean API returns success, GetLastError might still have a number left over from the last actual error. I'm looking at the source code for the win32file module[1], and it looks to me like it's doing exactly the right thing. If the API returns false ("fail"), it raises an exception, otherwise it returns None. If you are so inclined, perhaps you should try a test case in C to see if this is actually some generic failure in the API. -- [1] - http://pywin32.cvs.sourceforge.net/viewvc/pywin32/pywin32/win32/src/win32file.i?revision=1.107&view=markup -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ah.kode at gmail.com Wed Jun 17 14:24:54 2009 From: ah.kode at gmail.com (a h) Date: Wed, 17 Jun 2009 17:54:54 +0530 Subject: [python-win32] regarding invoking command prompt using python Message-ID: Hi all 1.I want to know how do i write batchfile kind of file in python so that it executes some commands. Code snippets are required. 2.As well how do i invoke command prompt. Actually what i need is that i have to perform certain things in windows...first i have to go to start->run->type cmd then command prompt window is open... in that to run an .exe i have to give the whole path like this c:\> cd temp_folder\next_folder\test.exe... and many more commands... So I want this to be perfomed in python. please help Thanx in advance Thnx & rgds ah -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerdusvanzyl at gmail.com Wed Jun 17 15:31:36 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Wed, 17 Jun 2009 15:31:36 +0200 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: Message-ID: <91882ea90906170631l474b662wb53b0f7eda55bd24@mail.gmail.com> 1) filename = "C:/Program Files (x86)/NSIS/makensisw.exe" doc = "install.nsi" status = os.system('""%s" "%s"' % (filename, doc)) print "Status: ", status If you have long running program you want the output from there are other options but the above is easiest imho. 2) just open the python file using the console python (python.exe) interpreter not pythonw.exe; You will get a console window. ~Gerdus On Wed, Jun 17, 2009 at 2:24 PM, a h wrote: > Hi all > > 1.I want to know how do i write batchfile kind of file in python so that it > executes some commands. Code snippets are required. > 2.As well how do i invoke command prompt. > > Actually what i need is that i have to perform certain things in > windows...first i have to go to?start->run->type cmd > then command prompt window is open... in that to run an .exe i have to give > the whole path like this c:\> cd temp_folder\next_folder\test.exe... and > many more commands... > So I want this to be perfomed in python. please help > Thanx in advance > Thnx & rgds > ah > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From bgailer at gmail.com Wed Jun 17 15:30:02 2009 From: bgailer at gmail.com (bob gailer) Date: Wed, 17 Jun 2009 09:30:02 -0400 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: Message-ID: <4A38EFDA.1080500@gmail.com> a h wrote: > Hi all > > 1.I want to know how do i write batchfile kind of file in python so > that it executes some commands. Code snippets are required. import os os.system(command) e.g. os.system(" c:\>temp_folder\next_folder\test.exe") > 2.As well how do i invoke command prompt. Not sure what that means. Please explain. -- Bob Gailer Chapel Hill NC 919-636-4239 From cso at giritech.com Wed Jun 17 18:30:30 2009 From: cso at giritech.com (=?iso-8859-1?Q?Christian_S=F8rensen?=) Date: Wed, 17 Jun 2009 18:30:30 +0200 Subject: [python-win32] Problem with winxpgui Message-ID: <36B964E5D39FAD40AE29FD21BAF6CDC401268CC6@dudley.giritech.com> Hi I have just updated to python 2.6 and also updated the py win package to pywin32-213.win32-py2.6. The GUI now seems to not get the XP look and feel it had before on the python 2.5 installation. I am running on a Windows Vista machine, but the change seems to be the same on XP. The code includes winxpgui and it has the same style as when I import win32gui. I would really like to get the pretty styling back J. Any help would be greatly appreciated. Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 2243 bytes Desc: image001.gif URL: From timr at probo.com Wed Jun 17 20:54:52 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 17 Jun 2009 11:54:52 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: Message-ID: <4A393BFC.4050801@probo.com> a h wrote: > > thanks for the reply, what i have done to set up the environment > variables is open the command prompt and then has given the whole path > of c:\..\vsvars32.bat and then enter. > A message appear is "setting environment for using MS visual studio". > and then using DEVENV i had build my solution. "devenv" is a fairly heavyweight way to do that. It basically invokes the whole IDE. If you are using Visual Studio 2005 or 2008, you can say msbuild xxxx.sln which is not quite so heavy as devenv. If you're using an older Visual Studio, that may not be available. > can u please help me out that how do i perform above steps in python. > code snippet is required. I was going to say "just write the commands out to a temporary batch file, then call os.system or subprocess.call to run the batch file" until I read this followup: a h wrote: > > 1.I want to know how do i write batchfile kind of file in python so > that it executes some commands. Code snippets are required. For the future, the way you worded that is impolite. When you say "required", it is as if you are demanding something from us. It would be better to say "Please provide code snippets." > 2.As well how do i invoke command prompt. > > Actually what i need is that i have to perform certain things in > windows...first i have to go to start->run->type cmd > then command prompt window is open... in that to run an .exe i have to > give the whole path like this c:\> cd > temp_folder\next_folder\test.exe... and many more commands... > So I want this to be perfomed in python. please help Can't you just work this out for yourself? You create a file, you write to it, you run it: fbat = open( "xxx.bat", "w" ) print >> fbat, "echo I'm inside a batch file" print >> fbat, 'call "c:\\Program Files\\Microsoft etc\\vsvars32.bat'" print >> fbat, 'msbuild myproject.sln' fbat.close() os.system( "xxx.bat" ) os.remove( "xxx.bat" ) Note that you will need extra quotes when the path includes spaces. Note also the escaped backslash characters. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Wed Jun 17 22:54:02 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 17 Jun 2009 14:54:02 -0600 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: <4A393BFC.4050801@probo.com> References: <4A393BFC.4050801@probo.com> Message-ID: Everyone: If I read the request correctly, this question is about how to set environment variables from a python script. In other words: what is the Python equivalent of the DOS command: SET envrmnt="This is the new value" If my experience is correct (I would love it if someone will tell me that I am wrong) it cannot be done. There are two modules which look like they should work, but they only affect processes which are children of the python code, not the environment from which it is running. (See the console trace below) C:>c:\python26\python.exe Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.putenv('x','xxx') >>> os.system('set x') # run a child process x=xxx 0 >>> print repr(os.getenv('x')) None >>>exit() C:>set x="zzz" C:>c:\python26\python.exe Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import win32api >>> win32api.SetEnvironmentVariable('X','xxx') >>> import os >>> print repr(os.getenv('X')) 'zzz' >>> There MUST be some api to actually do what a SET command does, otherwise the CMD shell itself could not do it, but I have never seen any documentation for it. This seem to me to be the only thing which keeps one from running Python as a command shell. ------------------------------------------------------------------------------------------------- Dear a h: The only way I know to permanently set environment variables is: -Right-click on "My Computer" -select "Properties" -select "Advanced System Settings" -click on "Environment Variables" Many of us old DOS hackers keep a directory of utility scripts to make running command-line commands easier. I am in the habit of creating a C:\utils folder and putting all of my quick scripts in there. Then I go through the Windows steps (as above) and edit my PATH environment variable to concatenate ";C:\utils" to the end of whatever is already there. Into the C:\utils folder I place a few handy filters, such as Tail.exe, touch.exe, and less.exe. Mosly it contains a bunch of .bat files. For example, ls.bat contains only one line of text, which is: "dir %1 %2 %3 %4 %5 %6 %7 %8 %9". So when I forget which operating system I am using and type "ls *.txt", it works. More important are the Python helpers. python.bat contains: "c:\python26\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9" py30.bat contains: "c:\python30\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9" ipy.bat contains: ""c:\program files\Ironpython 2.0.1\ipy.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9" ped.bat contains: "start c:\python26\Lib\site-packages\pythonwin\pythonwin.exe %1 %2 %3" 2to3.bat contains: "c:\python26\python.exe c:\python26\Tools\Scripts\2to3.py %1 %2 %3 %4 %5 %6 %7 %8 %9" Suppose I am running a console cmd window in a directory which contains the script "testme.py" and I want to test under different environments. I type: >python testme.py >ipy testme.py >copy testme.py testme3.py >2to3 testme3.py --write >py30 testme3.py Hope this helps a little. -- Vernon Cole On Wed, Jun 17, 2009 at 12:54 PM, Tim Roberts wrote: > a h wrote: > > > > thanks for the reply, what i have done to set up the environment > > variables is open the command prompt and then has given the whole path > > of c:\..\vsvars32.bat and then enter. > > A message appear is "setting environment for using MS visual studio". > > and then using DEVENV i had build my solution. > > "devenv" is a fairly heavyweight way to do that. It basically invokes > the whole IDE. If you are using Visual Studio 2005 or 2008, you can say > msbuild xxxx.sln > which is not quite so heavy as devenv. If you're using an older Visual > Studio, that may not be available. > > > can u please help me out that how do i perform above steps in python. > > code snippet is required. > > I was going to say "just write the commands out to a temporary batch > file, then call os.system or subprocess.call to run the batch file" > until I read this followup: > > a h wrote: > > > > 1.I want to know how do i write batchfile kind of file in python so > > that it executes some commands. Code snippets are required. > > For the future, the way you worded that is impolite. When you say > "required", it is as if you are demanding something from us. It would > be better to say "Please provide code snippets." > > > > 2.As well how do i invoke command prompt. > > > > Actually what i need is that i have to perform certain things in > > windows...first i have to go to start->run->type cmd > > then command prompt window is open... in that to run an .exe i have to > > give the whole path like this c:\> cd > > temp_folder\next_folder\test.exe... and many more commands... > > So I want this to be perfomed in python. please help > > Can't you just work this out for yourself? You create a file, you write > to it, you run it: > > fbat = open( "xxx.bat", "w" ) > print >> fbat, "echo I'm inside a batch file" > print >> fbat, 'call "c:\\Program Files\\Microsoft etc\\vsvars32.bat'" > print >> fbat, 'msbuild myproject.sln' > fbat.close() > os.system( "xxx.bat" ) > os.remove( "xxx.bat" ) > > Note that you will need extra quotes when the path includes spaces. > Note also the escaped backslash characters. > > -- > 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 pbloom at crystald.com Thu Jun 18 00:29:54 2009 From: pbloom at crystald.com (Philip Bloom) Date: Wed, 17 Jun 2009 15:29:54 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: <4A393BFC.4050801@probo.com> Message-ID: <2DEFEB25B65B1D4C962D79E3CCBAFC7F06E88532@mpkexc01.eidos.com> That logic seems weird to me. This is why it feels weird: The cmd shell itself is a running application that only changes its own environment parameters. This is no different from the limitation that Python's os.putenv has, as it only affects the Cmd process and children of that process. It does not affect other cmd processes that may be running or the real global environment. The SET command (and batch scripts) are simply sending commands that are executed by that application. "Python.exe" as a lower level process does not standardly change the runtime environment of a higher level one (And if that's doable at all, it's done by asking the OS to do, not actually done by the process itself). Maybe I'm misunderstanding what's being asked, but cmd doesn't do any special magic that changes the rules as far as a shell. If you leave the shell to a higher level environment, you do not have what you set up in the shell. Equally, while you can change the defaults, it does not adjust running processes, since that'd likely break the environment of running processes. ________________________________ From: python-win32-bounces+pbloom=crystald.com at python.org [mailto:python-win32-bounces+pbloom=crystald.com at python.org] On Behalf Of Vernon Cole Sent: Wednesday, June 17, 2009 1:54 PM To: Python-Win32 List Subject: Re: [python-win32] regarding invoking command prompt using python Everyone: If I read the request correctly, this question is about how to set environment variables from a python script. In other words: what is the Python equivalent of the DOS command: SET envrmnt="This is the new value" If my experience is correct (I would love it if someone will tell me that I am wrong) it cannot be done. There are two modules which look like they should work, but they only affect processes which are children of the python code, not the environment from which it is running. (See the console trace below) C:>c:\python26\python.exe Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.putenv('x','xxx') >>> os.system('set x') # run a child process x=xxx 0 >>> print repr(os.getenv('x')) None >>>exit() C:>set x="zzz" C:>c:\python26\python.exe Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import win32api >>> win32api.SetEnvironmentVariable('X','xxx') >>> import os >>> print repr(os.getenv('X')) 'zzz' >>> There MUST be some api to actually do what a SET command does, otherwise the CMD shell itself could not do it, but I have never seen any documentation for it. This seem to me to be the only thing which keeps one from running Python as a command shell. ------------------------------------------------------------------------ ------------------------- Dear a h: The only way I know to permanently set environment variables is: -Right-click on "My Computer" -select "Properties" -select "Advanced System Settings" -click on "Environment Variables" Many of us old DOS hackers keep a directory of utility scripts to make running command-line commands easier. I am in the habit of creating a C:\utils folder and putting all of my quick scripts in there. Then I go through the Windows steps (as above) and edit my PATH environment variable to concatenate ";C:\utils" to the end of whatever is already there. Into the C:\utils folder I place a few handy filters, such as Tail.exe, touch.exe, and less.exe. Mosly it contains a bunch of .bat files. For example, ls.bat contains only one line of text, which is: "dir %1 %2 %3 %4 %5 %6 %7 %8 %9". So when I forget which operating system I am using and type "ls *.txt", it works. More important are the Python helpers. python.bat contains: "c:\python26\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9" py30.bat contains: "c:\python30\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9" ipy.bat contains: ""c:\program files\Ironpython 2.0.1\ipy.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9" ped.bat contains: "start c:\python26\Lib\site-packages\pythonwin\pythonwin.exe %1 %2 %3" 2to3.bat contains: "c:\python26\python.exe c:\python26\Tools\Scripts\2to3.py %1 %2 %3 %4 %5 %6 %7 %8 %9" Suppose I am running a console cmd window in a directory which contains the script "testme.py" and I want to test under different environments. I type: >python testme.py >ipy testme.py >copy testme.py testme3.py >2to3 testme3.py --write >py30 testme3.py Hope this helps a little. -- Vernon Cole On Wed, Jun 17, 2009 at 12:54 PM, Tim Roberts wrote: a h wrote: > > thanks for the reply, what i have done to set up the environment > variables is open the command prompt and then has given the whole path > of c:\..\vsvars32.bat and then enter. > A message appear is "setting environment for using MS visual studio". > and then using DEVENV i had build my solution. "devenv" is a fairly heavyweight way to do that. It basically invokes the whole IDE. If you are using Visual Studio 2005 or 2008, you can say msbuild xxxx.sln which is not quite so heavy as devenv. If you're using an older Visual Studio, that may not be available. > can u please help me out that how do i perform above steps in python. > code snippet is required. I was going to say "just write the commands out to a temporary batch file, then call os.system or subprocess.call to run the batch file" until I read this followup: a h wrote: > > 1.I want to know how do i write batchfile kind of file in python so > that it executes some commands. Code snippets are required. For the future, the way you worded that is impolite. When you say "required", it is as if you are demanding something from us. It would be better to say "Please provide code snippets." > 2.As well how do i invoke command prompt. > > Actually what i need is that i have to perform certain things in > windows...first i have to go to start->run->type cmd > then command prompt window is open... in that to run an .exe i have to > give the whole path like this c:\> cd > temp_folder\next_folder\test.exe... and many more commands... > So I want this to be perfomed in python. please help Can't you just work this out for yourself? You create a file, you write to it, you run it: fbat = open( "xxx.bat", "w" ) print >> fbat, "echo I'm inside a batch file" print >> fbat, 'call "c:\\Program Files\\Microsoft etc\\vsvars32.bat'" print >> fbat, 'msbuild myproject.sln' fbat.close() os.system( "xxx.bat" ) os.remove( "xxx.bat" ) Note that you will need extra quotes when the path includes spaces. Note also the escaped backslash characters. -- 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 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jun 18 01:19:51 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 17 Jun 2009 16:19:51 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: <4A393BFC.4050801@probo.com> Message-ID: <4A397A17.9080706@probo.com> Vernon Cole wrote: > > If I read the request correctly, this question is about how to set > environment variables from a python script. > In other words: what is the Python equivalent of the DOS command: > SET envrmnt="This is the new value" Well, his question was a bit different, but this is part of it. > If my experience is correct (I would love it if someone will tell me > that I am wrong) it cannot be done. You are correct. It cannot be done, either on Linux or on Windows. You cannot affect the environment of your parent process. > There MUST be some api to actually do what a SET command does, > otherwise the CMD shell itself could not do it, but I have never seen > any documentation for it. This seem to me to be the only thing which > keeps one from running Python as a command shell. If you go look for SET.EXE, you won't find it. It's not a separate command-line tool -- it is a built-in that CMD processes on its own. When you type commands at a command line, you are actually communicating with the CMD.EXE program itself. Before it goes to look for an executable file to run, it checks to see if the command is in its list of built-ins. The "if" and "for" commands are also built-ins. That's why the "set" command can change the environment of the cmd.exe process -- it's being handled by that process. However, this does not prevent running Python as a command shell. There is a perfectly viable Python command shell for DOS called iPython. It implements its "set" command in exactly the same way -- it's an internal command that alters the state of the iPython process, and hence every process that it spawns. > The only way I know to permanently set environment variables is: > -Right-click on "My Computer" > -select "Properties" > -select "Advanced System Settings" > -click on "Environment Variables" Although this is true, the better solution for "a h" is to create a batch file and run that. The batch file then runs as its own process, so that environment changes remain with the process. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Jun 18 04:11:26 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 17 Jun 2009 19:11:26 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> Message-ID: <4A39A24E.6080305@probo.com> Vernon Cole wrote: > > Similarly, it seems that getenv() and putenv() should be inverse > functions, but they are not. os.getenv() refers to the parent > environment, os.putenv() refers to the child environment. No, no, no! That's not true at all! BOTH of those functions refer to the environment of the CURRENT PROCESS. I inherited my environment from my parent process (which is often a shell). I can change my environment as much as I wish. When I create new processes, those processes inherit my current environment, with whatever changes I made. I can't change my parent's environment, and I can't change my children's environment. I can only hand off a copy of my environment to my children, which they are free to modify themselves. > We have established that there is no (documented) inverse function for > getenv() -- although shells do it somehow. We have not established that at all! getenv() gets from the current process environment, and putenv() modifies the current process environment. When you type a "set" command in a command shell, that executes inside bash (or cmd.exe or sh or whatever). In handling "set", bash calls putenv, which modifies bash's environment. Bash can see that change, of course, and any future processes that bash spawns will include those changes. > Is there an inverse for putenv() so that I can see what my children > will see? Of course you can! If YOU call putenv(), then YOU can call getenv() and see the changes you made to your environment. However, when you exit, all of your changes evaporate with your process. The parent process, whatever it is, continues to exist with the environment it had before. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Thu Jun 18 05:01:09 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 17 Jun 2009 21:01:09 -0600 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: <4A39A24E.6080305@probo.com> References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> <4A39A24E.6080305@probo.com> Message-ID: Tim: Okay, explain this... C:\BZR\sterling\HL7>c:\python26\python.exe Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.putenv('x','test') >>> print os.getenv('x') zzz >>> exit() C:\BZR\sterling\HL7>set x x=zzz C:\BZR\sterling\HL7> -- Vernon On Wed, Jun 17, 2009 at 8:11 PM, Tim Roberts wrote: > Vernon Cole wrote: > > > > Similarly, it seems that getenv() and putenv() should be inverse > > functions, but they are not. os.getenv() refers to the parent > > environment, os.putenv() refers to the child environment. > > No, no, no! That's not true at all! BOTH of those functions refer to > the environment of the CURRENT PROCESS. I inherited my environment from > my parent process (which is often a shell). I can change my environment > as much as I wish. When I create new processes, those processes inherit > my current environment, with whatever changes I made. I can't change my > parent's environment, and I can't change my children's environment. I > can only hand off a copy of my environment to my children, which they > are free to modify themselves. > > > > We have established that there is no (documented) inverse function for > > getenv() -- although shells do it somehow. > > We have not established that at all! getenv() gets from the current > process environment, and putenv() modifies the current process > environment. When you type a "set" command in a command shell, that > executes inside bash (or cmd.exe or sh or whatever). In handling "set", > bash calls putenv, which modifies bash's environment. Bash can see that > change, of course, and any future processes that bash spawns will > include those changes. > > > > Is there an inverse for putenv() so that I can see what my children > > will see? > > Of course you can! If YOU call putenv(), then YOU can call getenv() and > see the changes you made to your environment. However, when you exit, > all of your changes evaporate with your process. The parent process, > whatever it is, continues to exist with the environment it had before. > > -- > 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 rwupole at msn.com Thu Jun 18 07:56:30 2009 From: rwupole at msn.com (Roger Upole) Date: Thu, 18 Jun 2009 01:56:30 -0400 Subject: [python-win32] regarding invoking command prompt using python Message-ID: Vernon Cole wrote: > Tim: > Okay, explain this... > C:\BZR\sterling\HL7>c:\python26\python.exe > Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit > (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> import os >>>> os.putenv('x','test') >>>> print os.getenv('x') > zzz >>>> exit() > > C:\BZR\sterling\HL7>set x > x=zzz > > C:\BZR\sterling\HL7> os.getenv reads directly from os.environ, but os.putenv does not actually place the value in os.environ. Roger From rwupole at msn.com Thu Jun 18 08:11:56 2009 From: rwupole at msn.com (Roger Upole) Date: Thu, 18 Jun 2009 02:11:56 -0400 Subject: [python-win32] win32file.CreateSymbolicLink and Message-ID: Devin Jeanpierre wrote: > I'm new to pywin32 development, but wanted to toy with creating > symlinks (and related new things) with a similar API to the current os > module. The documentation in pywin32 states that the only flag is > "SYMLINK_FLAG_DIRECTORY" (MSDN docs state that in the C++ API, the > only flag is "SYMBOLIC_LINK_FLAG_DIRECTORY"). I don't know where to > find it; the examples that were provided showed flags being in the > same module, such as "win32pdh.PERF_DETAIL_WIZARD", but there is no > win32file.SYMLINK_FLAG_DIRECTORY on my install, nor is there a > win32file.SYMBOLIC_LINK_FLAG_DIRECTORY (in fact, nothing of the form > win32file.SYM*). I could find no dedicated constants/flags module or > submodule. I would appreciate some help finding the constant (for now, > I am using the magic number 1 as described in the MSDN docs). > > Also, it appears that CreateSymbolicLink raises an exception in some > failure circumstances (when the location that the symlink would be is > already taken up by something), but not others (when the user doesn't > have the appropriate permissions for creating symbolic links). > > Devin Jeanpierre Some previous versions of the MSDN docs listed the name incorrectly. I'll make sure the correct name shows up in the help file and one of the constants modules in the next build. Regarding the permissions, I get this traceback when attempting to execute the function without SeCreateSymbolicLinkPrivilege enabled: Traceback (most recent call last): File "J:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript exec codeObject in __main__.__dict__ File "V:\Users\Public\Documents\py\test_CreateSymbolicLink.py", line 19, in ? win32file.CreateSymbolicLink(fname2,fname1,Transaction=trans) error: (1314, 'CreateSymbolicLink', 'A required privilege is not held by the client.') How are you verifying that the function failed ? Roger From vernondcole at gmail.com Thu Jun 18 17:04:46 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 18 Jun 2009 09:04:46 -0600 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: Message-ID: So -- is there an api call which DOES actually place the value in os.environ? -- Vernon On Wed, Jun 17, 2009 at 11:56 PM, Roger Upole wrote: > Vernon Cole wrote: > >> Tim: >> Okay, explain this... >> C:\BZR\sterling\HL7>c:\python26\python.exe >> Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit >> (Intel)] >> on >> win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import os >>>>> os.putenv('x','test') >>>>> print os.getenv('x') >>>>> >>>> zzz >> >>> exit() >>>>> >>>> >> C:\BZR\sterling\HL7>set x >> x=zzz >> >> C:\BZR\sterling\HL7> >> > > os.getenv reads directly from os.environ, but os.putenv > does not actually place the value in os.environ. > > Roger > > _______________________________________________ > 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 timr at probo.com Thu Jun 18 18:33:13 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 18 Jun 2009 09:33:13 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> <4A39A24E.6080305@probo.com> Message-ID: <4A3A6C49.6050807@probo.com> Vernon Cole wrote: > Tim: > Okay, explain this... > C:\BZR\sterling\HL7>c:\python26\python.exe > Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import os > >>> os.putenv('x','test') > >>> print os.getenv('x') > zzz > >>> exit() > > C:\BZR\sterling\HL7>set x > x=zzz > > C:\BZR\sterling\HL7> Depending on your point of view, that's either a usage problem or a design flaw in the "os" module. On Windows, os.putenv actually calls the operating system service that changes the current environment, but os.getenv does not: it just reads from the os.environ dictionary, which is a snapshot of the environment taken at startup time.. If you had changed the variable by saying this: os.environ['x'] = 'test' (which is the Pythonic way to do it), you'd find that both the process environment and Python's snapshot of the environment were updated, and things would work as I said. By calling os.putenv, the process environment is updated, but the Python snapshot is bypassed. You can see that os.putenv really does update the current process environment: C:\tmp>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os, win32api >>> os.environ['x'] 'zzz' >>> os.getenv('x') 'zzz' >>> win32api.GetEnvironmentVariable('x') 'zzz' >>> os.putenv('x','test') >>> os.environ['x'] 'zzz' >>> os.getenv('x') 'zzz' >>> win32api.GetEnvironmentVariable('x') 'test' >>> os.system('set x') x=test 0 >>> Compare this to: C:\tmp>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os, win32api >>> os.environ['x'] 'zzz' >>> os.environ['x'] = 'test' >>> os.environ['x'] 'test' >>> os.getenv('x') 'test' >>> win32api.GetEnvironmentVariable('x') 'test' >>> os.system('set x') x=test 0 >>> The takeaway here is, basically, don't ever call os.putenv. Instead, use os.environ. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Jun 18 19:15:05 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 18 Jun 2009 10:15:05 -0700 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> <4A39A24E.6080305@probo.com> <4A3A6C49.6050807@probo.com> Message-ID: <4A3A7619.80202@probo.com> Vernon Cole wrote: > Thanks, Tim! > > Should this be logged against the standard library as a bug? Nope. It's actually the documented behavior. See section 16.1.1 here: http://docs.python.org/library/os.html -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From simon.king at motorola.com Thu Jun 18 19:30:21 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Thu, 18 Jun 2009 18:30:21 +0100 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: Message-ID: <8D20BBB55F590E42AADF592A815E8617042AAC18@zuk35exm65.ds.mot.com> > -----Original Message----- > From: python-win32-bounces+simon.king=motorola.com at python.org > [mailto:python-win32-bounces+simon.king=motorola.com at python.or > g] On Behalf Of Vernon Cole > Sent: 18 June 2009 16:05 > To: Roger Upole > Cc: python-win32 at python.org > Subject: Re: [python-win32] regarding invoking command prompt > using python > > So -- is there an api call which DOES actually place the > value in os.environ? > -- > Vernon I think you should just set the value in os.environ: In [1]: import os In [2]: os.environ['abc'] = 'def' In [3]: os.getenv('abc') Out[3]: 'def' In [4]: os.environ['abc'] Out[4]: 'def' Simon From vernondcole at gmail.com Thu Jun 18 20:22:54 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 18 Jun 2009 12:22:54 -0600 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: <4A3A7619.80202@probo.com> References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> <4A39A24E.6080305@probo.com> <4A3A6C49.6050807@probo.com> <4A3A7619.80202@probo.com> Message-ID: Tim: Geesh! I've read that umpteen times and never groked it. I guess an important footnote of R.T.F.M. is UNDERSTAND The Fine Manual. Thanks again for your better explanation. I will use it in the book, if God and you are willing. -- Vernon On Thu, Jun 18, 2009 at 11:15 AM, Tim Roberts wrote: > Vernon Cole wrote: > > Thanks, Tim! > > > > Should this be logged against the standard library as a bug? > > Nope. It's actually the documented behavior. See section 16.1.1 here: > http://docs.python.org/library/os.html > > -- > 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 greg.ewing at canterbury.ac.nz Fri Jun 19 03:03:25 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 19 Jun 2009 13:03:25 +1200 Subject: [python-win32] regarding invoking command prompt using python In-Reply-To: <4A3A6C49.6050807@probo.com> References: <4A393BFC.4050801@probo.com> <4A397A17.9080706@probo.com> <4A39A24E.6080305@probo.com> <4A3A6C49.6050807@probo.com> Message-ID: <4A3AE3DD.50409@canterbury.ac.nz> Tim Roberts wrote: > Depending on your point of view, that's either a usage problem or a > design flaw in the "os" module. The design of the os module does seem rather screwy in this area. Since os.environ is a custom mapping type, I don't know why it doesn't just pass all get and set operations on to the real process environment instead of keeping a copy of it. It's not just Windows, btw, it seems to work the same way on Unix too. -- Greg From patrick at janssen.name Fri Jun 19 08:18:41 2009 From: patrick at janssen.name (Patrick Janssen) Date: Fri, 19 Jun 2009 14:18:41 +0800 Subject: [python-win32] dde trouble Message-ID: Hi all, I am having some trouble with controlling a Windows application through dde The application in question is Ecotect: http://usa.autodesk.com/adsk/servlet/index?id=12602821&siteID=123112 . This app provides a dde interface for scripting. The application comes bundled with Lua, and this works fine. However, for various reasons, I need to use Python, so I have been trying to get Python talking to Ecotect using Marc Hammonds very nice win32 tools. This seemed to work well, like this: import win32ui import dde server = dde.CreateServer() server.Create("TestClient") conversation = dde.CreateConversation(server) conversation.ConnectTo("Ecotect", "request") conversation.Exec("model.new") This opens up a new file in Ecotect. However, as I started to try some more commands, I found that many of the dde command strings described in the documentation are working with Lua, but not with Python / Win32. In particular, the ones that are not working seem to be the ones that return a value. For example: conversation.Exec("get.app.computer") returns an error message: Traceback (most recent call last): File "D:\Documents\Eclipse\z_test_ecotect\test1.py", line 11, in conversation.Exec("get.app.computer") error: Exec failed Any thoughts on how I might discover what is going wrong? Does anyone know how I might be able to see the dde command strings that Lua is sending to Ecotect (which all seem to work - I am thinking that there may be an error in the documentation). Regards Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From theller at ctypes.org Fri Jun 19 13:40:30 2009 From: theller at ctypes.org (Thomas Heller) Date: Fri, 19 Jun 2009 13:40:30 +0200 Subject: [python-win32] dde trouble In-Reply-To: References: Message-ID: Patrick Janssen schrieb: > Hi all, > I am having some trouble with controlling a Windows application through dde [...] > Does anyone know how I might be able to see the dde command strings that Lua > is sending to Ecotect (which all seem to work - I am thinking that there may > be an error in the documentation). The old DDESpy tool comes to mind. -- Thanks, Thomas From patrick at janssen.name Fri Jun 19 15:33:02 2009 From: patrick at janssen.name (Patrick Janssen) Date: Fri, 19 Jun 2009 21:33:02 +0800 Subject: [python-win32] dde trouble In-Reply-To: References: Message-ID: Hi Thomas, Thanks for your email. Yes - I tried that - actually, I used Spy++, which seems to be the new version. This gave some useful information, but not the actual command string. I have pasted below the results for three different operations in Lua and in Python - the third one is the one that is not working. ====================================================== 1) When the Lua script manager connects to Ecotect, I see this DDE message: <00001> 0039054A S WM_DDE_INITIATE hwnd:002404F2 aApp:C07F ("Ecotect") aTopic:C0A2 ("request") [wParam:002404F2 lParam:C0A2C07F] <00002> 0039054A R WM_DDE_INITIATE lResult:00000000 ... repeated lots of times <00241> 002404F2 S WM_DDE_ACK hwnd:000E0508 aApp:C07F ("Ecotect") aTopic:C0A2 ("request") [wParam:000E0508 lParam:C0A2C07F] <00242> 002404F2 R WM_DDE_ACK lResult:00000000 <00243> 001404BE R WM_DDE_INITIATE lResult:00000000 In Python I do this (which works fine): import win32ui import dde server = dde.CreateServer() server.Create("TestClient") conversation = dde.CreateConversation(server) conversation.ConnectTo("Ecotect", "request") And I get the almost the same DDE message: <00001> 001805CC S WM_DDE_INITIATE hwnd:00110750 aApp:C07F ("Ecotect") aTopic:C0A1 ("request") [wParam:00110750 lParam:C0A1C07F] <00002> 001805CC R WM_DDE_INITIATE lResult:00000000 ... repeated lots of times <00281> 00110750 S WM_DDE_ACK hwnd:000E0508 aApp:C07F ("Ecotect") aTopic:C0A1 ("request") [wParam:000E0508 lParam:C0A1C07F] <00282> 00110750 R WM_DDE_ACK lResult:00000000 <00283> 001404BE R WM_DDE_INITIATE lResult:00000000 ====================================================== 2) When Lua sends the command cmd("new.model"), I see the DDE message: <00304> 002C0474 P WM_DDE_EXECUTE hwnd:00230542 lPackedVal:01A304EC hCommands:01A304EC [wParam:00230542 lParam:01A304EC] <00305> 00230542 P WM_DDE_ACK hwnd:002C0474 lPackedVal:001C3668 wStatus:0000 aItem:3668 ("#13928") [wParam:002C0474 lParam:001C3668] <00306> 002C0474 P WM_DDE_EXECUTE hwnd:00230542 lPackedVal:01A304EC hCommands:01A304EC [wParam:00230542 lParam:01A304EC] <00307> 00230542 P WM_DDE_ACK hwnd:002C0474 lPackedVal:002000B0 wStatus:0000 aItem:00B0 ("#176") [wParam:002C0474 lParam:002000B0] In Python I do this (which also works fine): conversation.Exec("model.new") And I get the almost the same DDE message: <00232> 00340408 P WM_DDE_EXECUTE hwnd:001C0494 lPackedVal:01A304EC hCommands:01A304EC [wParam:001C0494 lParam:01A304EC] <00233> 001C0494 P WM_DDE_ACK hwnd:00340408 lPackedVal:00239698 wStatus:0000 aItem:9698 ("#38552") [wParam:00340408 lParam:00239698] ====================================================== 3) When Lua sends the command get("app.computer"), I see the DDE message: <00312> 002E0474 P WM_DDE_EXECUTE hwnd:002B042E lPackedVal:01A304EC hCommands:01A304EC [wParam:002B042E lParam:01A304EC] <00313> 002B042E P WM_DDE_ACK hwnd:002E0474 lPackedVal:001A8B60 wStatus:0000 aItem:8B60 ("#35680") [wParam:002E0474 lParam:001A8B60] <00314> 002E0474 P WM_DDE_EXECUTE hwnd:002B042E lPackedVal:01A304EC hCommands:01A304EC [wParam:002B042E lParam:01A304EC] <00315> 002B042E P WM_DDE_ACK hwnd:002E0474 lPackedVal:001C33A8 wStatus:0000 aItem:33A8 ("#13224") [wParam:002E0474 lParam:001C33A8] The documentation for the Lua get() command says the following: "get() Prepends 'get.' to the front of a command string, sends it to Ecotect and formats results into variables. Used for retrieving object properties." So in Python I also perpend "get." to the front of the string (but it does _NOT_ work): conversation.Exec("get.app.computer") And I get this DDE message: <00234> 00340408 P WM_DDE_EXECUTE hwnd:001C0494 lPackedVal:01A304EC hCommands:01A304EC [wParam:001C0494 lParam:01A304EC] <00235> 001C0494 P WM_DDE_ACK hwnd:00340408 lPackedVal:00236F28 wStatus:0000 aItem:6F28 ("#28456") [wParam:00340408 lParam:00236F28] ====================================================== I have tried a huge number of variants of this string - "get app.computer", "get(app.computer)", "app.computer.get" etc etc- , but no luck. >From the DDE documentation, I know the command string that Lua sends to Ecotect is stored in hCommands, but I can't figure out how to see this string... Any suggestions? Patrick 2009/6/19 Thomas Heller > Patrick Janssen schrieb: > > Hi all, > > I am having some trouble with controlling a Windows application through > dde > [...] > > Does anyone know how I might be able to see the dde command strings that > Lua > > is sending to Ecotect (which all seem to work - I am thinking that there > may > > be an error in the documentation). > > The old DDESpy tool comes to mind. > > -- > Thanks, > Thomas > > _______________________________________________ > 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 ckkart at gmail.com Sun Jun 21 10:06:06 2009 From: ckkart at gmail.com (Christian K.) Date: Sun, 21 Jun 2009 08:06:06 +0000 (UTC) Subject: [python-win32] COM sending and receiveing events Message-ID: Hi, I apologize for my ignorance about COM programming in advance. I would like to be pointed to an example of how I could send a message from a subthread of a COM server back to the main thread. Being an outlook addin, the COM server is already reacting to a couple of Outlook generated events. Now it would like to add my own simple event handling and generation code. I have looked in the win32com/demos folder and searched on that list, but I think I know too little about COM to understand that information. Regards, Christian From mail at timgolden.me.uk Mon Jun 22 10:18:44 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 22 Jun 2009 09:18:44 +0100 Subject: [python-win32] COM sending and receiveing events In-Reply-To: References: Message-ID: <4A3F3E64.1080706@timgolden.me.uk> Christian K. wrote: > Hi, > > I apologize for my ignorance about COM programming in advance. I would like to > be pointed to an example of how I could send a message from a subthread of a COM > server back to the main thread. Being an outlook addin, the COM server is > already reacting to a couple of Outlook generated events. Now it would like to > add my own simple event handling and generation code. I have looked in the > win32com/demos folder and searched on that list, but I think I know too little > about COM to understand that information. I'm not entirely clear at what level you're asking. If you want to pass an object around between threads, you'll need to marshal it up. Look in pythoncom at: http://timgolden.me.uk/pywin32-docs/pythoncom__CoMarshalInterThreadInterfaceInStream_meth.html http://timgolden.me.uk/pywin32-docs/pythoncom__CoMarshalInterface_meth.html and http://timgolden.me.uk/pywin32-docs/pythoncom__CoUnmarshalInterface_meth.html TJG From bertosmailbox at gmail.com Tue Jun 23 02:09:11 2009 From: bertosmailbox at gmail.com (Roberto Aguilar) Date: Mon, 22 Jun 2009 17:09:11 -0700 Subject: [python-win32] Building msi with python 2.6.2 In-Reply-To: <4A375AC6.3020802@gmail.com> References: <2E851D8B-D57D-43CF-9FCB-3B144921933F@gmail.com> <4A375AC6.3020802@gmail.com> Message-ID: On Jun 16, 2009, at 1:41 AM, Mark Hammond wrote: > On 16/06/2009 12:40 PM, Roberto Aguilar wrote: >> Hello everyone, >> >> I've been able to successfully build a MSI of pywin32 under Python >> 2.6.2. But, when trying to use python, e.g. "import win32api", after >> installing the MSI I get: >> >> ImportError: DLL load failed: The specified module could not be >> found. >> >> With the help of a colleague, I discovered the problem is due to >> python >> not finding pywintypes26.dll. This file was installed by the MSI. >> It's in: >> >> C:\Python26\Lib\site-packages\pywin32_system32 >> >> but that location is not being searched when importing. >> >> I can either: >> >> - set PATH=c:\Python26\Lib\site-packages\pywin32_system32;%PATH% >> - then importing win32api works fine. >> >> or >> >> - move pywintypes26.dll to c:\Python26\Lib\site-packages\win32 >> - then importing win32api works fine. > > Or arrange to execute 'pywin32-postinstall.py -install' at the end > of the install, which will copy those files somewhere suitable > (either system32, or to the python dir). > > I'd be happy to make that script friendlier for MSI if necessary > (and hopefully you will contribute the MSI process back to pywin32 ;) Thanks for the tip, Mark. I discovered that pywin32_postinstall.py was being run during the bdist_msi command and it would error out when run during the msi installation. Turns out that the MSI installer does not pass the -install argument. Instead it just runs the command with no arguments, which was simply printing out the usage. I removed running it for bdist_msi command since it should only run when actually installing the msi. To fix the msi installation part, I generate an msi-specific pywin32- postinstall script (pywin32_msi_postinstall.py) which simply replaces the contents of if __name__ == '__main__' with install(). That file is then added to the MSI package. There might be a better approach to this, but I'm attaching a patch with my changes in case they are useful. Thanks, -berto. -------------- next part -------------- A non-text attachment was scrubbed... Name: pywin32_setup.patch Type: application/octet-stream Size: 2390 bytes Desc: not available URL: -------------- next part -------------- From mhammond at skippinet.com.au Tue Jun 23 02:18:08 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 23 Jun 2009 10:18:08 +1000 Subject: [python-win32] Building msi with python 2.6.2 In-Reply-To: References: <2E851D8B-D57D-43CF-9FCB-3B144921933F@gmail.com> <4A375AC6.3020802@gmail.com> Message-ID: <4A401F40.6020205@skippinet.com.au> On 23/06/2009 10:09 AM, Roberto Aguilar wrote: > To fix the msi installation part, I generate an msi-specific > pywin32-postinstall script (pywin32_msi_postinstall.py) which simply > replaces the contents of if __name__ == '__main__' with install(). That > file is then added to the MSI package. I've got no problem with changing the script to 'install' by default, so long as it kept all the other existing behaviour and options, particularly printing usage if an 'unknown' option, like --help, is used. '-install' should still be supported even if pywin32's setup.py no longer provides it. That would make for a much cleaner change IMO. If you can knock up a patch like that which works for you, please send it my way.... Cheers, Mark From guy at rzn.co.il Mon Jun 22 10:52:04 2009 From: guy at rzn.co.il (Guy Rozendorn) Date: Mon, 22 Jun 2009 11:52:04 +0300 Subject: [python-win32] python and wow64 filesystem redirection Message-ID: <843870680906220152v5ab5ffd6h4a22c3598630a6ee@mail.gmail.com> Hi all, I have (2003/2008) x64 systems with 32bit python installed, and my code needs access to %SystemRoot%\system32, but the wow64 filesystem redirection thing is in my way. I looked from the *Wow64DisableWow64FsRedirection *function in the win32 extensions, but I can't find it. So, my question is, if that function is implemented in the extensions at all? is there another way to disable the redirection in python? or do I need to write a binary module that disables/enables the redirection? Thanks in advance, Guy -------------- next part -------------- An HTML attachment was scrubbed... URL: From cso at giritech.com Tue Jun 23 11:56:07 2009 From: cso at giritech.com (=?iso-8859-1?Q?Christian_S=F8rensen?=) Date: Tue, 23 Jun 2009 11:56:07 +0200 Subject: [python-win32] FW: Problem with winxpgui Message-ID: <36B964E5D39FAD40AE29FD21BAF6CDC401268DFA@dudley.giritech.com> -----Original Message----- From: Christian S?rensen Sent: 23. juni 2009 10:18 To: 'Mark Hammond' Subject: RE: [python-win32] Problem with winxpgui Yep! Worked out nicely. So for the record here is what we did: 1) Go the folder with the python executable. 2) Create a file called python.exe.manifest with this content: 3) Use the mt.exe tool like this: Note: This rewrites the python.exe manifest - so be careful. mt.exe -outputresource:python.exe -manifest python.exe.manifest Thank you for your time, it is very much appreciated. Christian -----Original Message----- From: Mark Hammond [mailto:mhammond at skippinet.com.au] Sent: 20. juni 2009 00:50 To: Christian S?rensen Subject: RE: [python-win32] Problem with winxpgui The simplest solution is probably to simply use something like the MS "manifest tool" (mt.exe) to hack the manifest in your copy of python.exe (or whatever exe it is you intend using - eg, a py2exe based one...) Cheers, Mark > -----Original Message----- > From: Christian S?rensen [mailto:cso at giritech.com] > Sent: Friday, 19 June 2009 6:05 PM > To: mhammond at skippinet.com.au > Subject: RE: [python-win32] Problem with winxpgui > > > Hi again and thank you for answering > > I am getting some help from my colleague in trying to figure this out. > So here is what we have come up with so far. We are using py2exe to > pack the python code and have tried adding a manifest info to the > setup.py file used for that. This is the info we added: > > manifest_template = """ > manifestVersion="1.0"> > > > > uiAccess="false"> > > > > > > publicKeyToken="6595b64144ccf1df" language="*"> > > > > > version="9.0.21022.8" processorArchitecture="x86" > publicKeyToken="1fc8b3b9a1e18e3b"> > > > > """ > > The important part here as I am sure you already know, is the > dependency including Microsoft.Window.Common-Controls. This works for > the executable that is coming out of running py2exe on our code. > However it does not help us much when running the code directly using > python and we have some tests that we would like to run that way. > > So any help in getting a change into the python executable would be > great. We are absolutely willing to try whatever you point us to. I am > sure we have enough programming skills to give it a go. > > Greetings, > > Christian From cso at giritech.com Tue Jun 23 11:54:58 2009 From: cso at giritech.com (=?iso-8859-1?Q?Christian_S=F8rensen?=) Date: Tue, 23 Jun 2009 11:54:58 +0200 Subject: [python-win32] FW: Problem with winxpgui Message-ID: <36B964E5D39FAD40AE29FD21BAF6CDC401268DF9@dudley.giritech.com> -----Original Message----- From: Mark Hammond [mailto:mhammond at skippinet.com.au] Sent: 23. juni 2009 11:53 To: Christian S?rensen Subject: Re: [python-win32] Problem with winxpgui On 23/06/2009 5:31 PM, Christian S?rensen wrote: > However. Does this mean we will have to do that every time there is an update to the python.exe? Do you know if there are any plans of making this change to the python executable for the official release? I don't. > Should we post this discussion to the mailing list in case someone else has the same problem? You should :) Cheers, Mark > > Greetings and thanks again > > Christian > > > -----Original Message----- > From: Mark Hammond [mailto:mhammond at skippinet.com.au] > Sent: 20. juni 2009 00:50 > To: Christian S?rensen > Subject: RE: [python-win32] Problem with winxpgui > > The simplest solution is probably to simply use something like the MS > "manifest tool" (mt.exe) to hack the manifest in your copy of python.exe (or > whatever exe it is you intend using - eg, a py2exe based one...) > > Cheers, > > Mark > > >> -----Original Message----- >> From: Christian S?rensen [mailto:cso at giritech.com] >> Sent: Friday, 19 June 2009 6:05 PM >> To: mhammond at skippinet.com.au >> Subject: RE: [python-win32] Problem with winxpgui >> >> >> Hi again and thank you for answering >> >> I am getting some help from my colleague in trying to figure this out. >> So here is what we have come up with so far. We are using py2exe to >> pack the python code and have tried adding a manifest info to the >> setup.py file used for that. This is the info we added: >> >> manifest_template = """ >> > manifestVersion="1.0"> >> >> >> >> > uiAccess="false"> >> >> >> >> >> >> > publicKeyToken="6595b64144ccf1df" language="*"> >> >> >> >> >> > version="9.0.21022.8" processorArchitecture="x86" >> publicKeyToken="1fc8b3b9a1e18e3b"> >> >> >> >> """ >> >> The important part here as I am sure you already know, is the >> dependency including Microsoft.Window.Common-Controls. This works for >> the executable that is coming out of running py2exe on our code. >> However it does not help us much when running the code directly using >> python and we have some tests that we would like to run that way. >> >> So any help in getting a change into the python executable would be >> great. We are absolutely willing to try whatever you point us to. I am >> sure we have enough programming skills to give it a go. >> >> Greetings, >> >> Christian > > From mdriscoll at co.marshall.ia.us Tue Jun 23 17:47:22 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 23 Jun 2009 10:47:22 -0500 Subject: [python-win32] python and wow64 filesystem redirection In-Reply-To: <843870680906220152v5ab5ffd6h4a22c3598630a6ee@mail.gmail.com> References: <843870680906220152v5ab5ffd6h4a22c3598630a6ee@mail.gmail.com> Message-ID: <4A40F90A.9020209@co.marshall.ia.us> Guy, > Hi all, > > I have (2003/2008) x64 systems with 32bit python installed, and my > code needs access to %SystemRoot%\system32, but the wow64 filesystem > redirection thing is in my way. > I looked from the *Wow64DisableWow64FsRedirection *function in the > win32 extensions, but I can't find it. > > So, my question is, if that function is implemented in the extensions > at all? is there another way to disable the redirection in python? or > do I need to write a binary module that disables/enables the redirection? > > > Thanks in advance, > Guy > The usual answer is that if PyWin32 doesn't wrap it, do it with ctypes. Sometimes Roger or one of the others has some special way of accomplishing the task though... - Mike From timr at probo.com Tue Jun 23 22:44:24 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 23 Jun 2009 13:44:24 -0700 Subject: [python-win32] python and wow64 filesystem redirection In-Reply-To: <4A40F90A.9020209@co.marshall.ia.us> References: <843870680906220152v5ab5ffd6h4a22c3598630a6ee@mail.gmail.com> <4A40F90A.9020209@co.marshall.ia.us> Message-ID: <4A413EA8.1090403@probo.com> Mike Driscoll wrote: > Guy, >> Hi all, >> >> I have (2003/2008) x64 systems with 32bit python installed, and my >> code needs access to %SystemRoot%\system32, but the wow64 filesystem >> redirection thing is in my way. >> I looked from the *Wow64DisableWow64FsRedirection *function in the >> win32 extensions, but I can't find it. >> >> So, my question is, if that function is implemented in the extensions >> at all? is there another way to disable the redirection in python? or >> do I need to write a binary module that disables/enables the >> redirection? >> >> >> Thanks in advance, >> Guy >> > > The usual answer is that if PyWin32 doesn't wrap it, do it with > ctypes. Sometimes Roger or one of the others has some special way of > accomplishing the task though... I use this: import ctypes k32 = ctypes.windll.kernel32 wow64 = ctypes.c_long( 0 ) k32.Wow64DisableWow64FsRedirection( ctypes.byref(wow64) ) # ... do stuff ... k32.Wow64EnableWow64FsRedirection( wow64 ) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From c-b at asu.edu Wed Jun 24 01:06:36 2009 From: c-b at asu.edu (Christopher Brown) Date: Tue, 23 Jun 2009 16:06:36 -0700 Subject: [python-win32] Active-X control Message-ID: <4A415FFC.5080600@asu.edu> Hi List, I am using windows xp, python 2.5.4, with build 213 of pywin32. I am brand new to pywin32, and I have gathered some info from various web searches on how to use the library. I'm clearly doing something wrong. I am in the process of switching from Matlab to Python, and one thing I need to do is to use an ocx library to control some hardware. Here is how I do it in matlab, which works just fine: >> h_pa5 = actxcontrol('PA5.x',[1 1 1 1]) h_pa5 = COM.PA5_x >> pa5ret = invoke(h_pa5,'ConnectPA5','USB',1) pa5ret = 1 >> invoke(h_pa5, 'SetAtten', 10) ans = 1 >> ...With python-win32, I seem to be able to connect to the library, but I can't issue any commands: >>> import win32com.client >>> axPA5 = win32com.client.Dispatch("PA5.X") >>> axPA5 >>> axPA5.ConnectPA5('USB',1) Traceback (most recent call last): com_error: (-2147418113, 'Catastrophic failure', None, None) >>> What am I doing wrong? -- Christopher Brown, Ph.D. Department of Speech and Hearing Science Arizona State University From timr at probo.com Wed Jun 24 02:42:31 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 23 Jun 2009 17:42:31 -0700 Subject: [python-win32] Active-X control In-Reply-To: <4A415FFC.5080600@asu.edu> References: <4A415FFC.5080600@asu.edu> Message-ID: <4A417677.5090404@probo.com> Christopher Brown wrote: > > I am using windows xp, python 2.5.4, with build 213 of pywin32. I am > brand new to pywin32, and I have gathered some info from various web > searches on how to use the library. I'm clearly doing something wrong. > > I am in the process of switching from Matlab to Python, and one thing > I need to do is to use an ocx library to control some hardware. Here > is how I do it in matlab, which works just fine: > > >> h_pa5 = actxcontrol('PA5.x',[1 1 1 1]) > ... > > ...With python-win32, I seem to be able to connect to the library, but > I can't issue any commands: > > >>> import win32com.client > >>> axPA5 = win32com.client.Dispatch("PA5.X") > >>> axPA5 > > >>> axPA5.ConnectPA5('USB',1) > Traceback (most recent call last): > com_error: (-2147418113, 'Catastrophic failure', None, None) > >>> > > What am I doing wrong? -2147418113 is 0x8000ffff, which is E_UNEXPECTED. That doesn't help very much. The second parameter to actxcontrol are screen coordinates. Some ActiveX controls expect to be installed as components in a GUI. Your Python example doesn't set up a GUI. Does it work in Matlab if you omit the coordinates, like this? h_pa5 = actxcontrol('PA5.x') If not, then you have more work ahead of you. You'll have to create a window and a message loop using one of the Python GUI toolkits. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kxroberto at googlemail.com Wed Jun 24 16:19:02 2009 From: kxroberto at googlemail.com (Robert) Date: Wed, 24 Jun 2009 16:19:02 +0200 Subject: [python-win32] SetSystemTime: A required privilege is not held by the client In-Reply-To: <480612DD.3010501@timgolden.me.uk> References: <480612DD.3010501@timgolden.me.uk> Message-ID: Tim Golden wrote: > Robert wrote: >> SetSystemTime on Vista admin account throws: >> >> (1314, 'SetSystemTime', 'A required privilege is not held by >> the client.') >> >> >> Not known from previous Windows versions. >> With what switch or whatever can this be enabled? > > According to the docs: > (warning: URL will self-destruct in two months) > > http://msdn2.microsoft.com/en-us/library/ms724942(VS.85).aspx > > this operation automatically enables the SE_SYSTEMTIME_NAME priv > which is disabled by default. But if your user doesn't *have* the > priv to start with, it won't be enabled and you'll get the error message > above. > > I don't run Vista, but I assume it has some kind of user-management > user interface? Find whatever bit of that deals with privileges (*not* groups) > and add this priv to the user in question. > does anybody with Vista know if there is a UI tool for setting this SE_SYSTEMTIME_NAME privilege in an account - how ? Robert From mail at timgolden.me.uk Wed Jun 24 16:31:44 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 24 Jun 2009 15:31:44 +0100 Subject: [python-win32] SetSystemTime: A required privilege is not held by the client In-Reply-To: References: <480612DD.3010501@timgolden.me.uk> Message-ID: <4A4238D0.1030607@timgolden.me.uk> Robert wrote: > Tim Golden wrote: >> Robert wrote: >>> SetSystemTime on Vista admin account throws: >>> >>> (1314, 'SetSystemTime', 'A required privilege is not held by >>> the client.') >>> >>> >>> Not known from previous Windows versions. >>> With what switch or whatever can this be enabled? >> >> According to the docs: >> (warning: URL will self-destruct in two months) >> >> http://msdn2.microsoft.com/en-us/library/ms724942(VS.85).aspx >> >> this operation automatically enables the SE_SYSTEMTIME_NAME priv >> which is disabled by default. But if your user doesn't *have* the >> priv to start with, it won't be enabled and you'll get the error message >> above. >> >> I don't run Vista, but I assume it has some kind of user-management >> user interface? Find whatever bit of that deals with privileges (*not* >> groups) >> and add this priv to the user in question. >> > > does anybody with Vista know if there is a UI tool for setting this > SE_SYSTEMTIME_NAME privilege in an account - how ? (Goodness, that reply took a long time to come through :) ) Try Start > Run > secpol.msc - that works on XP TJG From ahz001 at gmail.com Fri Jun 26 06:02:34 2009 From: ahz001 at gmail.com (Andrew Ziem) Date: Thu, 25 Jun 2009 22:02:34 -0600 Subject: [python-win32] Finding the PID of open files Message-ID: I'm looking for a painless way to find the process ID that locks a file in Python for my open source project with these specs: * Runs as non-administrator * Covers processes/files owned by the current user (I don't care about service accounts, etc.) * Installs as administrator or not (I don't care) Tim Golden's code[1] is close, but it lists fewer files than Mark Russinovich's handle.exe: for example, index.dat is not listed. I am not a Win32 guru. ;) Any suggestions? Andrew [1] Tim's code: http://code.google.com/p/winsys/source/browse/trunk/random/file_handles.py My tweaks: http://pastebin.com/f2210f2b From gklein at xs4all.nl Sun Jun 28 14:10:11 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Sun, 28 Jun 2009 14:10:11 +0200 Subject: [python-win32] Shell extension debugging Message-ID: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> Hi, I am trying to write a shell context menu handler, based on the example I found in Lib\site-packages\win32comext\shell\demos\servers. My ultimate goal is to have a single top-level menu, with a number of submenu entries determined at runtime. (I want to make a launcher for command prompts, so I can open a command prompt at a given directory with appropriate settings for python: path, C compiler, etc.) Anyway, I have noticed that once I register the shell extension, unregistering, changing the code, and reregistering doesn't work: I get the old code. On top of that, I have managed to mess up the code so the message box no longer appears when I click the menu item. I need to find a way to debug my code! So, two questions: 1) Is it possible to completely unload the shell extension, so that registering it again gets me the newer version? I'd rather not reboot after every code change. 2) I see print statements in the source code, but I have no idea where they go; I checked the event log, but they are not there. Are they logged anywhere? If not, why are they there to begin with? Any other tip on how to effectively debug this stuff would be most welcome as well. Regards, Gertjan. From mvilas at gmail.com Sun Jun 28 19:12:57 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Sun, 28 Jun 2009 14:12:57 -0300 Subject: [python-win32] Shell extension debugging In-Reply-To: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> Message-ID: <3fbf862f0906281012r42eb6c20mba27051dc4ce5251@mail.gmail.com> Did you try killing all instances of explorer.exe instead of rebooting? That might do the trick and it's faster. On Sun, Jun 28, 2009 at 9:10 AM, Gertjan Klein wrote: > Hi, > > I am trying to write a shell context menu handler, based on the example > I found in Lib\site-packages\win32comext\shell\demos\servers. My > ultimate goal is to have a single top-level menu, with a number of > submenu entries determined at runtime. (I want to make a launcher for > command prompts, so I can open a command prompt at a given directory > with appropriate settings for python: path, C compiler, etc.) > > Anyway, I have noticed that once I register the shell extension, > unregistering, changing the code, and reregistering doesn't work: I get > the old code. On top of that, I have managed to mess up the code so the > message box no longer appears when I click the menu item. I need to find > a way to debug my code! > > So, two questions: > > 1) Is it possible to completely unload the shell extension, so that > registering it again gets me the newer version? I'd rather not reboot > after every code change. > > 2) I see print statements in the source code, but I have no idea where > they go; I checked the event log, but they are not there. Are they > logged anywhere? If not, why are they there to begin with? > > Any other tip on how to effectively debug this stuff would be most > welcome as well. > > Regards, > Gertjan. > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- HONEY: I want to? put some powder on my nose. GEORGE: Martha, won?t you show her where we keep the euphemism? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gklein at xs4all.nl Mon Jun 29 17:26:52 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Mon, 29 Jun 2009 17:26:52 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <3fbf862f0906281012r42eb6c20mba27051dc4ce5251@mail.gmail.com> Message-ID: <04nh45tgmoblit01n922m6dv2j6qm01fjf@4ax.com> Mario Alejandro Vilas Jerez wrote: >Did you try killing all instances of explorer.exe instead of rebooting? That >might do the trick and it's faster. I've checked with Process Explorer, but even if I use the Windows Explorer setting "Launch folder windows in a separate process" there is still only one explorer.exe visible, which is at the root of everything I have open. I wouldn't want to kill that one... Gertjan. From timr at probo.com Mon Jun 29 19:23:00 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 29 Jun 2009 10:23:00 -0700 Subject: [python-win32] Shell extension debugging In-Reply-To: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> Message-ID: <4A48F874.80206@probo.com> Gertjan Klein wrote: > I am trying to write a shell context menu handler, based on the example > I found in Lib\site-packages\win32comext\shell\demos\servers. My > ultimate goal is to have a single top-level menu, with a number of > submenu entries determined at runtime. (I want to make a launcher for > command prompts, so I can open a command prompt at a given directory > with appropriate settings for python: path, C compiler, etc.) > Interesting! I wrote basically that same extension (in C++) about 5 years ago. It is incredibly handy. It lets me gather my applications into folders on the desktop, and launch using right-clicks without wading through the Start menu. I have all of my compiler shells in one folder, all of my DDK shells in another folder, all of my SSH connections in a third, and all of the Office apps in a fourth. > Anyway, I have noticed that once I register the shell extension, > unregistering, changing the code, and reregistering doesn't work: I get > the old code. On top of that, I have managed to mess up the code so the > message box no longer appears when I click the menu item. I need to find > a way to debug my code! > > So, two questions: > > 1) Is it possible to completely unload the shell extension, so that > registering it again gets me the newer version? I'd rather not reboot > after every code change. > Yes, it is possible, but you have to restart the root Windows Explorer shell. You can bring up the Task Manager and kill the Explorer process. All of your icons and your start bar will briefly disappear, but Windows is stubborn and will immediately restart it. > 2) I see print statements in the source code, but I have no idea where > they go; I checked the event log, but they are not there. Are they > logged anywhere? If not, why are they there to begin with? > > Any other tip on how to effectively debug this stuff would be most > welcome as well. > The print statements go into empty space because there is no stdout for that process. You can try using the logging module to log to a file, or you can use ctypes to write to kernel32.OutputDebugString and using a kernel debug log monitor to read them. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Jun 29 19:24:15 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 29 Jun 2009 10:24:15 -0700 Subject: [python-win32] Shell extension debugging In-Reply-To: <04nh45tgmoblit01n922m6dv2j6qm01fjf@4ax.com> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <3fbf862f0906281012r42eb6c20mba27051dc4ce5251@mail.gmail.com> <04nh45tgmoblit01n922m6dv2j6qm01fjf@4ax.com> Message-ID: <4A48F8BF.9080306@probo.com> Gertjan Klein wrote: > I've checked with Process Explorer, but even if I use the Windows > Explorer setting "Launch folder windows in a separate process" there is > still only one explorer.exe visible, which is at the root of everything > I have open. I wouldn't want to kill that one... > That's exactly what you want to do. It's perfectly safe. The kernel monitors that process and restarts it when it dies. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kevin.horn at gmail.com Mon Jun 29 19:36:04 2009 From: kevin.horn at gmail.com (Kevin Horn) Date: Mon, 29 Jun 2009 12:36:04 -0500 Subject: [python-win32] Shell extension debugging In-Reply-To: <4A48F8BF.9080306@probo.com> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <3fbf862f0906281012r42eb6c20mba27051dc4ce5251@mail.gmail.com> <04nh45tgmoblit01n922m6dv2j6qm01fjf@4ax.com> <4A48F8BF.9080306@probo.com> Message-ID: <562bcc10906291036v50d8ba70h1b4ca6342ab1c8bf@mail.gmail.com> Just an aside on restarting explorer... In case explorer doesn't restart automatically, you can easily start it up again manually from the task manager (which you should have open from killing the process). File->NewTask, then type explorer. I'm sure this isn't news to most people here, but I'm often surprised by ppl not knowing this trick. Kevin Horn On Mon, Jun 29, 2009 at 12:24 PM, Tim Roberts wrote: > Gertjan Klein wrote: > > I've checked with Process Explorer, but even if I use the Windows > > Explorer setting "Launch folder windows in a separate process" there is > > still only one explorer.exe visible, which is at the root of everything > > I have open. I wouldn't want to kill that one... > > > > That's exactly what you want to do. It's perfectly safe. The kernel > monitors that process and restarts it when it dies. > > -- > 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 gklein at xs4all.nl Mon Jun 29 20:06:15 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Mon, 29 Jun 2009 20:06:15 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <3fbf862f0906281012r42eb6c20mba27051dc4ce5251@mail.gmail.com> <04nh45tgmoblit01n922m6dv2j6qm01fjf@4ax.com> <4A48F8BF.9080306@probo.com> <562bcc10906291036v50d8ba70h1b4ca6342ab1c8bf@mail.gmail.com> Message-ID: Kevin Horn wrote: >In case explorer doesn't restart automatically, you can easily start it up >again manually from the task manager (which you should have open from >killing the process). Thanks, that tip just saved me! If I kill explorer.exe from task manager, my taskbar and desktop icons disappear, but they don't reappear automatically, I just tried. (This is on Windows XP SP3 btw.) I wouldn't have thought of using File -> New Task to fix that. It even filled in "c:\windows\explorer.exe" for me, so I just had to click OK. Thanks, Gertjan. From gklein at xs4all.nl Mon Jun 29 20:17:57 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Mon, 29 Jun 2009 20:17:57 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: Tim Roberts wrote: >Gertjan Klein wrote: >>(I want to make a launcher for >> command prompts, so I can open a command prompt at a given directory >> with appropriate settings for python: path, C compiler, etc.) > >Interesting! I wrote basically that same extension (in C++) about 5 >years ago. I have been thinking about trying this for years now. ;-) There is not much information on how to do this with Python out there, which has stopped me so far. (Or perhaps my Google skills just failed me.) >> 1) Is it possible to completely unload the shell extension, so that >> registering it again gets me the newer version? I'd rather not reboot >> after every code change. > >Yes, it is possible, but you have to restart the root Windows Explorer >shell. You can bring up the Task Manager and kill the Explorer >process. All of your icons and your start bar will briefly disappear, >but Windows is stubborn and will immediately restart it. It doesn't over here, but another poster has shown me how to circumvent this. If this is the only way to do that I will; there is no way to tell PyWin32 to reload the extension? (I know reloading in Python is tough, I'm expecting a "no" here. ;-)) >> 2) I see print statements in the source code, but I have no idea where >> they go; I checked the event log, but they are not there. Are they >> logged anywhere? If not, why are they there to begin with? >> >> Any other tip on how to effectively debug this stuff would be most >> welcome as well. > >The print statements go into empty space because there is no stdout for >that process. You can try using the logging module to log to a file, or >you can use ctypes to write to kernel32.OutputDebugString and using a >kernel debug log monitor to read them. The logging module reminds me of Java too much. :( I think I'll try to write to a file, I have no idea if I have a kernel debug log monitor. I read somewhere that debugging a C++ shell extension is possible under Visual Studio; can I assume that something like that is not viable when using Python / PyWin32? Thanks, Gertjan. From timr at probo.com Mon Jun 29 21:09:21 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 29 Jun 2009 12:09:21 -0700 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: <4A491161.9020609@probo.com> Gertjan Klein wrote: > It doesn't over here, but another poster has shown me how to circumvent > this. If this is the only way to do that I will; there is no way to tell > PyWin32 to reload the extension? (I know reloading in Python is tough, > I'm expecting a "no" here. ;-)) > I was going to respond "no" immediately, but now you've got me thinking. Explorer loads the DLL, instantiates the COM object, and keeps it loaded forever. I think that fact alone makes it impossible; even if you added a backdoor to reload the module, you still have an object in memory using the original implementation. > The logging module reminds me of Java too much. :( I think I'll try to > write to a file, I have no idea if I have a kernel debug log monitor. > Oh, don't be afraid of the logging module. Logging to stderr is as simple as: >>> import logging >>> logging.basicConfig( level=logging.INFO ) >>> logging.info( "This is an info message" ) INFO:root:This is an info message To send to a file instead: import logging logging.basicConfig( filename='/tmp/mylog.txt', level=logging.INFO ) logging.info( "This is an info message" ) The logging module does have a billion features, and you might want to use some of those to add a timestamp to them, but once you have gone to the trouble of adding logging calls throughout your app, tweaking the formatting and the framework is trivial. > I read somewhere that debugging a C++ shell extension is possible under > Visual Studio; can I assume that something like that is not viable when > using Python / PyWin32? > I would be very surprised. You need to be able to attach to an existing process, and I don't know of any Python debuggers that can do that. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From randy at rcs-comp.com Mon Jun 29 21:37:43 2009 From: randy at rcs-comp.com (Randy Syring) Date: Mon, 29 Jun 2009 15:37:43 -0400 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: <4A491807.8050809@rcs-comp.com> Gertjan Klein wrote: > Tim Roberts wrote: > > >> Gertjan Klein wrote: >> >>> (I want to make a launcher for >>> command prompts, so I can open a command prompt at a given directory >>> with appropriate settings for python: path, C compiler, etc.) >>> Maybe I am missing something, but I use the "Open Command Window Here" power toy from: http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx -------------------------------------- Randy Syring RCS Computers & Web Solutions 502-644-4776 http://www.rcs-comp.com "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 From vernondcole at gmail.com Mon Jun 29 23:02:14 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 29 Jun 2009 15:02:14 -0600 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: On Mon, Jun 29, 2009 at 12:17 PM, Gertjan Klein wrote: > Tim Roberts wrote: > > >Gertjan Klein wrote: > >> 2) I see print statements in the source code, but I have no idea where > >> they go; I checked the event log, but they are not there. Are they > >> logged anywhere? If not, why are they there to begin with? > >> > >> Any other tip on how to effectively debug this stuff would be most > >> welcome as well. > > > >The print statements go into empty space because there is no stdout for > >that process. You can try using the logging module to log to a file, or > >you can use ctypes to write to kernel32.OutputDebugString and using a > >kernel debug log monitor to read them. > > The logging module reminds me of Java too much. :( I think I'll try to > write to a file, I have no idea if I have a kernel debug log monitor. > > > sys.stdout works like a normal Python file, so you should be able to assign a new file object to it. You might try something like: -------------- >>> x = open('x.txt','w') >>> import sys >>> sys.stdout = x >>> print 'hello, world' >>> exit() C:\Users\vernon>type x.txt hello, world ----------- For debugging, you may want to add sys.stderr = x as well. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From siddhartha.veedaluru at gmail.com Tue Jun 30 10:05:22 2009 From: siddhartha.veedaluru at gmail.com (siddhartha veedaluru) Date: Tue, 30 Jun 2009 13:35:22 +0530 Subject: [python-win32] Permission denied erro while copying file from remote machine to local using win32wnet.WnetAddConnection Message-ID: <424b71ec0906300105n18a88498s58983533d1fe3140@mail.gmail.com> Hi, I have used the following code snippet to copy files or folder from remote machine to local machine. I have used the same method to copy files to remote machine. Can some one point me to solve this? Or Help needed to copy files or folders from remote machne ot lcoal one and also remote to remote copy if possible. thanks Siddhartha -------------------------------------------------------------------- def netToLocalCopy(hostName, userName, password, source, destPath, move=False): "Copies files or directories from a remote computer to local machine." #Establish the connection to remote machine wnet_connect(hostName, userName, password) # Get the UNC Path of the Destination Path src_dir = convert_unc(hostName, source) # Pad a backslash to the destination directory if not provided. if not destPath[len(destPath) - 1] == '\\': destPath = ''.join([destPath, '\\']) mesg = "Copying %s to %s Destination Directory on local host" % (src_dir, destPath) print mesg # Create the destination dir if its not there. if not os.path.exists(destPath): os.makedirs(destPath) else: # Create a directory anyway if file exists so as to raise an error. if not os.path.isdir(destPath): os.makedirs(destPath) print os.listdir(src_dir) try: if move: shutil.move(src_dir, destPath) else: shutil.copy(src_dir, destPath) except OSError, erno: print erno print sys.exc_info() return 1 return 0 ------------------------------------------------------------------------------------------------------- shutil.copy(src_dir, destPath) File "C:\Python25\lib\shutil.py", line 80, in copy copyfile(src, dst) File "C:\Python25\lib\shutil.py", line 46, in copyfile fsrc = open(src, 'rb') IOError: [Errno 13] Permission denied: '\\\\test7\\G$\\Test Lib' -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue Jun 30 14:41:25 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 30 Jun 2009 13:41:25 +0100 Subject: [python-win32] Permission denied erro while copying file from remote machine to local using win32wnet.WnetAddConnection In-Reply-To: <424b71ec0906300105n18a88498s58983533d1fe3140@mail.gmail.com> References: <424b71ec0906300105n18a88498s58983533d1fe3140@mail.gmail.com> Message-ID: <4A4A07F5.60401@timgolden.me.uk> siddhartha veedaluru wrote: > Hi, > > I have used the following code snippet to copy files or folder from remote > machine to local machine. > I have used the same method to copy files to remote machine. > > Can some one point me to solve this? Am I missing something? Or can't you just catch the permission denied error and ignore it? Or connect via a user which *has* the right permissions? TJG From theller at ctypes.org Tue Jun 30 14:47:21 2009 From: theller at ctypes.org (Thomas Heller) Date: Tue, 30 Jun 2009 14:47:21 +0200 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: Gertjan Klein schrieb: >>> 2) I see print statements in the source code, but I have no idea where >>> they go; I checked the event log, but they are not there. Are they >>> logged anywhere? If not, why are they there to begin with? >>> >>> Any other tip on how to effectively debug this stuff would be most >>> welcome as well. >> >>The print statements go into empty space because there is no stdout for >>that process. You can try using the logging module to log to a file, or >>you can use ctypes to write to kernel32.OutputDebugString and using a >>kernel debug log monitor to read them. > > The logging module reminds me of Java too much. :( I think I'll try to > write to a file, I have no idea if I have a kernel debug log monitor. For stuff like this you should look around at the sysinternals site. They have a DebugView utility that displays these log strings. ProcessExplorer is also a very nice and useful replacement or addition for the task manager. Thomas From mail at timgolden.me.uk Tue Jun 30 14:54:07 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 30 Jun 2009 13:54:07 +0100 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: <4A4A0AEF.4070008@timgolden.me.uk> Thomas Heller wrote: > Gertjan Klein schrieb: >>>> 2) I see print statements in the source code, but I have no idea where >>>> they go; I checked the event log, but they are not there. Are they >>>> logged anywhere? If not, why are they there to begin with? >>>> >>>> Any other tip on how to effectively debug this stuff would be most >>>> welcome as well. >>> The print statements go into empty space because there is no stdout for >>> that process. You can try using the logging module to log to a file, or >>> you can use ctypes to write to kernel32.OutputDebugString and using a >>> kernel debug log monitor to read them. >> The logging module reminds me of Java too much. :( I think I'll try to >> write to a file, I have no idea if I have a kernel debug log monitor. > > For stuff like this you should look around at the sysinternals site. They have > a DebugView utility that displays these log strings. ProcessExplorer is also > a very nice and useful replacement or addition for the task manager. I second the sysinternals visit. But just in case you fancy the exercise, you can use Python to trap OutputDebugString calls: http://timgolden.me.uk/python/win32_how_do_i/capture-OutputDebugString.html TJG From mail at timgolden.me.uk Tue Jun 30 14:57:30 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 30 Jun 2009 13:57:30 +0100 Subject: [python-win32] Shell extension debugging In-Reply-To: <4A4A0AEF.4070008@timgolden.me.uk> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A4A0AEF.4070008@timgolden.me.uk> Message-ID: <4A4A0BBA.3010302@timgolden.me.uk> Tim Golden wrote: > Thomas Heller wrote: >> Gertjan Klein schrieb: >>>>> 2) I see print statements in the source code, but I have no idea where >>>>> they go; I checked the event log, but they are not there. Are they >>>>> logged anywhere? If not, why are they there to begin with? >>>>> >>>>> Any other tip on how to effectively debug this stuff would be most >>>>> welcome as well. >>>> The print statements go into empty space because there is no stdout for >>>> that process. You can try using the logging module to log to a >>>> file, or >>>> you can use ctypes to write to kernel32.OutputDebugString and using a >>>> kernel debug log monitor to read them. >>> The logging module reminds me of Java too much. :( I think I'll try to >>> write to a file, I have no idea if I have a kernel debug log monitor. >> >> For stuff like this you should look around at the sysinternals site. >> They have >> a DebugView utility that displays these log strings. ProcessExplorer >> is also >> a very nice and useful replacement or addition for the task manager. > > I second the sysinternals visit. But just in case you fancy the > exercise, you can use Python to trap OutputDebugString calls: > > http://timgolden.me.uk/python/win32_how_do_i/capture-OutputDebugString.html And also the win32traceutil facility which comes with the pywin32 extensions can help you out here. If you import win32traceutil in any module, sys.stdout (and maybe stderr) is redirected to a pipe which is picked up by running the win32traceutil module as a script: python -mwin32traceutil Insanely helpful when you're trying to debug, an ISAPI extension module. TJG From p.f.moore at gmail.com Tue Jun 30 15:40:56 2009 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 30 Jun 2009 14:40:56 +0100 Subject: [python-win32] pywin32 for Python 3.1 Message-ID: <79990c6b0906300640q121dce98k43d45a40cd004078@mail.gmail.com> Will the pywin32-213.win32-py3.0.exe binary available from SF work for Python 3.1 (I suspect the answer is "no" :-() If not,is there an ETA for a Python 3.1 build? Now that 3.1 is out, I'm seriously considering switching my default Python to be Python 3, and pywin32 is one of the key things I need. Thanks, Paul. From gklein at xs4all.nl Tue Jun 30 16:10:06 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 16:10:06 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491161.9020609@probo.com> Message-ID: <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> Tim Roberts wrote: >I was going to respond "no" immediately, but now you've got me >thinking. Explorer loads the DLL, instantiates the COM object, and >keeps it loaded forever. I think that fact alone makes it impossible; >even if you added a backdoor to reload the module, you still have an >object in memory using the original implementation. Ah, but this is what confuses me. I don't have a DLL: I have a .py file, which gets interpreted by python. The DDLs that get loaded are python25.dll and two pywin32 dlls (don't remember offhand which). So, when the extension is first loaded, pywin32 must load python, compile the extension, and execute its methods. If it were possible to replace the compiled python code with a newer version this should work, shouldn't it? Because the dlls that Windows sees are still there. I haven't even though about using something like py2exe to compile the entire app into something distibutable yet, but it seems safe to assume that in that situation, replacing the code wouldn't work (but I don't mind that). >Oh, don't be afraid of the logging module. I'm not -- I have used in the past. I just don't like it. In this situation, it may be waht I end up using, I haven't decided yet; replacing stdout and stderr with something basic should work too. >I would be very surprised. You need to be able to attach to an existing >process, and I don't know of any Python debuggers that can do that. I have downloaded (but not yet used or studied) WinPdb. It has a menu entry File->Attach, which claims to be able to "attach to a script (that has the debugger engine running)". Perhaps this can be used; I'll experiment. Regards, Gertjan. From gklein at xs4all.nl Tue Jun 30 16:11:28 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 16:11:28 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> Message-ID: Vernon Cole wrote: >sys.stdout works like a normal Python file, so you should be able to assign >a new file object to it. Yes, that looks like a clean and simple approach, that I may end up using, if nothing else for debugging. Thanks, Gertjan. From gklein at xs4all.nl Tue Jun 30 16:16:38 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 16:16:38 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491807.8050809@rcs-comp.com> Message-ID: Randy Syring wrote: >Maybe I am missing something, but I use the "Open Command Window Here" >power toy from: You're missing something. ;-) I have used that one too, for years, and it works reasonably well -- until you have multiple Python versions installed, and want to compile extensions for all of them. That means setting up different compiler environments. I currently have two: one for VS.NET 2003, and one for VS2008. Occasionally, I want to experiment with Cygwin/Mingw as well; that would make three. I'm sure I'll come up with more once I get this extension working. ;) For organisational purposes, I'd like all these different command prompts grouped in a submenu as well. It just seems like a nice tool to have, and something "real" to play with pywin32 as well. Gertjan. From randy at rcs-comp.com Tue Jun 30 16:25:07 2009 From: randy at rcs-comp.com (Randy Syring) Date: Tue, 30 Jun 2009 10:25:07 -0400 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491807.8050809@rcs-comp.com> Message-ID: <4A4A2043.3080508@rcs-comp.com> Gertjan Klein wrote: > Randy Syring wrote: > > >> Maybe I am missing something, but I use the "Open Command Window Here" >> power toy from: >> > > You're missing something. ;-) I have used that one too, for years, and > it works reasonably well -- until you have multiple Python versions > installed, and want to compile extensions for all of them. That means > setting up different compiler environments. I currently have two: one > for VS.NET 2003, and one for VS2008. Occasionally, I want to experiment > with Cygwin/Mingw as well; that would make three. I'm sure I'll come up > with more once I get this extension working. ;) > > For organisational purposes, I'd like all these different command > prompts grouped in a submenu as well. It just seems like a nice tool to > have, and something "real" to play with pywin32 as well. > > Gertjan. > Obviously if you are wanting to play with something, then by all means, have at it! How I handle this on my vista system which has both Python 2.5 and Python 2.6, is that I have setup batch files to setup the environment appropriately. So, I get a command prompt and then type either: `python25` or `python26` and then I am ready to go. -------------------------------------- Randy Syring RCS Computers & Web Solutions 502-644-4776 http://www.rcs-comp.com "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 gklein at xs4all.nl Tue Jun 30 16:25:51 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 16:25:51 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A4A0AEF.4070008@timgolden.me.uk> <4A4A0BBA.3010302@timgolden.me.uk> Message-ID: Tim Golden wrote: >And also the win32traceutil facility which comes with the pywin32 >extensions can help you out here. [...] >Insanely helpful when you're trying to debug, an ISAPI extension >module. Thanks for that, I just tried it and it works as advertised. Very useful indeed! Regards, Gertjan. From timr at probo.com Tue Jun 30 18:14:47 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 30 Jun 2009 09:14:47 -0700 Subject: [python-win32] Shell extension debugging In-Reply-To: <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491161.9020609@probo.com> <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> Message-ID: <4A4A39F7.5020806@probo.com> Gertjan Klein wrote: > Ah, but this is what confuses me. I don't have a DLL: I have a .py file, > which gets interpreted by python. The DDLs that get loaded are > python25.dll and two pywin32 dlls (don't remember offhand which). So, > when the extension is first loaded, pywin32 must load python, compile > the extension, and execute its methods. If it were possible to replace > the compiled python code with a newer version this should work, > shouldn't it? Because the dlls that Windows sees are still there. > It's not that easy. In Python, an object's method functions are just another piece of data in the object. When a client instantiates your COM object, the Python code creates an instance of your object, including pointers to the intermediate language for the method functions. That single object will live until the COM object is released. Even if you were to use Python magic to reload the module source, that would only affect new instances. All of the existing instances will continue to point to the original intermediate language code snippets. > I haven't even though about using something like py2exe to compile the > entire app into something distibutable yet, but it seems safe to assume > that in that situation, replacing the code wouldn't work (but I don't > mind that). > Well, remember that py2exe doesn't really "compile" the app. It just bundles all of the source modules and DLLs together into a single unit. When you run a py2exe app, it just unzips the contents to a temporary directory and launches the interpreter as usual. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gklein at xs4all.nl Tue Jun 30 18:49:24 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 18:49:24 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491161.9020609@probo.com> <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> <4A4A39F7.5020806@probo.com> Message-ID: Tim Roberts wrote: >It's not that easy. In Python, an object's method functions are just >another piece of data in the object. When a client instantiates your >COM object, the Python code creates an instance of your object, >including pointers to the intermediate language for the method >functions. That single object will live until the COM object is >released. Even if you were to use Python magic to reload the module >source, that would only affect new instances. All of the existing >instances will continue to point to the original intermediate language >code snippets. Yes. However, pywin32 is the one that holds the pointer to the object, not Windows COM (at least, I assume this is the case). I would have figured that it is at pywin32's discretion to delete the object and create a new pointer to a new instance. However, I'll take your word for it that it doesn't work like that; I don't want to wear you out answering unimportant questions (especially since I may have some more important ones later on ;)). You may be pleased to hear that a first experimental popup submenu (with a few test items) is now working. Next job is to make it parse a directory with several settings files, and actually launch a command prompt with those settings. (I wish I could somehow pass icons to the submenus, but it seems that for that you need completely owner-drawn menu items, and that seems like a daunting task!) Thanks again, Gertjan. From timr at probo.com Tue Jun 30 19:13:22 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 30 Jun 2009 10:13:22 -0700 Subject: [python-win32] Shell extension debugging In-Reply-To: References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491161.9020609@probo.com> <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> <4A4A39F7.5020806@probo.com> Message-ID: <4A4A47B2.7080509@probo.com> Gertjan Klein wrote: > Yes. However, pywin32 is the one that holds the pointer to the object, > not Windows COM (at least, I assume this is the case). Well, only at the most technical level. The most useful mental model is to think of the Python object as being the thing that gets passed to the COM client. Internally, we know that there has to be a wrapper to bridge from the incoming C++ virtual function calls into Python method invocations, but in fact there is a 1-to-1 correspondence between the COM object wrapper and the Python object it wraps. > I would have > figured that it is at pywin32's discretion to delete the object and > create a new pointer to a new instance. Technically speaking, yes, that would be possible, but it can't be done in the general case. The Python object might contain state information that the wrapper can't know about, and there's no good way to transfer it. > (I wish I could somehow pass icons to the > submenus, but it seems that for that you need completely owner-drawn > menu items, and that seems like a daunting task!) > Correct. I decided against that in my own version. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gklein at xs4all.nl Tue Jun 30 20:22:32 2009 From: gklein at xs4all.nl (Gertjan Klein) Date: Tue, 30 Jun 2009 20:22:32 +0200 Subject: [python-win32] Shell extension debugging References: <6ime459249gditg4jvujth4gf4h5l9aujd@4ax.com> <4A48F874.80206@probo.com> <4A491161.9020609@probo.com> <8c6k451q5jhlk5gddmnms7vsro8gcdpvmr@4ax.com> <4A4A39F7.5020806@probo.com> <4A4A47B2.7080509@probo.com> Message-ID: <2klk45p03eme8a3a11rjacbqfemmpmiqa2@4ax.com> Tim Roberts wrote: >Gertjan Klein wrote: >> (I wish I could somehow pass icons to the >> submenus, but it seems that for that you need completely owner-drawn >> menu items, and that seems like a daunting task!) > >Correct. I decided against that in my own version. Well, I might have a go at it just for fun, as I have the whole thing working now: when right-clicking on a directory it parses a directory for settings files and presents those as submenu's. When clicked, it launches cmd.exe with a commandline of "/k ". I'm very pleased! This (with help from you and the other responders) turned out not nearly as difficult as I feared. Thanks again, Gertjan.