From bbbscarter at gmail.com Fri May 1 11:17:35 2009 From: bbbscarter at gmail.com (Simon Carter) Date: Fri, 1 May 2009 10:17:35 +0100 Subject: [python-win32] COM and retrieving records/structures In-Reply-To: References: <49EE9B54.8080000@gmail.com> <001c01c9c332$56a9cec0$03fd6c40$@com.au> Message-ID: Hi! Is there anything else I can do to help track this down, or work around the problem? Without switching over to Python .Net or IronPython, I'm not entirely clear what I can do... Thanks again for the help! Simon From farplagek at gmail.com Sun May 3 11:56:12 2009 From: farplagek at gmail.com (Khalid Moulfi) Date: Sun, 3 May 2009 13:56:12 +0400 Subject: [python-win32] Modify only the first line of a big file (Roughly 1.5MB - For thousands of file). Message-ID: <7ad508500905030256i44a0aecdsfec12515f6c70cca@mail.gmail.com> Hi all, I have thousands of file and I must update only the first line. My concern is : is it possible to read only the first line for each of these files and update the first line only without reading the file completely ? Version of Python is 2.2.1 Thanks for any help, KM -------------- next part -------------- An HTML attachment was scrubbed... URL: From kxroberto at googlemail.com Sun May 3 13:01:27 2009 From: kxroberto at googlemail.com (Robert) Date: Sun, 03 May 2009 13:01:27 +0200 Subject: [python-win32] Modify only the first line of a big file (Roughly 1.5MB - For thousands of file). In-Reply-To: <7ad508500905030256i44a0aecdsfec12515f6c70cca@mail.gmail.com> References: <7ad508500905030256i44a0aecdsfec12515f6c70cca@mail.gmail.com> Message-ID: Khalid Moulfi wrote: > Hi all, > > I have thousands of file and I must update only the first line. > My concern is : is it possible to read only the first line for each of > these files and update the first line only without reading the file > completely ? > > Version of Python is 2.2.1 > > Thanks for any help, > when the length of the line/initial bytes doesn't change (by means of enough balancing spaces or so) you can open the file in "r+" mode and overwrite sections; e.g. after reading some bytes/line or so do f.seek(0) and overwrite the initial bytes. From gerdusvanzyl at gmail.com Sun May 3 16:02:52 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Sun, 3 May 2009 16:02:52 +0200 Subject: [python-win32] Modify only the first line of a big file (Roughly 1.5MB - For thousands of file). In-Reply-To: References: <7ad508500905030256i44a0aecdsfec12515f6c70cca@mail.gmail.com> Message-ID: <91882ea90905030702q77d7b386g3d86657b7380a2f6@mail.gmail.com> It seems it's not possible if as mentioned you aren't replacing a line with a line of the same lenght/bytes. You then have to resort to using intermediate files see: http://python.pastebin.com/f539b4e46 On Sun, May 3, 2009 at 1:01 PM, Robert wrote: > Khalid Moulfi wrote: >> >> Hi all, >> ?I have thousands of file and I must update only the first line. >> My concern is : is it possible to read only the first line for each of >> these files and update the first line only without reading the file >> completely ? >> ?Version of Python is 2.2.1 >> ?Thanks for any help, >> > > when the length of the line/initial bytes doesn't change (by means of enough > balancing spaces or so) you can open the file in "r+" mode and overwrite > sections; e.g. after reading some bytes/line or so do f.seek(0) and > overwrite the initial bytes. > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From jmarcedwards at gmail.com Sun May 3 22:15:01 2009 From: jmarcedwards at gmail.com (J. Marc Edwards) Date: Sun, 3 May 2009 16:15:01 -0400 Subject: [python-win32] Python Windows MSI installs now fails with error 2755... Message-ID: <000901c9cc2b$d73dee70$85b9cb50$@com> I am a new Python user. I was experimenting with a variety of Python versions on Windows XP, e.g. 2.6.2, 3.0.1, ActiveState 2.6.2/3.0.1, etc. I then also wanted to start using iPython, which I also installed on my Windows XP system. I am also an emacs user, so I was trying to get the Python pdb debugger to work with emacs, but I was having problems that seemed to point to having multiple Python versions on my system. So, I wanted to then "clean" my system up from all the Python versions. After removing all of my Python versions, I then tried to re-install just Python 2.6.2. However, I am now receiving an error message from the Windows MSI installer that says: "The system cannot open the device or file specified." And then a windowed message: "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2755." Now I can't install any of the previous Python packages on my Windows laptop. I have tried researching this on the Internet, and it seems to indicate a Windows registry error point to an incomplete uninstall of an application, notably the previous Python versions that I had on my system. Does anyone know how I could clean up the registry so that I can successfully reinstall Python? Many thanks in advance, Marc -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdriscoll at co.marshall.ia.us Mon May 4 16:18:39 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 04 May 2009 09:18:39 -0500 Subject: [python-win32] python-win32 Digest, Vol 74, Issue 5 In-Reply-To: References: Message-ID: <49FEF93F.4000705@co.marshall.ia.us> python-win32-request at python.org wrote: > Send python-win32 mailing list submissions to > python-win32 at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-request at python.org > > You can reach the person managing the list at > python-win32-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > ------------------------------------------------------------------------ > > Today's Topics: > > 1. Re: Modify only the first line of a big file (Roughly 1.5MB - > For thousands of file). (Robert) > 2. Re: Modify only the first line of a big file (Roughly 1.5MB - > For thousands of file). (Gerdus van Zyl) > 3. Python Windows MSI installs now fails with error 2755... > (J. Marc Edwards) > > > ------------------------------------------------------------------------ > > Subject: > Re: [python-win32] Modify only the first line of a big file (Roughly > 1.5MB - For thousands of file). > From: > Robert > Date: > Sun, 03 May 2009 13:01:27 +0200 > To: > python-win32 at python.org > > To: > python-win32 at python.org > > > Khalid Moulfi wrote: >> Hi all, >> >> I have thousands of file and I must update only the first line. >> My concern is : is it possible to read only the first line for each >> of these files and update the first line only without reading the >> file completely ? >> >> Version of Python is 2.2.1 >> >> Thanks for any help, >> > > when the length of the line/initial bytes doesn't change (by means of > enough balancing spaces or so) you can open the file in "r+" mode and > overwrite sections; e.g. after reading some bytes/line or so do > f.seek(0) and overwrite the initial bytes. > > > > > ------------------------------------------------------------------------ > > Subject: > Re: [python-win32] Modify only the first line of a big file (Roughly > 1.5MB - For thousands of file). > From: > Gerdus van Zyl > Date: > Sun, 3 May 2009 16:02:52 +0200 > To: > python-win32 at python.org > > To: > python-win32 at python.org > > > It seems it's not possible if as mentioned you aren't replacing a line > with a line of the same lenght/bytes. You then have to resort to using > intermediate files see: http://python.pastebin.com/f539b4e46 > > On Sun, May 3, 2009 at 1:01 PM, Robert wrote: > >> Khalid Moulfi wrote: >> >>> Hi all, >>> I have thousands of file and I must update only the first line. >>> My concern is : is it possible to read only the first line for each of >>> these files and update the first line only without reading the file >>> completely ? >>> Version of Python is 2.2.1 >>> Thanks for any help, >>> >>> >> when the length of the line/initial bytes doesn't change (by means of enough >> balancing spaces or so) you can open the file in "r+" mode and overwrite >> sections; e.g. after reading some bytes/line or so do f.seek(0) and >> overwrite the initial bytes. >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > > > > ------------------------------------------------------------------------ > > Subject: > [python-win32] Python Windows MSI installs now fails with error 2755... > From: > "J. Marc Edwards" > Date: > Sun, 3 May 2009 16:15:01 -0400 > To: > > > To: > > > > I am a new Python user. I was experimenting with a variety of Python > versions on Windows XP, e.g. 2.6.2, 3.0.1, ActiveState 2.6.2/3.0.1, etc. > > > > I then also wanted to start using iPython, which I also installed on > my Windows XP system. > > > > I am also an emacs user, so I was trying to get the Python pdb > debugger to work with emacs, but I was having problems that seemed to > point to having multiple Python versions on my system. > > > > So, I wanted to then "clean" my system up from all the Python versions. > > > > After removing all of my Python versions, I then tried to re-install > just Python 2.6.2. > > > > However, I am now receiving an error message from the Windows MSI > installer that says: > > > > *"The system cannot open the device or file specified."* > > > > And then a windowed message: > > > > *"The installer has encountered an unexpected error installing this > package. This may indicate a problem with this package. The error > code is 2755."* > > > > Now I can't install any of the previous Python packages on my Windows > laptop. > > > > I have tried researching this on the Internet, and it seems to > indicate a Windows registry error point to an incomplete uninstall of > an application, notably the previous Python versions that I had on my > system. > > > > Does anyone know how I could clean up the registry so that I can > successfully reinstall Python? > > > > Many thanks in advance, Marc > > > One way to go about it would be to back up your registry and then open regedit and do a search for the term "python". Then delete those keys or values that obviously shouldn't be in there anymore. If you're cautious and use common sense, you can muck around in the registry without harming your PC. Just don't start deleting willy nilly or you will make your PC unstable. Mike From m.echavarriagregory at umiami.edu Mon May 4 16:28:14 2009 From: m.echavarriagregory at umiami.edu (Echavarria Gregory, Maria Angelica) Date: Mon, 4 May 2009 10:28:14 -0400 Subject: [python-win32] What is the meaning of -1. #IND? Message-ID: <2E95F75EDC25D54999387A1E2E6EF62726E093E0D1@MBX02.cgcent.miami.edu> Good morning group. I have a concern related to a result shown as -1#IND in my interpreter (blue letters, not red warnings) that I am getting after a bunch of numpy code and I do not really know the meaning. Can you please help me with WHAT DOES -#IND MEAN? could it be related to previous -#INF or NaN that may emerge during the calculations before the final result? Thanks very much, Angelica Echavarria From timr at probo.com Mon May 4 20:02:24 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 04 May 2009 11:02:24 -0700 Subject: [python-win32] What is the meaning of -1. #IND? In-Reply-To: <2E95F75EDC25D54999387A1E2E6EF62726E093E0D1@MBX02.cgcent.miami.edu> References: <2E95F75EDC25D54999387A1E2E6EF62726E093E0D1@MBX02.cgcent.miami.edu> Message-ID: <49FF2DB0.9000802@probo.com> Echavarria Gregory, Maria Angelica wrote: > Good morning group. I have a concern related to a result shown as -1#IND in my interpreter (blue letters, not red warnings) that I am getting after a bunch of numpy code and I do not really know the meaning. Can you please help me with WHAT DOES -#IND MEAN? could it be related to previous -#INF or NaN that may emerge during the calculations before the final result? > Absolutely. -1#IND means "negative indefinite". Indefinite is one of the special values defined in IEEE 754. Dividing by zero gives infinity (1#INF), but dividing 0 by 0 results in "indefinite" because it has no defined meaning. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From shunichi.goto at gmail.com Mon May 4 22:45:52 2009 From: shunichi.goto at gmail.com (Shun-ichi GOTO) Date: Tue, 5 May 2009 05:45:52 +0900 Subject: [python-win32] Python Windows MSI installs now fails with error 2755... In-Reply-To: <000901c9cc2b$d73dee70$85b9cb50$@com> References: <000901c9cc2b$d73dee70$85b9cb50$@com> Message-ID: <2288dbd90905041345w57648d16ube846b5c6168e164@mail.gmail.com> 2009/5/4 J. Marc Edwards : > However, I am now receiving an error message from the Windows MSI installer > that says: > > "The system cannot open the device or file specified." > > And then a windowed message: > > "The installer has encountered an unexpected error installing this package. > This may indicate a problem with this package.? The error code is 2755." In my experience, this error is occured when .msi file has limited permission. For example, copying the file by cygwin's cp command makes such a situation. Check the file permission in detail dialog from security tab of file's property dialog. If the use 'SYSTEM' does not have read permission, you'll got the error. -- Shun-ichi GOTO From le.dahut at laposte.net Tue May 5 10:23:58 2009 From: le.dahut at laposte.net (le dahut) Date: Tue, 05 May 2009 10:23:58 +0200 Subject: [python-win32] gpedit reload method in python In-Reply-To: <49F9F648.1080204@timgolden.me.uk> References: <49F9C428.3080509@laposte.net> <49F9F648.1080204@timgolden.me.uk> Message-ID: <49FFF79E.7040306@laposte.net> Hi, I tried it with "SHCNE_ALLEVENTS" as argument with no success : shell.SHChangeNotify(shellcon.SHCNE_ALLEVENTS, shellcon.SHCNF_IDLIST ,None) Any other idea ? Tim Golden wrote : > > le dahut wrote: >> Hello, >> >> "gpedit.msc" can change several parameters in system for example items >> in start menu or hidden drives in explorer. The changes made in >> "gpedit" are immediately applied, if you have "My computer" opened you >> can see selected letters disappear. >> I know that "gpedit" modifies >> HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDrives. >> >> But I don't know how "gpedit" updates the system, what sort of system >> call is done. >> >> I've already tried : >> win32gui.SendMessage(win32con.HWND_BROADCAST, >> win32con.WM_SETTINGCHANGE, 0, 'Environment') >> and the commande : >> RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True >> without success. >> >> Does someone know more about this ? >> Are there other API calls that update the system ? > > > You might need to call SHChangeNotify > > http://msdn.microsoft.com/en-us/library/bb762118(VS.85).aspx > > TJG From neisen at linbox.com Tue May 5 11:35:14 2009 From: neisen at linbox.com (Nicolas EISEN) Date: Tue, 05 May 2009 11:35:14 +0200 Subject: [python-win32] Extract icon from exe files In-Reply-To: <49F9E97B.3040704@probo.com> References: <49EC8D1A.9000909@linbox.com> <49ED0732.6050608@probo.com> <49F1D337.8070303@linbox.com> <49F1F035.3020308@probo.com> <49F5D200.3030704@linbox.com> <49F5E646.3060109@probo.com> <49F71BEC.4010608@linbox.com> <49F73A31.2050206@probo.com> <49F9BFAB.7020508@linbox.com> <49F9E97B.3040704@probo.com> Message-ID: <4A000852.4000302@linbox.com> Tim Roberts a ?crit : > > I think you're making this a lot harder than it needs to be. > > import win32ui > import win32gui > import win32con > import win32api > > ico_x = win32api.GetSystemMetrics(win32con.SM_CXICON) > ico_y = win32api.GetSystemMetrics(win32con.SM_CYICON) > > large, small = > win32gui.ExtractIconEx("c:/windows/system32/shell32.dll",0) > win32gui.DestroyIcon(large[0]) > > hdc = win32ui.CreateDCFromHandle( win32gui.GetDC(0) ) > hbmp = win32ui.CreateBitmap() > hbmp.CreateCompatibleBitmap( hdc, ico_x, ico_x ) > hdc = hdc.CreateCompatibleDC() > > hdc.SelectObject( hbmp ) > hdc.DrawIcon( (0,0), small[0] ) > hbmp.SaveBitmapFile( hdc, "save.bmp" ) I make some modification but it's work ! Great ! import win32ui import win32gui import win32con import win32api import cStringIO import Image tempDirectory = os.getenv("temp") ico_x = win32api.GetSystemMetrics(win32con.SM_CXICON) dst = cStringIO.StringIO() large, small = win32gui.ExtractIconEx(path,0) win32gui.DestroyIcon(small[0]) #creating a destination memory DC hdc = win32ui.CreateDCFromHandle( win32gui.GetDC(0) ) hbmp = win32ui.CreateBitmap() hbmp.CreateCompatibleBitmap(hdc, ico_x, ico_x) hdc = hdc.CreateCompatibleDC() hdc.SelectObject( hbmp ) #draw a icon in it hdc.DrawIcon( (0,0), large[0] ) win32gui.DestroyIcon(large[0]) #convert picture hbmp.SaveBitmapFile( hdc, tempDirectory + "\Icontemp.bmp") im = Image.open(tempDirectory + "\Icontemp.bmp") im.save(dst, "JPEG") dst.seek(0) os.remove(tempDirectory + "\Icontemp.bmp") return dst.read() I have a last little detail : the icon have the tranparence but the bmp take this in black. In win32ui, there are not attribute to set the background in white before write the bmp in DC ... an idea ? Thanks a lot. From timr at probo.com Tue May 5 18:29:10 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 05 May 2009 09:29:10 -0700 Subject: [python-win32] Fwd: First line is a mix of text characters and binary, after the first line all is binary. In-Reply-To: <7ad508500905050130s749c78e1t5a0c15147af95416@mail.gmail.com> References: <7ad508500905050118q391a7fdehb8ac1e02b96eebd6@mail.gmail.com> <7ad508500905050130s749c78e1t5a0c15147af95416@mail.gmail.com> Message-ID: <4A006956.9050706@probo.com> Khalid Moulfi wrote: > > Hi all, > I come back on my issue : > Actually, the work I have to do is to process 35000 files. > On each of these files, I have to update only the first line, but keep > the remaining (Remaining is all but binary characters). > The issue is that the file after the second line is full of strange > chararcters. > I need to keep the same file but update only the first line. > What is also strange is that when I read the file line by line, I do > not get the same line when writing it onto a new file. (I used > open(file,'rb') and write it to a new file but neither the size nor > the number of lines is the same) You MUST STOP thinking of this file as having "lines". It does NOT have "lines". It is a binary file, plain and simple. You cannot read it with line-oriented functions. The first part of it happens to have ASCII characters, but it is not a text file by any means. And like any binary file, you need to have a document that tells you about the format. I can certainly make an educated guess about the format, but you have to have a spec somewhere. Further, I already told you exactly how to handle these files. The advice I gave you earlier would work perfectly well with this larger file. The file is divided into sections by a 0x1C byte. The first two sections have those readable strings, the third (and beyond) is all binary. The first two sections are divided into records by 0x1D byte. There are no carriage returns and no line feeds -- hence, no lines. So, you process it exactly like I told you before: f = open('sample_1005000190.nst','rb') # Divide into sections. We only care about the first two, so we leave the rest unparsed. sections = f.read().split( '\x1C', 2 ) # Sections is now a list with three elements: the 1. section, the 2. section, and the binary section. # Divide the first two sections into records. sect1 = sections[0].split( '\x1D' ) sect2 = sections[1].split( '\x1D' ) # Now I can add or remove parts in either of the first two sections. # ... # Now, I'm ready to write my changed parts back to a new file. part1 = '\x1D'.join( sect1 ) part2 = '\x1D'.join( sect2 ) recreate = '\x1C'.join( [part1, part2, sections[-1]] ) open( 'newfile.nst','wb' ).write( recreate ) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue May 5 19:29:10 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 05 May 2009 10:29:10 -0700 Subject: [python-win32] Extract icon from exe files In-Reply-To: <4A000852.4000302@linbox.com> References: <49EC8D1A.9000909@linbox.com> <49ED0732.6050608@probo.com> <49F1D337.8070303@linbox.com> <49F1F035.3020308@probo.com> <49F5D200.3030704@linbox.com> <49F5E646.3060109@probo.com> <49F71BEC.4010608@linbox.com> <49F73A31.2050206@probo.com> <49F9BFAB.7020508@linbox.com> <49F9E97B.3040704@probo.com> <4A000852.4000302@linbox.com> Message-ID: <4A007766.3060804@probo.com> Nicolas EISEN wrote: > > I have a last little detail : the icon have the tranparence but the > bmp take this in black. In win32ui, there are not attribute to set the > background in white before write the bmp in DC ... an idea ? Did you do any investigation of this at all? Did you do "dir(hdc)" to find out what functions are available in a DC? hdc.FillSolidRect( (0,0, ico_x, ico_y), 0xffffff ) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From greg.ewing at canterbury.ac.nz Wed May 6 02:27:01 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Wed, 06 May 2009 12:27:01 +1200 Subject: [python-win32] Extract icon from exe files In-Reply-To: <4A000852.4000302@linbox.com> References: <49EC8D1A.9000909@linbox.com> <49ED0732.6050608@probo.com> <49F1D337.8070303@linbox.com> <49F1F035.3020308@probo.com> <49F5D200.3030704@linbox.com> <49F5E646.3060109@probo.com> <49F71BEC.4010608@linbox.com> <49F73A31.2050206@probo.com> <49F9BFAB.7020508@linbox.com> <49F9E97B.3040704@probo.com> <4A000852.4000302@linbox.com> Message-ID: <4A00D955.5020507@canterbury.ac.nz> Nicolas EISEN wrote: > the icon have the tranparence but the bmp > take this in black. In win32ui, there are not attribute to set the > background in white before write the bmp in DC ... an idea ? Draw a white rectangle over the bmp before calling DrawIcon? -- Greg From winterttr at gmail.com Wed May 6 03:54:52 2009 From: winterttr at gmail.com (winterTTr) Date: Wed, 6 May 2009 09:54:52 +0800 Subject: [python-win32] Implement a com server with a undocument interface Message-ID: I want to use the win32com to implement a shell extension with the function to display custom information when i move mouse over a txt file in explorer on windows. I search for the method to do this and found a com interface which i can't find it in the current win32com library. It is "IQueryInfo" . And my coding is like this ( part of ): ***************************************************************** import pythoncom from win32com.shell import shell, shellcon import win32gui import win32con import os import winerror from win32com.server.exception import COMException from pywintypes import IID IPersistFile_Methods = "IsDirty Load Save SaveCompleted GetCurFile".split() IID_IQueryInfo = "{00021500-0000-0000-C000-000000000046}" # <== IQueryInfo_Methods = ["GetInfoFlags","GetInfoTip"] class ShellExtension: _reg_progid_ = "ShellExtension.winterTTr" _reg_desc_ = "Shell Extension from winterTTr" _reg_clsid_ = "{EB0D2B97-287A-4B91-A455-D2E021B894AC}" _com_interfaces_ = [ pythoncom.IID_IPersistFile, IID(IID_IQueryInfo)] _public_methods_ = IPersistFile_Methods + IQueryInfo_Methods # =============== IPersistFile : from ====================== def GetInfoFlags(self , Flags ): #raise COMException(desc="No Implemented",scode=winerror.E_NOTIMPL) raise COMException(hresult=winerror.E_NOTIMPL) def GetInfoTip(self , flags ): print flags print "======== GetInfoTip ===========" return "" # =============== IPersistFile : to ====================== # =============== IPersistFile : from ====================== def IsDirty( self ): raise COMException(hresult=winerror.E_NOTIMPL) def Load(self, filename, mode): #self.filename = filename #self.mode = mode print filename def Save( self ,FileName, Remember): raise COMException(hresult=winerror.E_NOTIMPL) def SaveCompleted( self , pszFileName): raise COMException(hresult=winerror.E_NOTIMPL) def GetCurFile( self ): raise COMException(hresult=winerror.E_NOTIMPL) # =============== IPersistFile : to ====================== ***************************************************************** and i also modify the register as adding this "HKEY_CLASSES_ROOT\\.txt\\{00021500-0000-0000-C000-000000000046}\\{EB0D2B97-287A-4B91-A455-D2E021B894AC}" and my question is : can i use IQueryInfo IID directly which i can't find it in pywin32com? If it could , why i can't see the output from GetInfoTip via win32traceutil.py ( OK , i already register the com with --debug mode ) PS: i can see the out put that Load is invoked , but no "GetInfoTip" output any one can give some advice ? Thanks. From opekar at eccam.com Thu May 7 12:41:48 2009 From: opekar at eccam.com (Vaclav Opekar) Date: Thu, 07 May 2009 12:41:48 +0200 Subject: [python-win32] ANN: pygtkie - internet explorer embedding and controlling Message-ID: <4A02BAEC.6040301@eccam.com> Hi all, pygtkie is a simple package for embedding and controlling Internet Exporer in pygtk applications. http://code.google.com/p/pygtkie/ Since it's partly related to pywin32 (and based on) I'm sending the announcement to here. Regards, Vaclav PS: thanks for the pywin32! From siddhartha.veedaluru at gmail.com Fri May 8 11:26:04 2009 From: siddhartha.veedaluru at gmail.com (siddhartha veedaluru) Date: Fri, 8 May 2009 14:56:04 +0530 Subject: [python-win32] Silent installation of pywin32 Message-ID: <424b71ec0905080226v6f0005adg3a6844c89685bcc4@mail.gmail.com> Hi all Do we have a way to install pywin32 module silently.? Does the exe which is downloable support silent installation? thanks Siddhartha -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Fri May 8 19:39:51 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 08 May 2009 18:39:51 +0100 Subject: [python-win32] Silent installation of pywin32 In-Reply-To: <424b71ec0905080226v6f0005adg3a6844c89685bcc4@mail.gmail.com> References: <424b71ec0905080226v6f0005adg3a6844c89685bcc4@mail.gmail.com> Message-ID: <4A046E67.2040904@timgolden.me.uk> siddhartha veedaluru wrote: > Hi all > > Do we have a way to install pywin32 module silently.? > Does the exe which is downloable support silent installation? Don't think so; your best bet is probably to rebuild as an MSI which you can install with a "silent running" mode. TJG From timr at probo.com Fri May 8 20:42:33 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 08 May 2009 11:42:33 -0700 Subject: [python-win32] Silent installation of pywin32 In-Reply-To: <424b71ec0905080226v6f0005adg3a6844c89685bcc4@mail.gmail.com> References: <424b71ec0905080226v6f0005adg3a6844c89685bcc4@mail.gmail.com> Message-ID: <4A047D19.7080800@probo.com> siddhartha veedaluru wrote: > > Do we have a way to install pywin32 module silently.? > Does the exe which is downloable support silent installation? Why do you want this? If you are planning to ship an application that needs pywin32, then this is NOT the right way to do it. Tools like py2exe will automatically pull in whatever pieces of pywin32 are necessary to make your script run. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Sat May 9 02:16:42 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 09 May 2009 10:16:42 +1000 Subject: [python-win32] COM and retrieving records/structures In-Reply-To: References: <49EE9B54.8080000@gmail.com> <001c01c9c332$56a9cec0$03fd6c40$@com.au> Message-ID: <4A04CB6A.1060009@gmail.com> Simon Carter wrote: > Hi! Is there anything else I can do to help track this down, or work > around the problem? Without switching over to Python .Net or > IronPython, I'm not entirely clear what I can do... Me either :( It will probably involve working out how to reproduce this in the test suite... Mark From skippy.hammond at gmail.com Sat May 9 02:19:16 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 09 May 2009 10:19:16 +1000 Subject: [python-win32] PythonWin IDE: how to assign a function/code to key F1 etc. ? In-Reply-To: References: <49F8EB8E.80809@gmail.com> Message-ID: <4A04CC04.6020707@gmail.com> Some of that looks good, but I'm very short on time at the moment. Could you please split this into 2 patches (one for the debugging changes, one for the rest) and upload them to sourceforge? Thanks, Mark Robert wrote: > Mark Hammond wrote: >> Robert wrote: >>> want to put new functions (short python code) on keys like F1, F12, >>> Ctrl-F1 and other keys. >>> Is there a mechanism/recipe ? >> >> >> Look for the *.cfg files in the pythonwin directory. >> > > Thanks. > > maybe some of the following stuff is useful for somebody, or for future > PythonWin default: > > In attachment a patch for pywin/default.cfg, which does context (word) > sensitive help from editor into Python Help and PythonWin Help > > F1 = HelpPy > Ctrl+F1 = HelpPyWin > .. > > and allows for faster edit-run cycle: running/interacting with > (auto-unindented) selected code lines from editor > > Ctrl+K = Interact_SelectedLines > Ctrl+E = ExecGlobal_SelectedLines > > ( the little patch of scintilla/config.py enables correct line numbers > for traceback and debugging of code in default.cfg ) > > - > > Also CtrlEnter.patch (-> framework/interact.py), which enables ad-hoc > debugging from interactive pane (Ctrl-Enter) into an interactive > statement (without long-winded F5 running into breakpoints etc). I did > not put the code into default.cfg, because a lot of pre-processing code > is shared with normal interactive statement execution. > > > Robert > > > ------------------------------------------------------------------------ > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From skippy.hammond at gmail.com Sat May 9 02:21:59 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 09 May 2009 10:21:59 +1000 Subject: [python-win32] Implement a com server with a undocument interface In-Reply-To: References: Message-ID: <4A04CCA7.8010301@gmail.com> I'm afraid you can only implement non-supported interfaces if they are described in a type-library - in which case the 'pippo' examples and tests should get you started. Mark winterTTr wrote: > I want to use the win32com to implement a shell extension > with the function to display custom information > when i move mouse over a txt file in explorer on windows. > I search for the method to do this and found a com interface > which i can't find it in the current win32com library. > It is "IQueryInfo" . > > And my coding is like this ( part of ): > > ***************************************************************** > import pythoncom > from win32com.shell import shell, shellcon > import win32gui > import win32con > import os > import winerror > from win32com.server.exception import COMException > from pywintypes import IID > > IPersistFile_Methods = "IsDirty Load Save SaveCompleted > GetCurFile".split() > > IID_IQueryInfo = "{00021500-0000-0000-C000-000000000046}" # <== > IQueryInfo_Methods = ["GetInfoFlags","GetInfoTip"] > > class ShellExtension: > _reg_progid_ = "ShellExtension.winterTTr" > _reg_desc_ = "Shell Extension from winterTTr" > _reg_clsid_ = "{EB0D2B97-287A-4B91-A455-D2E021B894AC}" > _com_interfaces_ = [ > pythoncom.IID_IPersistFile, > IID(IID_IQueryInfo)] > _public_methods_ = IPersistFile_Methods + IQueryInfo_Methods > > # =============== IPersistFile : from ====================== > def GetInfoFlags(self , Flags ): > #raise COMException(desc="No Implemented",scode=winerror.E_NOTIMPL) > raise COMException(hresult=winerror.E_NOTIMPL) > > def GetInfoTip(self , flags ): > print flags > print "======== GetInfoTip ===========" > return "" > > # =============== IPersistFile : to ====================== > > > # =============== IPersistFile : from ====================== > def IsDirty( self ): > raise COMException(hresult=winerror.E_NOTIMPL) > > def Load(self, filename, mode): > #self.filename = filename > #self.mode = mode > print filename > > > def Save( self ,FileName, Remember): > raise COMException(hresult=winerror.E_NOTIMPL) > > def SaveCompleted( self , pszFileName): > raise COMException(hresult=winerror.E_NOTIMPL) > > def GetCurFile( self ): > raise COMException(hresult=winerror.E_NOTIMPL) > > # =============== IPersistFile : to ====================== > > ***************************************************************** > > and i also modify the register as adding this > "HKEY_CLASSES_ROOT\\.txt\\{00021500-0000-0000-C000-000000000046}\\{EB0D2B97-287A-4B91-A455-D2E021B894AC}" > > > and my question is : > can i use IQueryInfo IID directly which i can't find it in pywin32com? > If it could , why i can't see the output from GetInfoTip via win32traceutil.py > ( OK , i already register the com with --debug mode ) > > PS: i can see the out put that Load is invoked , but no "GetInfoTip" output > > any one can give some advice ? Thanks. > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From skippy.hammond at gmail.com Sat May 9 08:17:05 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 09 May 2009 16:17:05 +1000 Subject: [python-win32] gpedit reload method in python In-Reply-To: <49FFF79E.7040306@laposte.net> References: <49F9C428.3080509@laposte.net> <49F9F648.1080204@timgolden.me.uk> <49FFF79E.7040306@laposte.net> Message-ID: <4A051FE1.5060401@gmail.com> le dahut wrote: > Hi, > > I tried it with "SHCNE_ALLEVENTS" as argument with no success : > shell.SHChangeNotify(shellcon.SHCNE_ALLEVENTS, shellcon.SHCNF_IDLIST > ,None) > > Any other idea ? You will need to get the IDLIST for your object; I don't think passing None will work. Mark From cappy2112 at gmail.com Sun May 10 16:11:58 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sun, 10 May 2009 07:11:58 -0700 Subject: [python-win32] Silent installation of pywin32 Message-ID: <8249c4ac0905100711y742ce84bo284aee2661199105@mail.gmail.com> Message: 2 Date: Fri, 08 May 2009 11:42:33 -0700 From: Tim Roberts Subject: Re: [python-win32] Silent installation of pywin32 To: Python-Win32 List Message-ID: <4A047D19.7080800 at probo.com> Content-Type: text/plain; charset=ISO-8859-1 >>Tools like py2exe will automatically pull in whatever pieces of pywin32 are >>necessary to make your script run. Py2exe tries to pull in everything automatically, but doesn't always succeed Recently, I had to manually include a dll it wasn't finding- but that's not the first time -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerdusvanzyl at gmail.com Mon May 11 15:16:52 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Mon, 11 May 2009 15:16:52 +0200 Subject: [python-win32] Vista64 Jet Message-ID: <91882ea90905110616p667962f6oa3a03aa573b30cde@mail.gmail.com> The following code: conn = win32com.client.Dispatch(r'ADODB.Connection') DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=%s;Jet OLEDB:Database Password=root' % dbName conn.Open(DSN) gives: com_error: (-2147352567, 'Exception occurred.', (0, u'ADODB.Connection', u'Provider cannot be found. It may not be properly installed.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None) I got the same error in visual studio and the solution is to set compilation to 32bit since jet does not exist for vista-64bit. I have python64 so how do I tell pywin to use the 32bit version? thank you, Gerdus From Manuel.Baehr at comsoft.aero Mon May 11 17:59:06 2009 From: Manuel.Baehr at comsoft.aero (Baehr, Manuel) Date: Mon, 11 May 2009 17:59:06 +0200 Subject: [python-win32] Win32 robustness against Microsoft version changes Message-ID: <737A64DEB003704788E5CE515ED146055B787E@CSMAIL.comsoft.de> Hi all, I've been using the win32com module for a few weeks now and am pretty amazed about the possibilities. I want to use it to automate various tasks. However I am afraid of Microsoft version changes destroying my scripts. Is there any experience or estimate about this risk (we currently use Office2003 on WinXP)? Cheers, Manuel From timr at probo.com Mon May 11 19:54:31 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 11 May 2009 10:54:31 -0700 Subject: [python-win32] Win32 robustness against Microsoft version changes In-Reply-To: <737A64DEB003704788E5CE515ED146055B787E@CSMAIL.comsoft.de> References: <737A64DEB003704788E5CE515ED146055B787E@CSMAIL.comsoft.de> Message-ID: <4A086657.3070104@probo.com> Baehr, Manuel wrote: > Hi all, > > I've been using the win32com module for a few weeks now and am pretty > amazed about the possibilities. > I want to use it to automate various tasks. However I am afraid of > Microsoft version changes destroying my scripts. Is there any experience > or estimate about this risk (we currently use Office2003 on WinXP)? > With very few exceptions, Microsoft never removes a documented API. The risks, although not zero, are very slight. The same cannot be about, for example, Adobe... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From johnrandolph at gmail.com Mon May 11 22:41:17 2009 From: johnrandolph at gmail.com (John Randolph) Date: Mon, 11 May 2009 16:41:17 -0400 Subject: [python-win32] AddMembershipRule(SMS_CollectionRuleDirect): Generic failure In-Reply-To: <49EE240A.2090900@timgolden.me.uk> References: <49E8F46F.4050204@timgolden.me.uk> <49EA2586.6060101@timgolden.me.uk> <49EE240A.2090900@timgolden.me.uk> Message-ID: On Tue, Apr 21, 2009 at 3:52 PM, Tim Golden wrote: >>>> Actually I had previously placed a delay between the new_rule creation >>>> and calling AddMembershipRule for another reason -- to make a clear >>>> break in the timestamps on the server side wmi logs. ?Unfortunately >>>> the delay doesn't help. Tim, all: My "Generic Failure" error when calling AddMembershipRule(new rule) turned out to be permissions related. My local Windows admins have segregated read and write access into two groups and my role account didn't have write access. oops. Unfortunately I learned no further details on how to decode "Generic failure" into "Bad permissions" for the list, though, sorry. The WMI service logs look clean so you probably need to dive into the SMS logs. Thanks John From mail at timgolden.me.uk Mon May 11 22:56:41 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 11 May 2009 21:56:41 +0100 Subject: [python-win32] AddMembershipRule(SMS_CollectionRuleDirect): Generic failure In-Reply-To: References: <49E8F46F.4050204@timgolden.me.uk> <49EA2586.6060101@timgolden.me.uk> <49EE240A.2090900@timgolden.me.uk> Message-ID: <4A089109.60408@timgolden.me.uk> John Randolph wrote: > On Tue, Apr 21, 2009 at 3:52 PM, Tim Golden wrote: >>>>> Actually I had previously placed a delay between the new_rule creation >>>>> and calling AddMembershipRule for another reason -- to make a clear >>>>> break in the timestamps on the server side wmi logs. Unfortunately >>>>> the delay doesn't help. > > Tim, all: > > My "Generic Failure" error when calling AddMembershipRule(new rule) > turned out to be permissions related. My local Windows admins have > segregated read and write access into two groups and my role account > didn't have write access. oops. > > Unfortunately I learned no further details on how to decode "Generic > failure" into "Bad permissions" for the list, though, sorry. The WMI > service logs look clean so you probably need to dive into the SMS > logs. Thanks for the update. TJG From chris at chriscurvey.com Tue May 12 22:08:07 2009 From: chris at chriscurvey.com (Chris Curvey) Date: Tue, 12 May 2009 16:08:07 -0400 Subject: [python-win32] python win-32, 64-bits, and services Message-ID: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> I'm attempting to wrap up a Python program and turn it into a service, using the method listed in Mark Hammond's book (*not* using py2exe). The program spawns a bunch of threads using the "subprocess" module. If I run the program from the command line, everything works fine. If I run it as a service, any kind of exception seems to stop the affected thread immediately. Exceptions are not bubbling up to the relevant try/except block. The only thing I can think of right now is that I'm running on a 64-bit version of Windows, and that the win32 packages won't fully work in that environment. (Although the startup string for Python says that it's the 32 bit Python [MSC v.1310 32 bit (Intel) ], so I think that's a wild goose chase.) Anyone have any ideas? I'll try to put together a succinct test case that I can share. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue May 12 23:00:30 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 12 May 2009 14:00:30 -0700 Subject: [python-win32] python win-32, 64-bits, and services In-Reply-To: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> References: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> Message-ID: <4A09E36E.5070701@probo.com> Chris Curvey wrote: > I'm attempting to wrap up a Python program and turn it into a service, > using the method listed in Mark Hammond's book (*not* using py2exe). > The program spawns a bunch of threads using the "subprocess" module. The "subprocess" module does not create threads. It creates processes. Processes in Windows run in separate address spaces, with separate file handles. > If I run the program from the command line, everything works fine. If > I run it as a service, any kind of exception seems to stop the > affected thread immediately. Exceptions are not bubbling up to the > relevant try/except block. How do you know this? Remember that the stdout and stderr files for processes are not related to the originating process (unless you created pipes), so if your try/except is printing a message, it's going into empty space. > Anyone have any ideas? I'll try to put together a succinct test case > that I can share. I would be interested in looking at it. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From chris at chriscurvey.com Wed May 13 14:26:16 2009 From: chris at chriscurvey.com (Chris Curvey) Date: Wed, 13 May 2009 08:26:16 -0400 Subject: [python-win32] python win-32, 64-bits, and services In-Reply-To: <4A09E36E.5070701@probo.com> References: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> <4A09E36E.5070701@probo.com> Message-ID: <25ef693e0905130526v1b63903x80380ee337ba5301@mail.gmail.com> On Tue, May 12, 2009 at 5:00 PM, Tim Roberts wrote: > Chris Curvey wrote: > > I'm attempting to wrap up a Python program and turn it into a service, > > using the method listed in Mark Hammond's book (*not* using py2exe). > > The program spawns a bunch of threads using the "subprocess" module. > > The "subprocess" module does not create threads. It creates processes. > Processes in Windows run in separate address spaces, with separate file > handles. As soon as I sent that email, I realized that I had been unclear.. I use both the threading and subprocess libraries. The application is a simple server that reads a database of scheduled jobs, then runs a command in a shell, and mails the output to a distribution list. I want to have several threads running to kick off the shell commands using the subprocess.check_call() function. > > > > > If I run the program from the command line, everything works fine. If > > I run it as a service, any kind of exception seems to stop the > > affected thread immediately. Exceptions are not bubbling up to the > > relevant try/except block. > > How do you know this? Remember that the stdout and stderr files for > processes are not related to the originating process (unless you created > pipes), so if your try/except is printing a message, it's going into > empty space. > I'm using the logging library to log to a file, so I don't think it's the print problem. > > > > Anyone have any ideas? I'll try to put together a succinct test case > > that I can share. > > I would be interested in looking at it. > And I will hope to have a test case for you in a few hours. Thanks! > > > -- > 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 > -- Corruptissima republica plurimae leges -------------- next part -------------- An HTML attachment was scrubbed... URL: From neisen at linbox.com Wed May 13 16:18:34 2009 From: neisen at linbox.com (Nicolas EISEN) Date: Wed, 13 May 2009 16:18:34 +0200 Subject: [python-win32] Extract icon from exe files In-Reply-To: <4A007766.3060804@probo.com> References: <49EC8D1A.9000909@linbox.com> <49ED0732.6050608@probo.com> <49F1D337.8070303@linbox.com> <49F1F035.3020308@probo.com> <49F5D200.3030704@linbox.com> <49F5E646.3060109@probo.com> <49F71BEC.4010608@linbox.com> <49F73A31.2050206@probo.com> <49F9BFAB.7020508@linbox.com> <49F9E97B.3040704@probo.com> <4A000852.4000302@linbox.com> <4A007766.3060804@probo.com> Message-ID: <4A0AD6BA.7030106@linbox.com> Tim Roberts a ?crit : > Nicolas EISEN wrote: > >> I have a last little detail : the icon have the tranparence but the >> bmp take this in black. In win32ui, there are not attribute to set the >> background in white before write the bmp in DC ... an idea ? >> > > Did you do any investigation of this at all? Did you do "dir(hdc)" to > find out what functions are available in a DC? > > hdc.FillSolidRect( (0,0, ico_x, ico_y), 0xffffff ) > > I focus on the idea to found setup constant of the background. And I know now I can draw many time in the same Screen. Thanks for your helping. From chris at chriscurvey.com Wed May 13 17:08:28 2009 From: chris at chriscurvey.com (Chris Curvey) Date: Wed, 13 May 2009 11:08:28 -0400 Subject: [python-win32] python win-32, 64-bits, and services In-Reply-To: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> References: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> Message-ID: <25ef693e0905130808i7ffab0cegdcc1b4284aef4aec@mail.gmail.com> On Tue, May 12, 2009 at 4:08 PM, Chris Curvey wrote: > I'm attempting to wrap up a Python program and turn it into a service, > using the method listed in Mark Hammond's book (*not* using py2exe). The > program spawns a bunch of threads using the "subprocess" module. If I run > the program from the command line, everything works fine. If I run it as a > service, any kind of exception seems to stop the affected thread > immediately. Exceptions are not bubbling up to the relevant try/except > block. > > The only thing I can think of right now is that I'm running on a 64-bit > version of Windows, and that the win32 packages won't fully work in that > environment. (Although the startup string for Python says that it's the 32 > bit Python [MSC v.1310 32 bit (Intel) ], so I think that's a wild goose > chase.) > > Anyone have any ideas? I'll try to put together a succinct test case that > I can share. > > -Chris > I found the problem, but before I wrote a sharable test case. The core of my problem was that I had misconfigured the logging module. (By calling logging.config.fileConfig in two places.). Then what happened was I would try to log something, which would cause an exception to be raised by the logging module. And the default behavior for the logging module is to print errors to stdout, which does not exist because we're running in a thread. So there were several solutions to this problem. 1) Don't misconfigure the loggin module (duh!), or 2) set logging.raiseExceptions = 0, so that internal exceptions in the logging module are not raised, or 3) Write my own custom logging handler and override the handleError() method so that it does not try to write to stdout. Thanks for the help! -Chris -- Corruptissima republica plurimae leges -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Thu May 14 00:24:17 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 14 May 2009 08:24:17 +1000 Subject: [python-win32] Vista64 Jet In-Reply-To: <91882ea90905110616p667962f6oa3a03aa573b30cde@mail.gmail.com> References: <91882ea90905110616p667962f6oa3a03aa573b30cde@mail.gmail.com> Message-ID: <4A0B4891.6060203@gmail.com> On 11/05/2009 11:16 PM, Gerdus van Zyl wrote: > I got the same error in visual studio and the solution is to set > compilation to 32bit since jet does not exist for vista-64bit. I have > python64 so how do I tell pywin to use the 32bit version? You can't - you need to use the 32bit version of Python (it works fine on Vista 64) Mark From skippy.hammond at gmail.com Thu May 14 00:27:22 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 14 May 2009 08:27:22 +1000 Subject: [python-win32] python win-32, 64-bits, and services In-Reply-To: <25ef693e0905130808i7ffab0cegdcc1b4284aef4aec@mail.gmail.com> References: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> <25ef693e0905130808i7ffab0cegdcc1b4284aef4aec@mail.gmail.com> Message-ID: <4A0B494A.6040203@gmail.com> On 14/05/2009 1:08 AM, Chris Curvey wrote: > > exception to be raised by the logging module. And the default behavior > for the logging module is to print errors to stdout, which does not > exist because we're running in a thread. FYI, stdout was invalid as it was a service - nothing to do with running in a thread. Cheers, Mark From chris at chriscurvey.com Thu May 14 01:08:14 2009 From: chris at chriscurvey.com (Chris Curvey) Date: Wed, 13 May 2009 19:08:14 -0400 Subject: [python-win32] python win-32, 64-bits, and services In-Reply-To: <4A0B494A.6040203@gmail.com> References: <25ef693e0905121308j44d0daf8haf1f703a48766b15@mail.gmail.com> <25ef693e0905130808i7ffab0cegdcc1b4284aef4aec@mail.gmail.com> <4A0B494A.6040203@gmail.com> Message-ID: <25ef693e0905131608y4342fad4mc2bebb0ddbe674e6@mail.gmail.com> On Wed, May 13, 2009 at 6:27 PM, Mark Hammond wrote: > On 14/05/2009 1:08 AM, Chris Curvey wrote: > >> >> exception to be raised by the logging module. And the default behavior >> for the logging module is to print errors to stdout, which does not >> exist because we're running in a thread. >> > > FYI, stdout was invalid as it was a service - nothing to do with running in > a thread. Aarrrgh. That's what I meant. Stupid error-correcting keyboard is on the frtiz again :) -- Corruptissima republica plurimae leges -------------- next part -------------- An HTML attachment was scrubbed... URL: From gerdusvanzyl at gmail.com Thu May 14 08:34:04 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Thu, 14 May 2009 08:34:04 +0200 Subject: [python-win32] Vista64 Jet In-Reply-To: <4A0B4891.6060203@gmail.com> References: <91882ea90905110616p667962f6oa3a03aa573b30cde@mail.gmail.com> <4A0B4891.6060203@gmail.com> Message-ID: <91882ea90905132334k73fee2ccydff319756c9cc7c9@mail.gmail.com> Ah, ok. Thank you. On Thu, May 14, 2009 at 12:24 AM, Mark Hammond wrote: > On 11/05/2009 11:16 PM, Gerdus van Zyl wrote: > > I got the same error in visual studio and the solution is to set >> compilation to 32bit since jet does not exist for vista-64bit. I have >> python64 so how do I tell pywin to use the 32bit version? >> > > You can't - you need to use the 32bit version of Python (it works fine on > Vista 64) > > Mark > -------------- next part -------------- An HTML attachment was scrubbed... URL: From le.dahut at laposte.net Fri May 15 15:23:02 2009 From: le.dahut at laposte.net (le dahut) Date: Fri, 15 May 2009 15:23:02 +0200 Subject: [python-win32] SourceForge homepage link to pywin32 files Message-ID: <4A0D6CB6.8000405@laposte.net> Hello, I saw on http://sourceforge.net/projects/pywin32/ that the current version is "pywin32 build 213". The "Download" link points to "pywin32 build 212". When browsing files it is possible to get "213" version. Is it a mistake ? K. From mc at mclaveau.com Fri May 15 22:38:27 2009 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 15 May 2009 22:38:27 +0200 Subject: [python-win32] SourceForge homepage link to pywin32 files In-Reply-To: <4A0D6CB6.8000405@laposte.net> References: <4A0D6CB6.8000405@laposte.net> Message-ID: <68A9D99C08E64B7FAEEAE7E6D182DE58@MCI1330> Bonsoir ! Clic sur "Browse all packages" @-salutations -- Michel Claveau From mvilas at gmail.com Sat May 16 04:23:25 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Fri, 15 May 2009 23:23:25 -0300 Subject: [python-win32] WinAppDbg module v1.1 is out! Message-ID: <3fbf862f0905151923n1278b658p7b2397cfeb3bb197@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.1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nytrokiss at gmail.com Sun May 17 11:44:39 2009 From: nytrokiss at gmail.com (James Matthews) Date: Sun, 17 May 2009 12:44:39 +0300 Subject: [python-win32] Fwd: Autosizing column widths in Excel using win32com.client ? In-Reply-To: References: Message-ID: <8a6b8e350905170244q2cce80fjed1e830871eae9ad@mail.gmail.com> ---------- Forwarded message ---------- From: Date: Fri, May 15, 2009 at 7:45 PM Subject: Autosizing column widths in Excel using win32com.client ? To: python-list at python.org Is there a way to autosize the widths of the excel columns as when you double click them manually? -- http://mail.python.org/mailman/listinfo/python-list -- http://www.goldwatches.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Sun May 17 12:00:08 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Sun, 17 May 2009 11:00:08 +0100 Subject: [python-win32] Fwd: Autosizing column widths in Excel using win32com.client ? In-Reply-To: <8a6b8e350905170244q2cce80fjed1e830871eae9ad@mail.gmail.com> References: <8a6b8e350905170244q2cce80fjed1e830871eae9ad@mail.gmail.com> Message-ID: <4A0FE028.5030908@timgolden.me.uk> James Matthews wrote: > ---------- Forwarded message ---------- > From: > Date: Fri, May 15, 2009 at 7:45 PM > Subject: Autosizing column widths in Excel using win32com.client ? > To: python-list at python.org > > > Is there a way to autosize the widths of the excel columns as when you > double click them manually? Usual answer to this kind of question: record a macro in Excel to do what you want, and then use COM to automate that. On my Excel 2007, this is the VBA result of recording: Sub Macro2() ' ' Macro2 Macro ' ' Columns("A:A").Select Range(Selection, Selection.End(xlToRight)).Select Columns("A:D").EntireColumn.AutoFit End Sub You then just fire up win32com.client or comtypes, according to taste and go from there. If you need help with the COM side of things, post back here. TJG From winterttr at gmail.com Mon May 18 05:31:09 2009 From: winterttr at gmail.com (winterTTr) Date: Mon, 18 May 2009 11:31:09 +0800 Subject: [python-win32] about thre return value from pycom server Message-ID: I recently write a com server as shell extension . And , i want to implement a interface call "IQueryInfo" which you can find some information about it via MSDN . As I can't find it the pythoncom , i implement it using the TypeLibrary as following lines. [shell_extension.idl] ----------------from------------------------- [ object, uuid(00021500-0000-0000-C000-000000000046), helpstring("IQueryInfo Interface"), pointer_default(unique) ] interface IQueryInfo : IUnknown { HRESULT GetInfoFlags ([out] long * pdwFlags); HRESULT GetInfoTip([in] long dwFlags , [out] wchar_t ** ppwszTip); }; -----------------to------------------------------- and implement the interface function as follow # it is a member function of a class def GetInfoFlags(self ): return 0 when i run the code , the program ( which is explore.exe ) crashed , my god ! 0_0 i analyze the win32com code , and find that the program crashed when running the code in [universal.py] as follow : WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) As i know , this function may write the return value to caller of the com server . As the interface defined , maybe i show return a pointer of long as return value , not long itself. So "return 0" may cause the access violation. Question is : how can i deal with this case ? I don't know how to return a long pointer to the caller in py code. or may be there is another way to solve this problem , any advise ? Thx. From durumdara at gmail.com Mon May 18 09:48:31 2009 From: durumdara at gmail.com (Durumdara) Date: Mon, 18 May 2009 09:48:31 +0200 Subject: [python-win32] Pylons as service... Message-ID: <9e384ef60905180048h682c0633k73b01d8b7019573@mail.gmail.com> Hi! I have two questions about Windows and Pylons... http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service 1.) I wanna ask something about python services. http://groups.google.hu/group/pylons-discuss/browse_thread/thread/f54d8208c3be555e Yesterday I tried to install two of pylons services. Interesting thing I saw. Every of the installed services are have SAME EXE without any information to identify, which pylons site is need to start... I have never seen same thing before, so I don't understand, which information is have PythonService.exe to know which windowsservice.py need to start... Is service name passed to PS.EXE by OS? I saw that in registry the service is have all data it needed. But how to know this ONE EXE, which service started it, and which *.py can it use to start? 2.) The service stopping is not correct: The Python service control handler failed. File "C:\Python25\lib\site-packages\win32\lib\win32serviceutil.py", line 791, in ServiceCtrlHandlerEx self.SvcStop() File "c:\web\pylons\xxx\WindowsService.py", line 91, in SvcStop sys.exit() : If I changed it to sys.exit(0), or (1), I also got this message... This is a tutorial site, so I don't know, what is the good way to out of service... Thanks for your help: dd -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon May 18 19:50:00 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 18 May 2009 10:50:00 -0700 Subject: [python-win32] Pylons as service... In-Reply-To: <9e384ef60905180048h682c0633k73b01d8b7019573@mail.gmail.com> References: <9e384ef60905180048h682c0633k73b01d8b7019573@mail.gmail.com> Message-ID: <4A119FC8.6040107@probo.com> Durumdara wrote: > > 1.) > I wanna ask something about python services. > ... > Yesterday I tried to install two of pylons services. > Interesting thing I saw. > > Every of the installed services are have SAME EXE without any > information to identify, which pylons site is need to start... > I have never seen same thing before, so I don't understand, which > information is have PythonService.exe to know which windowsservice.py > need to start... > > Is service name passed to PS.EXE by OS? Well, yes and no. Remember that the service script initializes itself. It contains all of the code necessary to register itself with the operating system. Part of that registration process involves specifying the exact command line that must be run to start the service. The service NAME isn't important at all. That's only used for filing, so to speak. It's the command line that identifies the script to be run. > I saw that in registry the service is have all data it needed. But how > to know this ONE EXE, which service started it, and which *.py can it > use to start? It's all on the command line that gets registered by the service script. The exact same thing is true of any long-running Python scripts. If you have 10 different normal Python applications running, as far as the operating system is concerned, all 10 of them are called "python.exe" (or "pythonw.exe"). If you look in Task Manager, that's exactly what you'll see. The personality of the application comes from the script that is being run, but that's just a data file that gets passed to the interpreter exe. > 2.) The service stopping is not correct: > > The Python service control handler failed. > File "C:\Python25\lib\site-packages\win32\lib\win32serviceutil.py", > line 791, in ServiceCtrlHandlerEx > self.SvcStop() > File "c:\web\pylons\xxx\WindowsService.py", line 91, in SvcStop > sys.exit() > : > > If I changed it to sys.exit(0), or (1), I also got this message... Why do you think this is not correct? You are only seeing that because you are running this application within a command shell, or some other environment where you see these log messages. Ordinarily, if this is being run as a service in the background, you wouldn't see that message. It's true that this is not the normal way to stop a service. You'll see in that same Pylons script that they have commented out a call to assert the "stop_event" event, which the SvcDoRun function is blocked on. That's the normal way. SvcStop sets an event, which allows SvcDoRun to return. When SvcDoRun returns, the service exits. However, the sys.exit method also works. It's just that you get this little traceback -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From santosh.mce at gmail.com Tue May 19 13:47:14 2009 From: santosh.mce at gmail.com (SantoshMohan) Date: Tue, 19 May 2009 04:47:14 -0700 (PDT) Subject: [python-win32] Re ading date from PYTime Message-ID: <23614659.post@talk.nabble.com> Hi, I am writing a script to read date from xls file. Output is like this: >>>emptylist [((u'Name', u'DOB'),), ((u'C R RAMESH', ),), ((u'G SIVA RAMA KRISHNAIAH', ),)] >>> emptylist[1] ((u'C R RAMESH', ),) >>> value ((u'C R RAMESH', ),) >>> value[0][1] How to read the date and Time? -- View this message in context: http://www.nabble.com/Reading-date-from-PYTime-tp23614659p23614659.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From mail at timgolden.me.uk Tue May 19 14:07:53 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 19 May 2009 13:07:53 +0100 Subject: [python-win32] Re ading date from PYTime In-Reply-To: <23614659.post@talk.nabble.com> References: <23614659.post@talk.nabble.com> Message-ID: <4A12A119.1060106@timgolden.me.uk> SantoshMohan wrote: > Hi, > > I am writing a script to read date from xls file. > > Output is like this: > >>>> emptylist > [((u'Name', u'DOB'),), ((u'C R RAMESH', ),), > ((u'G SIVA RAMA KRISHNAIAH', ),)] > >>>> emptylist[1] > ((u'C R RAMESH', ),) > >>>> value > ((u'C R RAMESH', ),) >>>> value[0][1] > > > How to read the date and Time? http://timgolden.me.uk/python/win32_how_do_i/use-a-pytime-value.html TJG From mail at timgolden.me.uk Tue May 19 14:43:48 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 19 May 2009 13:43:48 +0100 Subject: [python-win32] Distutils changes broke pywin32 build Message-ID: <4A12A984.6080101@timgolden.me.uk> Something in the changes to build_ext.py in r72585 has broken the setup.py build for pywin32: http://svn.python.org/view/python/trunk/Lib/distutils/command/build_ext.py?r1=72531&r2=72585&pathrev=72585 The symptom is that pywintypes.lib is created in the build directory, but distutils is then looking to copy pywintypes27.lib (note the version suffix): error: can't copy 'build\temp.win32-2.7\Release\win32\src\pywintypes27.lib': doesn't exist or not a regular file The error is also present in the release26-maint branch. I've just started to try to work out where exactly the problem lies and whether it's an ill-tested distutils change or a false assumption in the pywin32 setup.py. Or something else. Since distutils is a notorious maze of twisty modules, all alike, and since the pywin32 setup.py is hardly a model of simplicity, if anyone has immediate insights I'd be glad to hear them. Thanks TJG From fuzzyman at gmail.com Tue May 19 15:43:17 2009 From: fuzzyman at gmail.com (Michael Foord) Date: Tue, 19 May 2009 14:43:17 +0100 Subject: [python-win32] Distutils changes broke pywin32 build In-Reply-To: <4A12A984.6080101@timgolden.me.uk> References: <4A12A984.6080101@timgolden.me.uk> Message-ID: <6f4025010905190643m29cb9017pe901da43907a597b@mail.gmail.com> Distutils is undergoing heavy changes in the hands of Tarek Ziade. One of the changes is drastically improving the test coverage. I would definitely discuss the problem with him (directly or on distutils-sig) as he will want to know about it - either to explain why the change is necessary and help you modify the pywin32 setup.py or to revert the change. Michael Foord 2009/5/19 Tim Golden > Something in the changes to build_ext.py in r72585 has broken the setup.py > build for pywin32: > > > http://svn.python.org/view/python/trunk/Lib/distutils/command/build_ext.py?r1=72531&r2=72585&pathrev=72585 > > The symptom is that pywintypes.lib is created in the > build directory, but distutils is then looking to > copy pywintypes27.lib (note the version suffix): > > error: can't copy > 'build\temp.win32-2.7\Release\win32\src\pywintypes27.lib': doesn't exist or > not a regular file > > The error is also present in the release26-maint branch. > > I've just started to try to work out where exactly the problem > lies and whether it's an ill-tested distutils change or a false > assumption in the pywin32 setup.py. Or something else. > > Since distutils is a notorious maze of twisty modules, all alike, > and since the pywin32 setup.py is hardly a model of simplicity, > if anyone has immediate insights I'd be glad to hear them. > > Thanks > > TJG > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.ironpythoninaction.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue May 19 15:44:05 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 19 May 2009 14:44:05 +0100 Subject: [python-win32] Distutils changes broke pywin32 build In-Reply-To: <4A12A984.6080101@timgolden.me.uk> References: <4A12A984.6080101@timgolden.me.uk> Message-ID: <4A12B7A5.9000207@timgolden.me.uk> Tim Golden wrote: > Something in the changes to build_ext.py in r72585 has broken the > setup.py build for pywin32: > > http://svn.python.org/view/python/trunk/Lib/distutils/command/build_ext.py?r1=72531&r2=72585&pathrev=72585 Well, in short, it's a change in the way in which package prefixes are used when retrieving the filename in pywin32's setup.py at lines 1123ff. As it stands, none of the if conditions in that function are firing, because the package-qualified name is never passed in. Therefore the default build_ext.get_ext_filename is called and the version info is never added to the filename. I've posted this here because I don't know whether to characterise this is a bug on the Python tracker or on the pywin32 one. Opinions sought... TJG From mail at timgolden.me.uk Tue May 19 15:46:01 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 19 May 2009 14:46:01 +0100 Subject: [python-win32] Distutils changes broke pywin32 build In-Reply-To: <6f4025010905190643m29cb9017pe901da43907a597b@mail.gmail.com> References: <4A12A984.6080101@timgolden.me.uk> <6f4025010905190643m29cb9017pe901da43907a597b@mail.gmail.com> Message-ID: <4A12B819.9040605@timgolden.me.uk> Michael Foord wrote: > Distutils is undergoing heavy changes in the hands of Tarek Ziade. One of > the changes is drastically improving the test coverage. > > I would definitely discuss the problem with him (directly or on > distutils-sig) as he will want to know about it - either to explain why the > change is necessary and help you modify the pywin32 setup.py or to revert > the change. > > Michael Foord Thanks, Michael. I'll go over to distutils-sig. (Not my usual stamping ground :) ). TJG From durumdara at gmail.com Tue May 19 16:53:03 2009 From: durumdara at gmail.com (Durumdara) Date: Tue, 19 May 2009 16:53:03 +0200 Subject: [python-win32] Pylons as service... In-Reply-To: <4A119FC8.6040107@probo.com> References: <9e384ef60905180048h682c0633k73b01d8b7019573@mail.gmail.com> <4A119FC8.6040107@probo.com> Message-ID: <9e384ef60905190753v47ac23c0u9e2c20f76df21f9b@mail.gmail.com> Dear Tim! 2009/5/18 Tim Roberts > Durumdara wrote: > > > > 1.) > > I wanna ask something about python services. > > ... > > Yesterday I tried to install two of pylons services. > > Interesting thing I saw. > > > > Every of the installed services are have SAME EXE without any > > information to identify, which pylons site is need to start... > > I have never seen same thing before, so I don't understand, which > > information is have PythonService.exe to know which windowsservice.py > > need to start... > > > > Is service name passed to PS.EXE by OS? > > Well, yes and no. Remember that the service script initializes itself. Ok, I know it. > > It contains all of the code necessary to register itself with the > operating system. Part of that registration process involves specifying > the exact command line that must be run to start the service. > > The service NAME isn't important at all. That's only used for filing, > so to speak. It's the command line that identifies the script to be run. One thing I don't understand that Image Path is "" (in this machine): "C:\Python25\lib\site-packages\win32\PythonService.exe" Only pointer to WindowsService script is: "PythonClass:default" = "c:\web\pylons\xxx\WindowsService.MyService" The thing I don't know if PythonService is used by Service system without any parameters then how to find this exe the PythonClass that need to be call? > > > > > I saw that in registry the service is have all data it needed. But how > > to know this ONE EXE, which service started it, and which *.py can it > > use to start? > > It's all on the command line that gets registered by the service script. I see the registration in registry/services, but only thing I don't know that how do know the PS.EXE (calling without any params ) where to look for PythonClass parameter? > > > The exact same thing is true of any long-running Python scripts. If you > have 10 different normal Python applications running, as far as the > operating system is concerned, all 10 of them are called "python.exe" > (or "pythonw.exe"). If you look in Task Manager, that's exactly what > you'll see. The personality of the application comes from the script > that is being run, but that's just a data file that gets passed to the > interpreter exe. Yes, but when I start a python file, I see infos in Process Explorer: Path: C:\Python25\python.exe Command line: "C:\Python25\python.exe" "c:\d\testdirname.py" Curr. dir: "C:\D\" When I check the service, the result is: Path: C:\Python25\lib\site-packages\win32\PythonService.exe Commad line: Cur dir: "c:\web\pylons\xxx\" > > > > > 2.) The service stopping is not correct: > > > > The Python service control handler failed. > > File "C:\Python25\lib\site-packages\win32\lib\win32serviceutil.py", > > line 791, in ServiceCtrlHandlerEx > > self.SvcStop() > > File "c:\web\pylons\xxx\WindowsService.py", line 91, in SvcStop > > sys.exit() > > : > > > > If I changed it to sys.exit(0), or (1), I also got this message... > > Why do you think this is not correct? Because I hate if my programs are use Event Log as trash... :-( > You are only seeing that because > you are running this application within a command shell, or some other > environment where you see these log messages. Ordinarily, if this is > being run as a service in the background, you wouldn't see that message. Yes. > > > It's true that this is not the normal way to stop a service. You'll see > in that same Pylons script that they have commented out a call to assert > the "stop_event" event, which the SvcDoRun function is blocked on. > That's the normal way. SvcStop sets an event, which allows SvcDoRun to > return. When SvcDoRun returns, the service exits. However, the > sys.exit method also works. It's just that you get this little traceback When I removed the sys.exit(), it is also working without any error log Event: def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) #win32event.SetEvent(self.stop_event) self.ReportServiceStatus(win32service.SERVICE_STOPPED) #sys.exit(1) Thanks for your help: dd -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Tue May 19 17:18:38 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 19 May 2009 16:18:38 +0100 Subject: [python-win32] Distutils changes broke pywin32 build In-Reply-To: <4A12A984.6080101@timgolden.me.uk> References: <4A12A984.6080101@timgolden.me.uk> Message-ID: <4A12CDCE.1010407@timgolden.me.uk> Tim Golden wrote: > Something in the changes to build_ext.py in r72585 has broken the > setup.py build for pywin32: [... after discussions on distutils-sig ... http://mail.python.org/pipermail/distutils-sig/2009-May/011901.html ] Looking like it's an issue in distutils. Tarek's said he'll get a fix & test in place. TJG From nkamado at gmail.com Tue May 19 17:21:59 2009 From: nkamado at gmail.com (=?ISO-2022-JP?B?GyRCM3lFWjUtTkkbKEI=?=) Date: Wed, 20 May 2009 00:21:59 +0900 Subject: [python-win32] I was able to use pyInstaller as a python library Message-ID: <4A12CE97.9000206@gmail.com> Hello, Everyone. I was able to use pyInstaller as a python library http://moco.sakura.ne.jp/pyInstaller.zip and This library test code is available in http://moco.sakura.ne.jp/pyi_test.zip This library implements only a function to output windows binary. and I don't add the change to the contents of the pyinstaller directory. Thanking you in advance. // Noriyoshi Kamado : nkamado at gmail.com From timr at probo.com Tue May 19 19:42:43 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 19 May 2009 10:42:43 -0700 Subject: [python-win32] Pylons as service... In-Reply-To: <9e384ef60905190753v47ac23c0u9e2c20f76df21f9b@mail.gmail.com> References: <9e384ef60905180048h682c0633k73b01d8b7019573@mail.gmail.com> <4A119FC8.6040107@probo.com> <9e384ef60905190753v47ac23c0u9e2c20f76df21f9b@mail.gmail.com> Message-ID: <4A12EF93.9060908@probo.com> Durumdara wrote: > > > > The service NAME isn't important at all. That's only used for filing, > so to speak. It's the command line that identifies the script to > be run. > > > One thing I don't understand that Image Path is "" (in this machine): > "C:\Python25\lib\site-packages\win32\PythonService.exe" > > Only pointer to WindowsService script is: > "PythonClass:default" = "c:\web\pylons\xxx\WindowsService.MyService" > > The thing I don't know if PythonService is used by Service system > without any parameters then how to find this exe the PythonClass that > need to be call? Well, that's because what I said was not correct... The service name is passed to PythonService.exe (as a parameter to the ServiceMain callback). PythonService then goes out to the matching key in the registry (HKLM\System\CurrentControlSet\Services\service_name) and gets the value from the PythonClass default value. That's how it knows which file to load and which class to instantiate. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From benoit.prigent at raisonance.com Wed May 20 09:13:44 2009 From: benoit.prigent at raisonance.com (=?ISO-8859-1?Q?Beno=EEt_Prigent?=) Date: Wed, 20 May 2009 09:13:44 +0200 Subject: [python-win32] Passing arrays by reference Message-ID: <4A13ADA8.1040807@raisonance.com> Hi all, I found a thread that it similar to what I'm looking for: http://mail.python.org/pipermail/python-win32/2002-November/000562.html but I couldn't come up with a solution... I have a C++ server with a COM interface, which I can access via JScript without any problem, but when it comes to Python, it seems impossible to pass an array from the server to the Python script by reference. C++ method declaration (the method just copies BufIn into BufOut): STDMETHODIMP CoServer::EchoArray( VARIANT BufIn, VARIANT * BufOut, ULONG* retVal) IDL: [id(1), helpstring("method EchoArray")] HRESULT EchoArray( [in] VARIANT BufIn, [out] VARIANT* BufOut, [out,retval] ULONG* retVal); for this one, I tried to replace "[out] VARIANT* BufOut" by "[in,out] VARIANT* BufOut" or by "[in] VARIANT BufOut" without any success. Python script: import win32com.client import time import os Server = win32com.client.Dispatch("MyObject.Server") ans = [1,2,3] Server.EchoArray([0x11,0x22,0x33], ans) print ans # I am expecting ans=[0x11,0x22,0x33] # but ans remains as defined earlier ans=[1,2,3] Does anyone know how to pass an array by reference from a COM interface to a Python script? Thank you! Ben -- Beno?t Prigent Hardware Engineer _______________________________________ Raisonance SAS 17 avenue Jean Kuntzmann 38330 Montbonnot Saint Martin France Phone: +33 (0)4 76 61 02 39 Fax: +33 (0)4 76 41 81 68 Email: benoit.prigent at raisonance.com Internet: http://www.raisonance.com From santosh.mce at gmail.com Wed May 20 12:15:36 2009 From: santosh.mce at gmail.com (SantoshMohan) Date: Wed, 20 May 2009 03:15:36 -0700 (PDT) Subject: [python-win32] Re ading date from PYTime In-Reply-To: <4A12A119.1060106@timgolden.me.uk> References: <23614659.post@talk.nabble.com> <4A12A119.1060106@timgolden.me.uk> Message-ID: <23632681.post@talk.nabble.com> Found another way : >>> print emptylist [((u'Name', u'DOB'),), ((u'C R RAMESH', ),), ((u'G SIVA RAMA KRISHNAIAH', ),)] >>> v=emptylist[1][0] >>> v (u'C R RAMESH', ) >>> v_date=v[1].Format().split()[0] >>> print v_date 07/13/61 Tim Golden-4 wrote: > > SantoshMohan wrote: >> Hi, >> >> I am writing a script to read date from xls file. >> >> Output is like this: >> >>>>> emptylist >> [((u'Name', u'DOB'),), ((u'C R RAMESH', > AM>),), >> ((u'G SIVA RAMA KRISHNAIAH', ),)] >> >>>>> emptylist[1] >> ((u'C R RAMESH', ),) >> >>>>> value >> ((u'C R RAMESH', ),) >>>>> value[0][1] >> >> >> How to read the date and Time? > > http://timgolden.me.uk/python/win32_how_do_i/use-a-pytime-value.html > > TJG > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- View this message in context: http://www.nabble.com/Reading-date-from-PYTime-tp23614659p23632681.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From randy at rcs-comp.com Wed May 20 17:18:01 2009 From: randy at rcs-comp.com (Randy Syring) Date: Wed, 20 May 2009 11:18:01 -0400 Subject: [python-win32] adodbapi and stored procedure output parameters on MSSQL Message-ID: <4A141F29.8040907@rcs-comp.com> I found this post: http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters which was helpful in getting me started. However, that method does not yield the output parameters if a recordset is output in the SP. So, if my SP is: CREATE PROCEDURE sp_test_only_output @param INTEGER OUTPUT AS BEGIN select @param = 10 END Then: assert [10] == self.cur.callproc('sp_test_only_output',(999,)) But, if my SP is: CREATE PROCEDURE sp_test_output_and_select @param INTEGER OUTPUT AS BEGIN select 'one', 'two' select @param = 10 END then: self.cur.callproc('sp_test_output_and_select',(999,)) == [999] A full test that can be run with Nose: http://paste.pocoo.org/show/118219/ Can you please help me figure out what is going on. I realize output parameters are not the best solution, but I am working with systems that I can't change the SPs on and would like to use Python rather than be forced into using a different language. Thank you! -- -------------------------------------- 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 timr at probo.com Wed May 20 19:27:50 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 20 May 2009 10:27:50 -0700 Subject: [python-win32] Passing arrays by reference In-Reply-To: <4A13ADA8.1040807@raisonance.com> References: <4A13ADA8.1040807@raisonance.com> Message-ID: <4A143D96.8090002@probo.com> Beno?t Prigent wrote: > Hi all, > > I found a thread that it similar to what I'm looking for: > http://mail.python.org/pipermail/python-win32/2002-November/000562.html > but I couldn't come up with a solution... > > I have a C++ server with a COM interface, which I can access via JScript > without any problem, but when it comes to Python, it seems impossible to > pass an array from the server to the Python script by reference. Right. There is just no way to do that in Python. Thus, [out] parameters are generally returned to you as outputs from the function. I'm guessing you need something like this: ans = [1,2,3] (rc,ans) = Server.EchoArray([0x11,0x22,0x33]) print ans -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From iceblink at chello.nl Wed May 20 19:52:37 2009 From: iceblink at chello.nl (Patrick Asselman) Date: Wed, 20 May 2009 19:52:37 +0200 Subject: [python-win32] (no subject) Message-ID: How would i translate a bit of visual basic code like below to Python? Range("F7").Select Selection.Copy Range("CO7").Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False I'm trying to copy the formatting of one cell to another cell. The above code is made with Excel macro. Is there any pywin32 documentation on the implementation of MS Office code in Python, or maybe on how one would go about to discover this? I've looked on the web but didn't find any definitive reference on this? Best regards, Patrick Asselman From timr at probo.com Wed May 20 20:24:35 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 20 May 2009 11:24:35 -0700 Subject: [python-win32] (no subject) In-Reply-To: References: Message-ID: <4A144AE3.10009@probo.com> Patrick Asselman wrote: > How would i translate a bit of visual basic code like below to Python? > > Range("F7").Select > Selection.Copy > Range("CO7").Select > Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ > SkipBlanks:=False, Transpose:=False > > I'm trying to copy the formatting of one cell to another cell. The > above code is made with Excel macro. > > Is there any pywin32 documentation on the implementation of MS Office > code in Python, or maybe on how one would go about to discover this? > I've looked on the web but didn't find any definitive reference on this? The main difference is that function calls in Python always require parentheses, and the constants live in a different address space. This does what you do above (assuming Excel is already open): import win32com.client from win32com.client import constants excel = win32com.client.Dispatch("Excel.Application") excel.Range("F7").Select() excel.Selection.Copy() excel.Range("CO7").Select() excel.Selection.PasteSpecial( Paste=constants.xlPasteFormats ) The win32com.client constants only get imported if you have run makepy on the Excel.Application typelib. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nytrokiss at gmail.com Wed May 20 23:27:38 2009 From: nytrokiss at gmail.com (James Matthews) Date: Thu, 21 May 2009 00:27:38 +0300 Subject: [python-win32] Fwd: URGENT! Changing IE PAC Settings with Python In-Reply-To: <5caea3690905200906w1c11bb08yf6068ee831038287@mail.gmail.com> References: <5caea3690905200906w1c11bb08yf6068ee831038287@mail.gmail.com> Message-ID: <8a6b8e350905201427m3662232uca318cd1e652c5a5@mail.gmail.com> ---------- Forwarded message ---------- From: K-Dawg Date: Wed, May 20, 2009 at 7:06 PM Subject: URGENT! Changing IE PAC Settings with Python To: python-list at python.org Hello, Thanks for any response. I am in a crisis where one of our networking guys moved where our PAC file is housed. There was a group policy set in Active Directory that set the PAC file location in Internet Explorer to the new location. However, we have 100 remote centers that have about 3 to 4 machines that are not on AD (from before an AD migration). These machines did not receive the update. Is there a way I can write a python script to run from my machine to jump out to a list -- Kevin Holleran Master of Science, Computer Information Systems Grand Valley State University Master of Business Administration Western Michigan University Completion December 2009 CCNA, ISA, MCSA, MCDST, MCP "We are what we repeatedly do. Excellence, then, is not an act, but a habit." - Aristotle "A man flattened by an opponent can get up again. A man flattened by conformity stays down for good. " - Thomas J. Watson -- http://mail.python.org/mailman/listinfo/python-list -- http://www.goldwatches.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed May 20 23:39:50 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 20 May 2009 14:39:50 -0700 Subject: [python-win32] Fwd: URGENT! Changing IE PAC Settings with Python In-Reply-To: <8a6b8e350905201427m3662232uca318cd1e652c5a5@mail.gmail.com> References: <5caea3690905200906w1c11bb08yf6068ee831038287@mail.gmail.com> <8a6b8e350905201427m3662232uca318cd1e652c5a5@mail.gmail.com> Message-ID: <4A1478A6.2010502@probo.com> James Matthews wrote: > > ---------- Forwarded message ---------- > From: *K-Dawg* > > Date: Wed, May 20, 2009 at 7:06 PM > > Thanks for any response. I am in a crisis where one of our networking > guys moved where our PAC file is housed. There was a group policy set > in Active Directory that set the PAC file location in Internet > Explorer to the new location. > > However, we have 100 remote centers that have about 3 to 4 machines > that are not on AD (from before an AD migration). These machines did > not receive the update. > > Is there a way I can write a python script to run from my machine to > jump out to a list http://nscsysop.hypermart.net/proxypac.html If permissions happen to be set so that you can connect to the registries on those remote machines, you may be able to follow the instructions here: http://nscsysop.hypermart.net/setproxy.html This might be a good excuse to force your stragglers into the domain. There is certainly good justification for doing so. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Dominick.Lauzon at MSCsoftware.com Thu May 21 15:09:24 2009 From: Dominick.Lauzon at MSCsoftware.com (Dominick Lauzon) Date: Thu, 21 May 2009 09:09:24 -0400 Subject: [python-win32] Converting types for deep lists or Discitonnaries Message-ID: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> I need to convert a multi-level and multi-type list and dictionary (keys and values) to string format. Is there a way to do this globally rather than iterating item to str(item)? Dominick Lauzon ing. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu May 21 15:27:31 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 21 May 2009 14:27:31 +0100 Subject: [python-win32] Converting types for deep lists or Discitonnaries In-Reply-To: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> References: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> Message-ID: <4A1556C3.3000809@timgolden.me.uk> Dominick Lauzon wrote: > I need to convert a multi-level and multi-type list and dictionary (keys > and values) to string format. > > Is there a way to do this globally rather than iterating item to > str(item)? Not really a win32-specific question... but it's the kind of thing which gets asked and answered fairly frequently on the main python list: http://mail.python.org/mailman/listinfo/python-list and in the ActiveState cookbook: http://www.activestate.com/ASPN/Python/Cookbook/ (the key terms are "flattening" and "pretty print") and someone recently recommended Armin Ronachers pretty: http://lucumr.pocoo.org/2007/10/21/pretty-a-python-pprint-successor TJG From timr at probo.com Thu May 21 18:46:39 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 21 May 2009 09:46:39 -0700 Subject: [python-win32] Converting types for deep lists or Discitonnaries In-Reply-To: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> References: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> Message-ID: <4A15856F.1020408@probo.com> Dominick Lauzon wrote: > > I need to convert a multi-level and multi-type list and dictionary > (keys and values) to string format. > > > > Is there a way to do this globally rather than iterating item to > str(item)? > One easy way is to use pprint.pformat. Many folks use pprint to do pretty printing of nested data structures, but the module also contains a pformat function that returns a string: C:\VS9\VC\bin>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. >>> a = [ 1, 2, [ '333', { 'a': 42, 'b': 43 }, 777 ], (99, 100) ] >>> import pprint >>> a = pprint.pformat(a) >>> print a [1, 2, ['333', {'a': 42, 'b': 43}, 777], (99, 100)] >>> The string can be converted back to a data structure using eval, with appropriate caution. There's also the option of using "pickle", which was designed to serialize and deserialize Python data structures. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu May 21 19:36:54 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 21 May 2009 10:36:54 -0700 Subject: [python-win32] Converting types for deep lists or Discitonnaries In-Reply-To: <18965.36184.672977.254048@gargle.gargle.HOWL> References: <589DC3F5067BDD479AAAE54CE398166DAF825E@NAAAEX01.na.mscsoftware.com> <4A15856F.1020408@probo.com> <18965.36184.672977.254048@gargle.gargle.HOWL> Message-ID: <4A159136.4030600@probo.com> Paul Koning wrote: >>>>>> "Tim" == Tim Roberts writes: >>>>>> > > > Tim> The string can be converted back to a data structure using eval, > Tim> with appropriate caution. > > How is that different from the builtin function "repr"? > In this particular case, they happen to produce the same output. If the sample data set were larger, you'd see that pprint adds newlines and white space to make the output line up neatly for human readers, and at the appropriate indentation level. repr just makes one big line. It all depends on what the OP intends to do with the string. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From le.dahut at laposte.net Fri May 22 12:04:52 2009 From: le.dahut at laposte.net (le dahut) Date: Fri, 22 May 2009 12:04:52 +0200 Subject: [python-win32] CreateURLMonikerEx and Win2000 Message-ID: <4A1678C4.3090105@laposte.net> 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 ? K. From rwupole at msn.com Fri May 22 14:13:16 2009 From: rwupole at msn.com (Roger Upole) Date: Fri, 22 May 2009 08:13:16 -0400 Subject: [python-win32] Re: CreateURLMonikerEx and Win2000 Message-ID: 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 ? > > > K. On machines with older versions of IE, this function may not be present in urlmon.dll. This has been fixed since the release of build 213. Roger From le.dahut at laposte.net Fri May 22 14:27:50 2009 From: le.dahut at laposte.net (le dahut) Date: Fri, 22 May 2009 14:27:50 +0200 Subject: [python-win32] CreateURLMonikerEx and Win2000 In-Reply-To: References: Message-ID: <4A169A46.5030505@laposte.net> Roger Upole wrote : > > 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 ? >> >> >> K. > > On machines with older versions of IE, this function may not > be present in urlmon.dll. This has been fixed since the release > of build 213. > > Roger > Which version of IE ? On my w2k I have IE 5.0. Thanks for the answer. From rwupole at msn.com Fri May 22 14:50:38 2009 From: rwupole at msn.com (Roger Upole) Date: Fri, 22 May 2009 08:50:38 -0400 Subject: [python-win32] Re: adodbapi and stored procedure output parameters on Message-ID: Randy Syring wrote: >I found this post: > > http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters > > which was helpful in getting me started. However, that method does not > yield the output parameters if a recordset is output in the SP. So, if > my SP is: > > CREATE PROCEDURE sp_test_only_output > @param INTEGER OUTPUT > AS > BEGIN > select @param = 10 > END > > Then: > > assert [10] == self.cur.callproc('sp_test_only_output',(999,)) > > But, if my SP is: > > CREATE PROCEDURE sp_test_output_and_select > @param INTEGER OUTPUT > AS > BEGIN > select 'one', 'two' > select @param = 10 > END > > then: > > self.cur.callproc('sp_test_output_and_select',(999,)) == [999] > > A full test that can be run with Nose: http://paste.pocoo.org/show/118219/ > > Can you please help me figure out what is going on. I realize output > parameters are not the best solution, but I am working with systems that > I can't change the SPs on and would like to use Python rather than be > forced into using a different language. > > Thank you! > I've run into this somewhere before. It turns out that the output parms are actually returned as an extra recordset, so you need to call NextRecordset before trying to access them. >From digging into the source, if you add rs.NextRecordset() at line 741 of adodbapi.py, the output parm is returned as expected. Roger From timr at probo.com Fri May 22 18:52:43 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 22 May 2009 09:52:43 -0700 Subject: [python-win32] CreateURLMonikerEx and Win2000 In-Reply-To: <4A169A46.5030505@laposte.net> References: <4A169A46.5030505@laposte.net> Message-ID: <4A16D85B.8060802@probo.com> le dahut wrote: > > Roger Upole wrote : >> >> 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 ? >> >> On machines with older versions of IE, this function may not >> be present in urlmon.dll. This has been fixed since the release >> of build 213. > > Which version of IE ? > On my w2k I have IE 5.0. Google would have brought you to the MSDN page for CreateURLMonikerEx, which says IE 5.5. The MSDN pages are usually very good about identifying the minimum versions required for each API. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rwupole at msn.com Fri May 22 14:54:56 2009 From: rwupole at msn.com (Roger Upole) Date: Fri, 22 May 2009 08:54:56 -0400 Subject: [python-win32] Re: CreateURLMonikerEx and Win2000 Message-ID: According to MSDN, it was added in IE 5.5. Roger From emad.khan0t7 at gmail.com Sat May 23 02:48:21 2009 From: emad.khan0t7 at gmail.com (Emad Khan) Date: Fri, 22 May 2009 20:48:21 -0400 Subject: [python-win32] writing hyphenated values in csv Message-ID: <3c1542370905221748q77f90c9aq8f0d50c670284272@mail.gmail.com> Hello, I am trying to write a hyphenated value in a csv file but I don't want this value to be auto corrected to a date. Whenever I write a value, for example, "3-10", it is changed to 03/10/2009 or 03-oct. How can I prevent this from happening. I would like to see the value remain to be "3-10". Any help would be greatly appreciated. Thanks, Emad -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Sat May 23 02:58:00 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 22 May 2009 17:58:00 -0700 Subject: [python-win32] writing hyphenated values in csv In-Reply-To: <3c1542370905221748q77f90c9aq8f0d50c670284272@mail.gmail.com> References: <3c1542370905221748q77f90c9aq8f0d50c670284272@mail.gmail.com> Message-ID: <4A174A18.1020800@probo.com> Emad Khan wrote: > > I am trying to write a hyphenated value in a csv file but I don't want > this value to be auto corrected to a date. Whenever I write a value, > for example, "3-10", it is changed to 03/10/2009 or 03-oct. > > How can I prevent this from happening. I would like to see the value > remain to be "3-10". You should be more specific. I, for example, understand that it is Excel that is doing this, but you need to mention that. It's not really a CSV or Python problem at all -- it's an Excel problem. The answer, in this case, is to put an equals sign in front of the quoted value. Thus this file: 123,3-10,"3-10",=3-10,="3-10" gets imported as 123 10-Mar 10-Mar -7 3-10 Again, however, this is just an Excel quirk. If you need to import into Excel a lot, you might consider switching to Excel's XML format. You have a great deal more control in that case. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From winterttr at gmail.com Mon May 25 03:38:49 2009 From: winterttr at gmail.com (winterTTr) Date: Mon, 25 May 2009 09:38:49 +0800 Subject: [python-win32] about thre return value from pycom server Message-ID: I recently write a com server as shell extension . And , i want to implement a interface call "IQueryInfo" which you can find some information about it via MSDN . As I can't find it the pythoncom , i implement it using the TypeLibrary as following lines. [shell_extension.idl] ----------------from------------------------- [ object, uuid(00021500-0000-0000-C000-000000000046), helpstring("IQueryInfo Interface"), pointer_default(unique) ] interface IQueryInfo : IUnknown { HRESULT GetInfoFlags ([out] long * pdwFlags); HRESULT GetInfoTip([in] long dwFlags , [out] wchar_t ** ppwszTip); }; -----------------to------------------------------- and implement the interface function as follow # it is a member function of a class def GetInfoFlags(self ): return 0 when i run the code , the program ( which is explore.exe ) crashed , my god ! 0_0 i analyze the win32com code , and find that the program crashed when running the code in [universal.py] as follow : WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) As i know , this function may write the return value to caller of the com server . As the interface defined , maybe i show return a pointer of long as return value , not long itself. So "return 0" may cause the access violation. Question is : how can i deal with this case ? I don't know how to return a long pointer to the caller in py code. or may be there is another way to solve this problem , any advise ? Thx. From winterttr at gmail.com Mon May 25 03:43:21 2009 From: winterttr at gmail.com (winterTTr) Date: Mon, 25 May 2009 09:43:21 +0800 Subject: [python-win32] about thre return value from pycom server Message-ID: I recently write a com server as shell extension . And , i want to implement a interface call "IQueryInfo" which you can find some information about it via MSDN . As I can't find it the pythoncom , i implement it using the TypeLibrary as following lines. [shell_extension.idl] ----------------from------------------------- [ object, uuid(00021500-0000-0000-C000-000000000046), helpstring("IQueryInfo Interface"), pointer_default(unique) ] interface IQueryInfo : IUnknown { HRESULT GetInfoFlags ([out] long * pdwFlags); HRESULT GetInfoTip([in] long dwFlags , [out] wchar_t ** ppwszTip); }; -----------------to------------------------------- and implement the interface function as follow # it is a member function of a class def GetInfoFlags(self ): return 0 when i run the code , the program ( which is explore.exe ) crashed , my god ! 0_0 i analyze the win32com code , and find that the program crashed when running the code in [universal.py] as follow : WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) As i know , this function may write the return value to caller of the com server . As the interface defined , maybe i show return a pointer of long as return value , not long itself. So "return 0" may cause the access violation. Question is : how can i deal with this case ? I don't know how to return a long pointer to the caller in py code. or may be there is another way to solve this problem , any advise ? Thx. From le.dahut at laposte.net Mon May 25 10:08:14 2009 From: le.dahut at laposte.net (le dahut) Date: Mon, 25 May 2009 10:08:14 +0200 Subject: [python-win32] CreateURLMonikerEx and Win2000 In-Reply-To: <4A16D85B.8060802@probo.com> References: <4A169A46.5030505@laposte.net> <4A16D85B.8060802@probo.com> Message-ID: <4A1A51EE.5020109@laposte.net> Tim Roberts wrote : > le dahut wrote: >> Roger Upole wrote : >>> 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 ? >>> On machines with older versions of IE, this function may not >>> be present in urlmon.dll. This has been fixed since the release >>> of build 213. >> Which version of IE ? >> On my w2k I have IE 5.0. > > Google would have brought you to the MSDN page for CreateURLMonikerEx, > which says IE 5.5. > > The MSDN pages are usually very good about identifying the minimum > versions required for each API. > Exact, it escaped me, sorry for the inconvenience. From vernondcole at gmail.com Tue May 26 09:55:19 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 26 May 2009 01:55:19 -0600 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: References: Message-ID: According to PEP 249... .callproc(procname[,parameters]) Call a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values. The procedure may also provide a result set as output. This must then be made available through the standard .fetch*() methods. In this case, the proceedure outputs TWO record sets, since there are two SELECT statements. If the second select statement, "select @param = 10" were changed to "SET @param = 10" then, I believe, the result would have been as expected. As it stands, the Python programmer should be required to do a cursor.nextset() and a .fetch() in order to read the result of the second SELECT statement. .nextset() This method will make the cursor skip to the next available set, discarding any remaining rows from the current set. If there are no more sets, the method returns None. Otherwise, it returns a true value and subsequent calls to the fetch methods will return rows from the next result set. Having said all that, I ran Randy's test program using pywin32 v213 on Python 2.6 and Vista, and it ran correctly. -- Vernon On Fri, May 22, 2009 at 6:50 AM, Roger Upole wrote: > Randy Syring wrote: >> >> I found this post: >> >> >> http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters >> >> which was helpful in getting me started. ?However, that method does not >> yield the output parameters if a recordset is output in the SP. ?So, if >> my SP is: >> >> ? CREATE PROCEDURE sp_test_only_output >> ? @param INTEGER OUTPUT >> ? AS >> ? BEGIN >> ? select @param = 10 >> ? END >> >> Then: >> >> ? assert [10] == self.cur.callproc('sp_test_only_output',(999,)) >> >> But, if my SP is: >> >> ? CREATE PROCEDURE sp_test_output_and_select >> ? @param INTEGER OUTPUT >> ? AS >> ? BEGIN >> ? select 'one', 'two' >> ? select @param = 10 >> ? END >> >> then: >> >> ? self.cur.callproc('sp_test_output_and_select',(999,)) == [999] >> >> A full test that can be run with Nose: http://paste.pocoo.org/show/118219/ >> >> Can you please help me figure out what is going on. ?I realize output >> parameters are not the best solution, but I am working with systems that >> I can't change the SPs on and would like to use Python rather than be >> forced into using a different language. >> >> Thank you! >> > > I've run into this somewhere before. ?It turns out that the output parms are > actually returned as an extra recordset, so you need to call NextRecordset > before trying to access them. > >> From digging into the source, if you add > > rs.NextRecordset() at line 741 of adodbapi.py, the output parm > is returned as expected. > > ? ? ? ? ?Roger > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From rdahlstrom at directedge.com Tue May 26 12:45:28 2009 From: rdahlstrom at directedge.com (Dahlstrom, Roger) Date: Tue, 26 May 2009 06:45:28 -0400 Subject: [python-win32] writing hyphenated values in csv In-Reply-To: <4A174A18.1020800@probo.com> References: <3c1542370905221748q77f90c9aq8f0d50c670284272@mail.gmail.com> <4A174A18.1020800@probo.com> Message-ID: <70D9B06B9E99EE4E98E4893703ADA141149094F5F0@EXCHANGE1.global.knight.com> Additionally, your csv file is *not* being auto-corrected. If this file is supposed to be able to be imported into things *other* than Excel, leave it alone and do not put an equals in front of it. If you were to open your file in Notepad or some other text editor, you'd see the value as you expect it. -----Original Message----- From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Tim Roberts Sent: Friday, May 22, 2009 8:58 PM To: Python-Win32 List Subject: Re: [python-win32] writing hyphenated values in csv Emad Khan wrote: > > I am trying to write a hyphenated value in a csv file but I don't want > this value to be auto corrected to a date. Whenever I write a value, > for example, "3-10", it is changed to 03/10/2009 or 03-oct. > > How can I prevent this from happening. I would like to see the value > remain to be "3-10". You should be more specific. I, for example, understand that it is Excel that is doing this, but you need to mention that. It's not really a CSV or Python problem at all -- it's an Excel problem. The answer, in this case, is to put an equals sign in front of the quoted value. Thus this file: 123,3-10,"3-10",=3-10,="3-10" gets imported as 123 10-Mar 10-Mar -7 3-10 Again, however, this is just an Excel quirk. If you need to import into Excel a lot, you might consider switching to Excel's XML format. You have a great deal more control in that case. -- 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 DISCLAIMER: This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications. www.directedge.com From rerb at progress.com Tue May 26 18:28:04 2009 From: rerb at progress.com (Bob Erb) Date: Tue, 26 May 2009 12:28:04 -0400 Subject: [python-win32] win32job.SetInformtionJobObject usage -- what am I doing wrong? Message-ID: Hi. I want to create a Win32 job, then limit its memory use. I thought the code below would work, but it doesn't. What am I doing wrong? # import win32job import win32security security_attrs = win32security.SECURITY_ATTRIBUTES() job = win32job.CreateJobObject(security_attrs, 'test job') extended_limits = win32job.QueryInformationJobObject( job, win32job.JobObjectExtendedLimitInformation) extended_limits['JobMemoryLimit'] = 4123123123 win32job.SetInformationJobObject(job, win32job.JobObjectExtendedLimitInformation, extended_limits) print extended_limits['JobMemoryLimit'] print win32job.QueryInformationJobObject( job, win32job.JobObjectExtendedLimitInformation)['JobMemoryLimit'] # Output is: 4123123123 0 The job's JobMemoryLimit isn't changed. Hope you can help. Thank you. - Bob From timr at probo.com Tue May 26 19:49:23 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 26 May 2009 10:49:23 -0700 Subject: [python-win32] win32job.SetInformtionJobObject usage -- what am I doing wrong? In-Reply-To: References: Message-ID: <4A1C2BA3.3010307@probo.com> Bob Erb wrote: > I want to create a Win32 job, then limit its memory use. I thought > the code below would work, but it doesn't. What am I doing wrong? > > # > > import win32job > import win32security > > security_attrs = win32security.SECURITY_ATTRIBUTES() > > job = win32job.CreateJobObject(security_attrs, 'test job') > > extended_limits = win32job.QueryInformationJobObject( > job, win32job.JobObjectExtendedLimitInformation) > > extended_limits['JobMemoryLimit'] = 4123123123 > > win32job.SetInformationJobObject(job, > win32job.JobObjectExtendedLimitInformation, > extended_limits) > You also need this before the Set call: extended_limits['BasicLimitInformation']['Limit_Flags'] += win32job.JOB_OBJECT_LIMIT_JOB_MEMORY What do you plan to do with this? In 20 years of Windows programming, I've never once used the Job APIs. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From randy at rcs-comp.com Tue May 26 20:04:24 2009 From: randy at rcs-comp.com (Randy Syring) Date: Tue, 26 May 2009 14:04:24 -0400 Subject: [python-win32] Sourceforge Download Link Message-ID: <4A1C2F28.9000105@rcs-comp.com> Has anyone noticed that the big green download box on this page: http://sourceforge.net/projects/pywin32/ says the latest build is 213, but when you click on the link in that box, it takes you to 212? -- -------------------------------------- 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 randy at rcs-comp.com Tue May 26 20:54:32 2009 From: randy at rcs-comp.com (Randy Syring) Date: Tue, 26 May 2009 14:54:32 -0400 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: References: Message-ID: <4A1C3AE8.6010505@rcs-comp.com> Vernon Cole wrote: > In this case, the proceedure outputs TWO record sets, since there are > two SELECT statements. > If the second select statement, "select @param = 10" were changed to > "SET @param = 10" then, I believe, the result > would have been as expected. > Vernon, thanks for your comments. In SQL Server, there is no recordset output for: select @param = 10 its simply a variable assignment. You can verify this by doing the following in a TSQL or Query Analyzer session: declare @param int select @param = 1 You should see that no resultset is returned. > Having said all that, I ran Randy's test program using pywin32 v213 on > Python 2.6 and Vista, and it ran correctly. > Really! I did a fresh install of 2.6 and win32 extensions on vista just to verify this and I still got an error. Vernon, so you got a message from nose that two tests passed? Can anyone else verify this? -------------------------------------- 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 vernondcole at gmail.com Tue May 26 21:20:25 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 26 May 2009 13:20:25 -0600 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: <4A1C3AE8.6010505@rcs-comp.com> References: <4A1C3AE8.6010505@rcs-comp.com> Message-ID: Randy: I am no longer employed by the company who supplied the SQL server I used to test on, and am stuck with SQLexpress on my laptop. No Query Analyzer. (Bah!) Clearly, either my test was invalid, or there is a difference in SQL versions. What version are you using? -- Vernon On Tue, May 26, 2009 at 12:54 PM, Randy Syring wrote: > > > Vernon Cole wrote: > > In this case, the proceedure outputs TWO record sets, since there are > two SELECT statements. > If the second select statement, "select @param = 10" were changed to > "SET @param = 10" then, I believe, the result > would have been as expected. > > > Vernon, thanks for your comments. > > In SQL Server, there is no recordset output for: > > select @param = 10 > > its simply a variable assignment.? You can verify this by doing the > following in a TSQL or Query Analyzer session: > > declare @param int > select @param = 1 > > You should see that no resultset is returned. > > Having said all that, I ran Randy's test program using pywin32 v213 on > Python 2.6 and Vista, and it ran correctly. > > > Really!? I did a fresh install of 2.6 and win32 extensions on vista just to > verify this and I still got an error.? Vernon, so you got a message from > nose that two tests passed?? Can anyone else verify this? > > -------------------------------------- > 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 Tue May 26 21:28:45 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 26 May 2009 13:28:45 -0600 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: <4A1C402A.4000901@rcs-comp.com> References: <4A1C402A.4000901@rcs-comp.com> Message-ID: Randy: Just to make sure... what version of adodbapi are we talking about? >>> import adodbapi >>> adodbapi.version 'adodbapi v2.2.6 ' >>> -- Vernon On Tue, May 26, 2009 at 1:16 PM, Randy Syring wrote: > Vernon, > > I didn't mention this in my last email, but I also tried the: > > SET? @param = 10 > > syntax, but that didn't change anything.? I am still getting a failing test > on 2.5 (XP) and (2.6) Vista. > > -------------------------------------- > 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 > > > Vernon Cole wrote: > > According to PEP 249... > .callproc(procname[,parameters]) > Call a stored database procedure with the given name. The > sequence of parameters must contain one entry for each > argument that the procedure expects. The result of the > call is returned as modified copy of the input > sequence. Input parameters are left untouched, output and > input/output parameters replaced with possibly new values. > > The procedure may also provide a result set as > output. This must then be made available through the > standard .fetch*() methods. > > In this case, the proceedure outputs TWO record sets, since there are > two SELECT statements. > If the second select statement, "select @param = 10" were changed to > "SET @param = 10" then, I believe, the result > would have been as expected. > As it stands, the Python programmer should be required to do a > cursor.nextset() and a .fetch() in order to read the result of the > second SELECT statement. > > .nextset() > This method will make the cursor skip to the next > available set, discarding any remaining rows from the > current set. > > If there are no more sets, the method returns > None. Otherwise, it returns a true value and subsequent > calls to the fetch methods will return rows from the next > result set. > > Having said all that, I ran Randy's test program using pywin32 v213 on > Python 2.6 and Vista, and it ran correctly. > -- > Vernon > > On Fri, May 22, 2009 at 6:50 AM, Roger Upole wrote: > > > Randy Syring wrote: > > > I found this post: > > > http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters > > which was helpful in getting me started. ?However, that method does not > yield the output parameters if a recordset is output in the SP. ?So, if > my SP is: > > ? CREATE PROCEDURE sp_test_only_output > ? @param INTEGER OUTPUT > ? AS > ? BEGIN > ? select @param = 10 > ? END > > Then: > > ? assert [10] == self.cur.callproc('sp_test_only_output',(999,)) > > But, if my SP is: > > ? CREATE PROCEDURE sp_test_output_and_select > ? @param INTEGER OUTPUT > ? AS > ? BEGIN > ? select 'one', 'two' > ? select @param = 10 > ? END > > then: > > ? self.cur.callproc('sp_test_output_and_select',(999,)) == [999] > > A full test that can be run with Nose: http://paste.pocoo.org/show/118219/ > > Can you please help me figure out what is going on. ?I realize output > parameters are not the best solution, but I am working with systems that > I can't change the SPs on and would like to use Python rather than be > forced into using a different language. > > Thank you! > > > > I've run into this somewhere before. ?It turns out that the output parms are > actually returned as an extra recordset, so you need to call NextRecordset > before trying to access them. > > > > From digging into the source, if you add > > > rs.NextRecordset() at line 741 of adodbapi.py, the output parm > is returned as expected. > > ? ? ? ? ?Roger > > _______________________________________________ > 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 > > From randy at rcs-comp.com Tue May 26 22:35:54 2009 From: randy at rcs-comp.com (Randy Syring) Date: Tue, 26 May 2009 16:35:54 -0400 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: References: <4A1C402A.4000901@rcs-comp.com> Message-ID: <4A1C52AA.4040609@rcs-comp.com> Vernon, I have now also tested this with SQL Server Express 2005 on vista and am still getting an error. I am adding my previous email to you here for the benefit of the list: On both XP and Vista, I am using 2.2.5. I don't see a 2.2.6 on sourceforge. As for the SQL Server versions, I have tested on both 2000 and 2005. I am currently in the process of installing the SQL Express 2005 version to see if I get a different result. FYI, you can get SQL Server Management Studio Express for free (replaces Query Analyzer in 2005): http://www.microsoft.com/Sqlserver/2005/en/us/express-down.aspx#SP3 Direct download for the studio: http://go.microsoft.com/fwlink/?linkid=65110 -------------------------------------- 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 Vernon Cole wrote: > Randy: > Just to make sure... > what version of adodbapi are we talking about? > > >>>> import adodbapi >>>> adodbapi.version >>>> > 'adodbapi v2.2.6 ' > > -- > Vernon > > On Tue, May 26, 2009 at 1:16 PM, Randy Syring wrote: > >> Vernon, >> >> I didn't mention this in my last email, but I also tried the: >> >> SET @param = 10 >> >> syntax, but that didn't change anything. I am still getting a failing test >> on 2.5 (XP) and (2.6) Vista. >> >> -------------------------------------- >> 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 >> >> >> Vernon Cole wrote: >> >> According to PEP 249... >> .callproc(procname[,parameters]) >> Call a stored database procedure with the given name. The >> sequence of parameters must contain one entry for each >> argument that the procedure expects. The result of the >> call is returned as modified copy of the input >> sequence. Input parameters are left untouched, output and >> input/output parameters replaced with possibly new values. >> >> The procedure may also provide a result set as >> output. This must then be made available through the >> standard .fetch*() methods. >> >> In this case, the proceedure outputs TWO record sets, since there are >> two SELECT statements. >> If the second select statement, "select @param = 10" were changed to >> "SET @param = 10" then, I believe, the result >> would have been as expected. >> As it stands, the Python programmer should be required to do a >> cursor.nextset() and a .fetch() in order to read the result of the >> second SELECT statement. >> >> .nextset() >> This method will make the cursor skip to the next >> available set, discarding any remaining rows from the >> current set. >> >> If there are no more sets, the method returns >> None. Otherwise, it returns a true value and subsequent >> calls to the fetch methods will return rows from the next >> result set. >> >> Having said all that, I ran Randy's test program using pywin32 v213 on >> Python 2.6 and Vista, and it ran correctly. >> -- >> Vernon >> >> On Fri, May 22, 2009 at 6:50 AM, Roger Upole wrote: >> >> >> Randy Syring wrote: >> >> >> I found this post: >> >> >> http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters >> >> which was helpful in getting me started. However, that method does not >> yield the output parameters if a recordset is output in the SP. So, if >> my SP is: >> >> CREATE PROCEDURE sp_test_only_output >> @param INTEGER OUTPUT >> AS >> BEGIN >> select @param = 10 >> END >> >> Then: >> >> assert [10] == self.cur.callproc('sp_test_only_output',(999,)) >> >> But, if my SP is: >> >> CREATE PROCEDURE sp_test_output_and_select >> @param INTEGER OUTPUT >> AS >> BEGIN >> select 'one', 'two' >> select @param = 10 >> END >> >> then: >> >> self.cur.callproc('sp_test_output_and_select',(999,)) == [999] >> >> A full test that can be run with Nose: http://paste.pocoo.org/show/118219/ >> >> Can you please help me figure out what is going on. I realize output >> parameters are not the best solution, but I am working with systems that >> I can't change the SPs on and would like to use Python rather than be >> forced into using a different language. >> >> Thank you! >> >> >> >> I've run into this somewhere before. It turns out that the output parms are >> actually returned as an extra recordset, so you need to call NextRecordset >> before trying to access them. >> >> >> >> From digging into the source, if you add >> >> >> rs.NextRecordset() at line 741 of adodbapi.py, the output parm >> is returned as expected. >> >> Roger >> >> _______________________________________________ >> 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 >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdriscoll at co.marshall.ia.us Tue May 26 22:29:57 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 26 May 2009 15:29:57 -0500 Subject: [python-win32] Sourceforge Download Link In-Reply-To: <4A1C2F28.9000105@rcs-comp.com> References: <4A1C2F28.9000105@rcs-comp.com> Message-ID: <4A1C5145.40908@co.marshall.ia.us> Randy Syring wrote: >
Has > anyone noticed that the big green download box on this page: > > http://sourceforge.net/projects/pywin32/ > > says the latest build is 213, but when you click on the link in that > box, it takes you to 212? > I think it did the same thing when 211 was introduced...instead of 211, I kept getting 210. Maybe SourceForge doesn't like odd numbers? ;) - Mike From rerb at progress.com Tue May 26 22:56:02 2009 From: rerb at progress.com (Bob Erb) Date: Tue, 26 May 2009 16:56:02 -0400 Subject: [python-win32] win32job.SetInformtionJobObject usage -- what am I doing wrong? In-Reply-To: <4A1C2BA3.3010307@probo.com> (Tim Roberts's message of "Tue\, 26 May 2009 10\:49\:23 -0700") References: <4A1C2BA3.3010307@probo.com> Message-ID: Tim Roberts writes: > Bob Erb wrote: >> I want to create a Win32 job, then limit its memory use. I thought >> the code below would work, but it doesn't. What am I doing wrong? >> > > > You also need this before the Set call: > extended_limits['BasicLimitInformation']['Limit_Flags'] += > win32job.JOB_OBJECT_LIMIT_JOB_MEMORY > Thank you, Tim! Perfect! > What do you plan to do with this? We need to test how our products behave when they need more memory than they can get. On unix, we use resource.setrlimit() from the Python standard library. But resource is unix-only. Thanks again for the help. - Bob ---------------------------------------------------------------- This email communication and any attachments may contain proprietary, confidential, or privileged information. If you are not the intended recipient, you are hereby notified that you have received this email in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. The sender does not waive confidentiality or any privilege by erroneous transmission. If you have received this email in error, please notify the sender immediately, delete this email, and destroy all copies and any attachments. Thank you. ---------------------------------------------------------------- From stef.mientki at gmail.com Tue May 26 23:52:39 2009 From: stef.mientki at gmail.com (Stef Mientki) Date: Tue, 26 May 2009 23:52:39 +0200 Subject: [python-win32] overview of ntfs permissions ? Message-ID: <4A1C64A7.9060000@gmail.com> hello, is there a way to get an overview of ntfs permissions, of a specified part of a directory tree ? thanks, Stef Mientki From mail at timgolden.me.uk Wed May 27 10:13:31 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Wed, 27 May 2009 09:13:31 +0100 Subject: [python-win32] overview of ntfs permissions ? In-Reply-To: <4A1C64A7.9060000@gmail.com> References: <4A1C64A7.9060000@gmail.com> Message-ID: <4A1CF62B.8060101@timgolden.me.uk> Stef Mientki wrote: > hello, > > is there a way to get an overview of ntfs permissions, > of a specified part of a directory tree ? (I've recently answered amost this question over on StockOverflow as it happens: it wasn't you, was it? :) ) One answer is to use cacls / xcacls, the command-line tool which ships with Windows. If you want a Python-y way of doing it (which is, I assume, why you asked here) then I can do no better than recommend my fledgling winsys module: MSI here: http://timgolden.me.uk/python/downloads/WinSys-0.4.win32-py2.6.msi or Subversion here: svn co http://winsys.googlecode.com/svn/trunk winsys The code would then be something like (depending on what you actually wanted to show...): from winsys import fs ROOT = "c:/temp" # # For purposes of illustration, just show directories # for directory, dirs, files in fs.walk (ROOT): dirpath = directory.filepath.relative_to (ROOT) indent = " " * dirpath.count (fs.sep) print indent, dirpath security = directory.security () for dace in directory.security ().dacl: print indent, dace print Obviously, it depends on exactly what you're after. If you'd rather do it with "native" Python+pywin32, I'm happy to produce an example, but it's a bit tedious (which is why I wrote the winsys package to save myself the trouble of remembering...) TJG From randy at rcs-comp.com Wed May 27 15:16:37 2009 From: randy at rcs-comp.com (Randy Syring) Date: Wed, 27 May 2009 09:16:37 -0400 Subject: [python-win32] adodbapi and stored procedure output parameters on In-Reply-To: References: Message-ID: <4A1D3D35.5040409@rcs-comp.com> Roger Upole wrote: > I've run into this somewhere before. It turns out that the output > parms are > actually returned as an extra recordset, so you need to call > NextRecordset > before trying to access them. > >> From digging into the source, if you add > rs.NextRecordset() at line 741 of adodbapi.py, the output parm > is returned as expected. > > Roger Yes, but if you try to get data from the recordsets, it breaks other things. ADO is what creates the the extra select at the end of the SQL that is generated and therefore the last recordset. Shouldn't it pull that last recordset off to populate the output parameters? If we do have to run through all recordsets before ADO will properly populate the output values (which I have tried and not been able to get working), then its going to be difficult for adodbapi to work correctly. Its supposed to return the output parameters immediately after executing callproc(), but it can't do that because the recordsets haven't been processed yet. -------------------------------------- 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 bbbscarter at gmail.com Wed May 27 23:00:10 2009 From: bbbscarter at gmail.com (Simon Carter) Date: Wed, 27 May 2009 22:00:10 +0100 Subject: [python-win32] COM and retrieving records/structures In-Reply-To: <4A04CB6A.1060009@gmail.com> References: <49EE9B54.8080000@gmail.com> <001c01c9c332$56a9cec0$03fd6c40$@com.au> <4A04CB6A.1060009@gmail.com> Message-ID: >> Hi! Is there anything else I can do to help track this down, or work >> around the problem? Without switching over to Python .Net or >> IronPython, I'm not entirely clear what I can do... > > Me either :( ?It will probably involve working out how to reproduce this in > the test suite... Well, let me know if I can help. Things seem to be working with Python .Net so this is no longer urgent for me, but if I can help out let me know. Thanks! Simon From zweetboy at live.com Wed May 27 17:29:16 2009 From: zweetboy at live.com (Sweet Boy) Date: Wed, 27 May 2009 09:29:16 -0600 Subject: [python-win32] como hacer una rutina de auto-copiado en python con PyWin32 Message-ID: hola!. ese es mi problema, quisiera saber como puedo implementar una rutina de autocopiado en python para un .exe hecho con py2exe. el problema es que el programa debe averiguar su propia ubicacion actual y no s? como hacer para que lo haga, claro que con Apis de PyWin32. _________________________________________________________________ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx -------------- next part -------------- An HTML attachment was scrubbed... URL: From bwmetz at gmail.com Thu May 28 01:19:43 2009 From: bwmetz at gmail.com (Bobby Metz) Date: Wed, 27 May 2009 16:19:43 -0700 Subject: [python-win32] como hacer una rutina de auto-copiado en python con PyWin32 In-Reply-To: References: Message-ID: <8ea88a240905271619q4e40cecbt1fc94e7f8cd94950@mail.gmail.com> If I understand correctly you want a means to package your py2exe generated .exe file and its dependent files and directories into an installation package that will install them into a predetermined directory on other systems. If that is correct, I'm not aware of an Pywin32 API to handle that, but someone else might. There are several programs on the web that can help you create .msi or install applications...just google for them. If that is too complicated or expensive then you can always use WinZip to zip your files and then create a self-extracting .exe with the default install directory specified. Bobby 2009/5/27 Sweet Boy > hola!. > ese es mi problema, quisiera saber como puedo implementar una rutina de > autocopiado en python para un .exe hecho con py2exe. el problema es que el > programa debe averiguar su propia ubicacion actual y no s? como hacer para > que lo haga, claro que con Apis de PyWin32. > > ------------------------------ > See all the ways you can stay connected to friends and family > > _______________________________________________ > 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 May 28 03:20:30 2009 From: mvilas at gmail.com (Mario Alejandro Vilas Jerez) Date: Wed, 27 May 2009 22:20:30 -0300 Subject: [python-win32] como hacer una rutina de auto-copiado en python con PyWin32 In-Reply-To: References: Message-ID: <3fbf862f0905271820w34f5dea8u4365bc7036668516@mail.gmail.com> Aca explican como averiguar el path a tu propio ejecutable: http://www.py2exe.org/index.cgi/WhereAmI Quedaria algo como esto (solo funcionaria con py2exe): import sys archivo_de_origen = sys.executable No conozco mucho PyWin32. De todas formas se puede usar ctypes, esto seguramente sirva: import ctypes ctypes.windll.kernel32.CopyFileA( archivo_de_origen, archivo_de_destino, 1 ) Donde ambas variables son strings con los nombres de los archivos. Si los strings son en unicode, hay que usar CopyFileW. 2009/5/27 Sweet Boy > hola!. > ese es mi problema, quisiera saber como puedo implementar una rutina de > autocopiado en python para un .exe hecho con py2exe. el problema es que el > programa debe averiguar su propia ubicacion actual y no s? como hacer para > que lo haga, claro que con Apis de PyWin32. > > ------------------------------ > See all the ways you can stay connected to friends and family > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- If you're not part of the solution, you're part of the precipitate. -------------- next part -------------- An HTML attachment was scrubbed... URL: From whatyoulookin at yahoo.com Fri May 29 16:24:23 2009 From: whatyoulookin at yahoo.com (Alec Bennett) Date: Fri, 29 May 2009 07:24:23 -0700 (PDT) Subject: [python-win32] how to get the statusbar text of a window? Message-ID: <225362.42316.qm@web54606.mail.re2.yahoo.com> I'm trying to read the statusbar text of a window under Python. I'm guessing win32gui is the way to go, and thought the GetWindowText function was promising, but alas I can't get it to return anything other than the text of the titlebar. Can anyone think of any clever ways to do this? Here's the docs to win32gui fyi: http://docs.activestate.com/activepython/2.4/pywin32/win32gui.html From niki at vintech.bg Fri May 29 16:36:01 2009 From: niki at vintech.bg (niki) Date: Fri, 29 May 2009 17:36:01 +0300 Subject: [python-win32] how to get the statusbar text of a window? In-Reply-To: <225362.42316.qm@web54606.mail.re2.yahoo.com> References: <225362.42316.qm@web54606.mail.re2.yahoo.com> Message-ID: <4A1FF2D1.8060006@vintech.bg> IIRC status bar is usually child window. You have to enumerate children and get text from there. Niki From timr at probo.com Fri May 29 20:06:59 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 29 May 2009 11:06:59 -0700 Subject: [python-win32] how to get the statusbar text of a window? In-Reply-To: <225362.42316.qm@web54606.mail.re2.yahoo.com> References: <225362.42316.qm@web54606.mail.re2.yahoo.com> Message-ID: <4A202443.1050000@probo.com> Alec Bennett wrote: > I'm trying to read the statusbar text of a window under Python. I'm guessing win32gui is the way to go, and thought the GetWindowText function was promising, but alas I can't get it to return anything other than the text of the titlebar. > > Can anyone think of any clever ways to do this? > Niki is correct. The status bar is a child window. However, the answer to your question depends on which application you want to scrape. Many apps use the standard "msctls_statusbar32" control to implement status bars. If yours does, you can enumerate the child windows until you find a window of class "msctls_statusbar32", then use the status bar APIs to get the contents of its panels. However, even that isn't foolproof. Thunderbird and Firefox, as an example, have implemented their own custom window classes for all of their controls. They don't respond to normal window messages from the outside. The Office applications don't use separate windows for their controls; their windows are just one big empty canvas, where everything is painted internally. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nkamado at gmail.com Sun May 31 03:42:46 2009 From: nkamado at gmail.com (=?ISO-2022-JP?B?GyRCM3lFWjUtTkkbKEI=?=) Date: Sun, 31 May 2009 10:42:46 +0900 Subject: [python-win32] Release PyInstaller exe installer using distutils for windows. Message-ID: <4A21E096.1060405@gmail.com> I created pyInstaller exe installer using distutils only for windows and upload onto the following URL. It makes you to build windows executable file with setup.py's setup function. Setup function is unmounted function on original pyInstaller package, and this installer enables UPX exe archive functions as default. http://moco.sakura.ne.jp/wp-content/uploads/2009/05/pyinstaller-13win32.exe If you want to use this package, Please write following code on setup.py. from pyInstaller import * setup('testre.py',onefile=True,name='test') Thank you. // kr2: nkamado at gmail.com