From mhammond at skippinet.com.au Sat Jul 1 02:22:40 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 1 Jul 2006 10:22:40 +1000 Subject: [python-win32] Python/ASP Request data with non ascii characters In-Reply-To: Message-ID: <0b1b01c69ca4$771a74f0$100a0a0a@enfoldsystems.local> > I thought I would be able to do > > my_string = unicode(Request("formstring"),"ISO-8859-1") > > But i get: > coercing to Unicode: need string or buffer, instance found. > I'm guessing (and I mean guessing) this is because the CDispatch > object doesn't have a __unicode__ function. A __unicode__ function may well help there - but alternatively, you should find that something like Request("formstring").Value (or similar) will give you the unicode string. I'm afraid I can't recall exactly what the Request method returns in that case, so .Value is a guess... Cheers, Mark From rwupole at msn.com Sat Jul 1 05:22:13 2006 From: rwupole at msn.com (Roger Upole) Date: Fri, 30 Jun 2006 23:22:13 -0400 Subject: [python-win32] Re: ODBC and Oracle Message-ID: Dean Allen Provins wrote: > Hello: > > Is there a trick to adding a Python ODBC connection to Oracle? > > Under Windows, with Python's "odbc" module, I can see MS Access (twice), 2 > system databases that the IT people created. and at various times. dbase and > excel as data sources. > > Curiously, the list of sources varies with my attempts to see what's available. > The code I used was: > > import odbc > for i in range (100): > try: > odbc.SQLDataSources (i) > print i > except: > continue > > This prints the data source and the index at which it was found. A sample > listing looks like: > > ('PMO_RO', 'Oracle in OraHome92') > 1 > ('MS Access Database', 'Microsoft Access Driver (*.mdb)') > 2 > ('MS Access Database', 'Microsoft Access Driver (*.mdb)') > 31 > ('CMS', 'Oracle in OraHome92') > 32 > > Note the repetition. Note also that while Access always appears, the other two > may be replaced by 'dbase' or 'excel' (very curious). > > I've tried to add the Oracle odbc module to the "data source Administrator' for > the database I want to access, but it refuses to appear. > > Any ideas? The parameter to odbc.SQLDataSources is a flag, rather than a position. import odbc s=odbc.SQLDataSources(odbc.SQL_FETCH_FIRST) while s: print s s=odbc.SQLDataSources (odbc.SQL_FETCH_NEXT) Roger From sjmachin at lexicon.net Mon Jul 3 11:20:00 2006 From: sjmachin at lexicon.net (John Machin) Date: Mon, 03 Jul 2006 19:20:00 +1000 Subject: [python-win32] EasyDialogs - how to set initial path In-Reply-To: References: Message-ID: <44A8E140.2080307@lexicon.net> On 30/06/2005 5:43 PM, Radovan Grznarik wrote: > Hi, > > I am using EasyDialogs (AskFileForOpen) and I am not able to set the > initial open path. I found in Python help that it should be 3rd > parameter, I doubt it. The Python *documentation*, whose first two lines ("2.7 EasyDialogs -- Basic Macintosh dialogs", "Availability: Macintosh.) are easily ignored, does contain this: AskFileForOpen( [message] [, typeList] [, defaultLocation] [, defaultOptionFlags] etc etc. But you are running on Windows, and to get as far as you did, you must have downloaded Jimmy Retzlaff's 3rd party not quite-compatible subset EasyDialogs module. Then if you use the Python *help*, you get: C:\junk>python Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. |>> import EasyDialogs |>> EasyDialogs.__file__ 'c:\\python24\\lib\\site-packages\\EasyDialogs\\__init__.pyc' >>> help(EasyDialogs.AskFileForOpen) Help on function AskFileForOpen in module EasyDialogs: AskFileForOpen(message=None, typeList=None, version=None, defaultLocation=None, dialogOptionFlags=None, location=None, clientName=None, [snip] then I tried this > > filename = EasyDialogs.AskFileForOpen("title","*.*","d:\\") > > but it does not work, and opens dialog in actual directory of running script. If it's any consolation, you're not the first to get trapped like this :-) > > os.chdir("d:\\") before AskFileForOpen also does not work. > Here's a handy tip: when a function has keyword arguments, use the keywords -- not only does it save you counting args, it helps document your code. Here's a (slightly edited) example from one of my scripts: import EasyDialogs infname = EasyDialogs.AskFileForOpen( windowTitle='Fu or Bar file from XYZ', typeList=[ ('All files (*.*)', '*.*'), ], defaultLocation=r'G:\XYZfiles\FuBar', # message='... a message', ) Cheers, John From propadovic.nenad at debitel.net Mon Jul 3 11:32:19 2006 From: propadovic.nenad at debitel.net (propadovic.nenad at debitel.net) Date: 3 Jul 2006 11:32:19 +0200 Subject: [python-win32] Calling Labview 8 via Python and COM Message-ID: <1151919139.44a8e42391667@www.debitel.net> Hello, I'm having an issue with Python/COM and Labview. What I want to do is to instantiate Labview an let it open and execute a "VI" (virtal instrument). This works well in Visual Basic: ------------------------------------------------------------------------------- 'Declare the object type of a lvApp and VI Dim lvApp As LabVIEW.Application Dim VI As LabVIEW.VirtualInstrument Dim VIPath As String 'Create a reference to LabVIEW Set lvApp = CreateObject("LabVIEW.Application") 'Determine the path to the VI VIPath = lvApp.ApplicationDirectory + "\Examples\General\Strings.llb\Parse Arithmetic Expression.vi" 'Assign an object reference to VI Set VI = lvApp.GetVIReference(VIPath) Dim ParamNames(0 To 1) As String Dim ParamVals(0 To 1) As Variant ParamNames(0) = "Arithmetic Expression" ParamNames(1) = "Result" ParamVals(0) = "3*77" VI.ShowFPOnCall = True 'Call the VI Call VI.Call(ParamNames, ParamVals) MsgBox ParamVals(1) ------------------------------------------------------------------------------- My Python equivalent is: -----------------------------LVCOM.py:--------------------------------- from win32com.client import Dispatch lvApp = Dispatch("LabVIEW.Application.8") VIPath = lvApp.ApplicationDirectory + r"\Examples\General\Strings.llb\Parse Arithmetic Expression.vi" print VIPath VI=lvApp.GetVIReference(VIPath) ParamNames = [] ParamNames.append("Arithmetic Expression") ParamNames.append("Result") ParamVals = [] ParamVals.append("3*77") ParamVals.append("0") VI.ShowFPOnCall = True VI.Call(ParamNames, ParamVals) print ParamVals[1] ---------------------------------------------------------------------------------- Here the call: VI.Call(ParamNames, ParamVals) succeeds partially. The GUI of the "virtual instrument" is opened, but the new values of the parameters are not inserted, and I get this traceback: Traceback (most recent call last): File "C:\dSPACE4.2\Common\Python22\Core\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript exec codeObject in __main__.__dict__ File "C:\user\nenad\LabviewPyCOM\LVCOM.py", line 20, in ? VI.Call(ParamNames, ParamVals) TypeError: 'NoneType' object is not callable As far as I understand, the problem is related to how Labview accepts the arguments of the call. ParamNames is an array of string references, ParamVals is an array of references to variants. In VB the values in ParamVals are used both to transfer the values of the parameters, and to receive the results. I realise this is not handeled this way in PythonCOM - as stated in the Paragraf "Passing and Obtaining Python Objects from COM", chapter 12 of "Python programming on Win32" - so I frankly don't have a clue if what I'm trying to do is possible at all. Also, please note that the type of the object VI is not known to Python: >>> VI > because it was returned by a factory method, I guess. I'd be gratefull for any helpfull sugestion. Sincerelly, Nenad Propadovic ------------------------------------------------- debitel.net Webmail From emlynj at gmail.com Mon Jul 3 11:50:16 2006 From: emlynj at gmail.com (Emlyn Jones) Date: Mon, 3 Jul 2006 10:50:16 +0100 Subject: [python-win32] Python/ASP Request data with non ascii characters In-Reply-To: <0b1b01c69ca4$771a74f0$100a0a0a@enfoldsystems.local> References: <0b1b01c69ca4$771a74f0$100a0a0a@enfoldsystems.local> Message-ID: On 7/1/06, Mark Hammond wrote: > > I thought I would be able to do > > > > my_string = unicode(Request("formstring"),"ISO-8859-1")> > > > But i get: > > coercing to Unicode: need string or buffer, instance found. > > I'm guessing (and I mean guessing) this is because the CDispatch > > object doesn't have a __unicode__ function. > > A __unicode__ function may well help there - but alternatively, you should > find that something like Request("formstring").Value (or similar) will give > you the unicode string. I'm afraid I can't recall exactly what the Request > method returns in that case, so .Value is a guess... > > Cheers, > > Mark > > Hi Mark, thanks for the reply. The attribute you where thinking off is `Item`. What I'll need to work out now is which code page has been used to encode that Unicode string. Possibly the wrong list for this question, but does anybody know if it is likely to of used the code page of the client browser or the default system code page of the server? Is there a way for me to find the code page from the object? Cheers, Emlyn. From aurora00 at gmail.com Mon Jul 3 19:09:16 2006 From: aurora00 at gmail.com (aurora) Date: Mon, 03 Jul 2006 10:09:16 -0700 Subject: [python-win32] Non-ascii character in source code cause 'Exception occurred' Message-ID: I find that putting any non-ascii character in the Python source code would cause an unspecific "Exception occurred" error. For example, _u.py # ? print 'hello' g:\usr\bin\EmEditor Macros>cscript /e:python _u.py Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. CScript Error: Execution of the Windows Script Host failed. (Exception occurred. ) Any presence of a non-ascii character, even if it is in the comment only, would cause this problem. I have tried various encoding, with or without BOM, and also adding the encoding specification at the top of the file. All these give the same result. On the other hand a similar Javascript would run alright. Is this a win32 implementation issue? wy From aurora00 at gmail.com Mon Jul 3 19:42:08 2006 From: aurora00 at gmail.com (aurora) Date: Mon, 03 Jul 2006 10:42:08 -0700 Subject: [python-win32] Non-ascii character in source code cause 'Exception occurred' References: Message-ID: P.S. The script can actually process unicode, passing unicode text to and from other COM objects. E.g. print u'\N{Euro Sign}'.encode('utf-8') The only problem is the source code cannot have any non-ascii characters. wy > I find that putting any non-ascii character in the Python source code > would cause an unspecific "Exception occurred" error. For example, > > _u.py > > # ? > print 'hello' > > > g:\usr\bin\EmEditor Macros>cscript /e:python _u.py > Microsoft (R) Windows Script Host Version 5.6 > Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. > > CScript Error: Execution of the Windows Script Host failed. (Exception > occurred. ) > > > > Any presence of a non-ascii character, even if it is in the comment only, > would cause this problem. I have tried various encoding, with or without > BOM, and also adding the encoding specification at the top of the file. > All these give the same result. On the other hand a similar Javascript > would run alright. > > Is this a win32 implementation issue? > > wy From mhammond at skippinet.com.au Tue Jul 4 05:07:33 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 4 Jul 2006 13:07:33 +1000 Subject: [python-win32] Python/ASP Request data with non ascii characters In-Reply-To: Message-ID: <12c901c69f16$ff66c560$100a0a0a@enfoldsystems.local> > Hi Mark, thanks for the reply. The attribute you where > thinking off is `Item`. > What I'll need to work out now is which code page has been used to > encode that Unicode string. I'm not sure that is relevant. If I understand correctly, the code-page is only used when converting from a string of 8-bit characters into Unicode. Once the string is represented as unicode characters, the code page isn't relevant. Cheers, Mark From mhammond at skippinet.com.au Tue Jul 4 05:09:16 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 4 Jul 2006 13:09:16 +1000 Subject: [python-win32] Non-ascii character in source code cause 'Exceptionoccurred' In-Reply-To: Message-ID: <12ce01c69f17$3c1fa990$100a0a0a@enfoldsystems.local> > Any presence of a non-ascii character, even if it is in the > comment only, > would cause this problem. I have tried various encoding, with > or without > BOM, and also adding the encoding specification at the top of > the file. > All these give the same result. On the other hand a similar > Javascript > would run alright. > > Is this a win32 implementation issue? Yes, this is a problem in pywin32. I've fixed it locally (well, at least extended chars in comments now works), so it will be available as soon as I get a new pywin32 build out. Cheers, Mark From dprovins at tridentexploration.ca Tue Jul 4 17:10:51 2006 From: dprovins at tridentexploration.ca (Dean Allen Provins) Date: Tue, 04 Jul 2006 09:10:51 -0600 Subject: [python-win32] ODBC and Oracle In-Reply-To: References: Message-ID: <44AA84FB.8050407@tridentexploration.ca> Roger Roger Upole wrote: > Dean Allen Provins wrote: > snip=== > > The parameter to odbc.SQLDataSources is a flag, rather than a position. > > import odbc > s=odbc.SQLDataSources(odbc.SQL_FETCH_FIRST) > while s: > print s > s=odbc.SQLDataSources (odbc.SQL_FETCH_NEXT) > > Roger Thanks Roger. That explains a lot, and also found all the available sources Regards, Dean -- Dean Provins, P. Geoph. dprovins at tridentexploration.ca dprovins at alumni.ucalgary.ca KeyID at at pgpkeys.mit.edu:11371: 0x9643AE65 Fingerprint: 9B79 75FB 5C2B 22D0 6C8C 5A87 D579 9BE5 9643 AE65 Confidentiality Notice: The information transmitted herein may contain confidential, proprietary and/or privileged material which belongs to Trident Exploration Corp. and its affiliates and is intended only for the addressee(s). Any unauthorized review, distribution or other use or the taking of any action in reliance upon this information is prohibited. If you received this email in error, please contact the sender or call (403) 770-1765 and delete this email and any copies. From aurora00 at gmail.com Tue Jul 4 18:15:54 2006 From: aurora00 at gmail.com (aurora) Date: Tue, 04 Jul 2006 09:15:54 -0700 Subject: [python-win32] Non-ascii character in source code cause 'Exceptionoccurred' References: <12ce01c69f17$3c1fa990$100a0a0a@enfoldsystems.local> Message-ID: Thank you for the quick response :) wy >> Any presence of a non-ascii character, even if it is in the >> comment only, >> would cause this problem. I have tried various encoding, with >> or without >> BOM, and also adding the encoding specification at the top of >> the file. >> All these give the same result. On the other hand a similar >> Javascript >> would run alright. >> >> Is this a win32 implementation issue? > > Yes, this is a problem in pywin32. I've fixed it locally (well, at least > extended chars in comments now works), so it will be available as soon > as I > get a new pywin32 build out. > > Cheers, > > Mark From mhammond at skippinet.com.au Wed Jul 5 07:06:54 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 5 Jul 2006 15:06:54 +1000 Subject: [python-win32] Calling Labview 8 via Python and COM In-Reply-To: <1151919139.44a8e42391667@www.debitel.net> Message-ID: <163b01c69ff0$d5fccdc0$100a0a0a@enfoldsystems.local> Sorry for the delay: > VI.ShowFPOnCall = True > VI.Call(ParamNames, ParamVals) > print ParamVals[1] Before the failing Call, try adding: VI._FlagAsMethod("Call") _FlagAsMethod is a helper method inside these dynamic objects and will help work-around COM objects that don't differentiate property references from method calls (such as LabView) Cheers, Mark From propadovic.nenad at debitel.net Wed Jul 5 15:31:43 2006 From: propadovic.nenad at debitel.net (propadovic.nenad at debitel.net) Date: 5 Jul 2006 15:31:43 +0200 Subject: [python-win32] Calling Labview 8 via Python and COM In-Reply-To: <163b01c69ff0$d5fccdc0$100a0a0a@enfoldsystems.local> References: <163b01c69ff0$d5fccdc0$100a0a0a@enfoldsystems.local> Message-ID: <1152106302.44abbf3edb6da@www.debitel.net> Hello Mr. Hammond, thanks a lot for the answer. I tried the solution, and it woks fine, that is, with Python 2.4 and a recent version of win32all. I'm, however, bound to Python 2.2.1 and win32all build 146, which are an integral part of the software offering of dSpace automotive test equipment company. So when I use the method _FlagAsMethod, I receive the following traceback: ... AttributeError: ._FlagAsMethod Is there a way to patch this new feature into the distribution I'm using, without changing the whole setup of the SW? Thanks in advance, Nenad Propadovic > > VI.ShowFPOnCall = True > > VI.Call(ParamNames, ParamVals) > > print ParamVals[1] > > Before the failing Call, try adding: > > VI._FlagAsMethod("Call") > > _FlagAsMethod is a helper method inside these dynamic objects and will help > work-around COM objects that don't differentiate property references from > method calls (such as LabView) ------------------------------------------------- debitel.net Webmail From emlynj at gmail.com Wed Jul 5 23:31:16 2006 From: emlynj at gmail.com (Emlyn Jones) Date: Wed, 5 Jul 2006 22:31:16 +0100 Subject: [python-win32] Python/ASP Request data with non ascii characters In-Reply-To: <12c901c69f16$ff66c560$100a0a0a@enfoldsystems.local> References: <12c901c69f16$ff66c560$100a0a0a@enfoldsystems.local> Message-ID: <200607052231.16339.emlynj@gmail.com> On Tuesday 04 Jul 2006 04:07, you wrote: > > Hi Mark, thanks for the reply. The attribute you where > > thinking off is `Item`. > > What I'll need to work out now is which code page has been used to > > encode that Unicode string. > > I'm not sure that is relevant. If I understand correctly, the code-page is > only used when converting from a string of 8-bit characters into Unicode. > Once the string is represented as unicode characters, the code page isn't > relevant. Hi Mark, For my own internal storage that's correct, I can just leave it as Unicode (as long as I read it back as unicode and send it to the browser as unicode). I need to pass it on to a third party app though and that isn't unicode aware (yet). I've found a few solutions, none directly relevant to Python. In the interests of completeness however... Firefox and IE will populate a hidden field called _charset_ on the form with the encoding used to submit the form. I can also "hope" that the form is submitted back in the same encoding it was sent (although the user can change that). Cheers, Emlyn. From bwmetz at att.com Thu Jul 6 01:32:30 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Wed, 5 Jul 2006 18:32:30 -0500 Subject: [python-win32] Transparent Windows - API failure Message-ID: <01D5341D04A2E64AB9B3457690473367020D7191@OCCLUST01EVS1.ugd.att.com> All, This is my first attempt with setting transparent backgrounds, so probably simple error. I've had some success making Notepad transparent, but am getting no results against a Tkinter window. Also, any workaround to using SetLayeredWindowAttributes on Win2000? I noticed in the docs it's not in win32gui to prevent issues with NT? import win32con import win32gui import winxpgui # Assume you have a tk window open with hWND of 1050292 # from tkinter import * # root = Tk() # root['bg'] = "white" hWND = 1050292 win32gui.SetWindowLong (hWND, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hWND, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED ) winxpgui.SetLayeredWindowAttributes(hWND, bgColor, 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA) Produces error... Traceback (most recent call last): File "", line 1, in ? winxpgui.SetLayeredWindowAttributes(hWND, win32api.RGB(255, 255, 255), 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA) error: (0, 'SetLayeredWindowAttributes', 'No error message is available') Thanks, Bobby -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060705/a539bea0/attachment.htm From mhammond at skippinet.com.au Thu Jul 6 08:52:32 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 6 Jul 2006 16:52:32 +1000 Subject: [python-win32] Transparent Windows - API failure In-Reply-To: <01D5341D04A2E64AB9B3457690473367020D7191@OCCLUST01EVS1.ugd.att.com> Message-ID: <1b1f01c6a0c8$c2460570$100a0a0a@enfoldsystems.local> > Also, any workaround to using SetLayeredWindowAttributes on Win2000? > I noticed in the docs it's not in win32gui to prevent issues with NT? Well - "prevent issues" actually translates to "easier" :) A better work-around would be to have the C++ code use LoadLibrary, and I'd be happy to accept such patches. > winxpgui.SetLayeredWindowAttributes(hWND, bgColor, 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA) > Produces error... > Traceback (most recent call last): > File "", line 1, in ? > winxpgui.SetLayeredWindowAttributes(hWND, win32api.RGB(255, 255, 255), 50, win32con.LWA_COLORKEY|win32con.LWA_ALPHA) > error: (0, 'SetLayeredWindowAttributes', 'No error message is available') I'm afraid all I can tell you is that the BOOL function SetLayeredWindowAttributes failed, and it didn't call SetLastError to offer any clues as to why. My only advice is to look wider than the Python universe to try and determine things that can cause the API function to fail, in anyone's language. Cheers, Mark. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 2200 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060706/dc6feb84/attachment.bin From mhammond at skippinet.com.au Thu Jul 6 08:57:48 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 6 Jul 2006 16:57:48 +1000 Subject: [python-win32] Calling Labview 8 via Python and COM In-Reply-To: <1152106302.44abbf3edb6da@www.debitel.net> Message-ID: <1b2c01c6a0c9$7e3ebfb0$100a0a0a@enfoldsystems.local> > Is there a way to patch this new feature into the > distribution I'm using, > without changing the whole setup of the SW? This function should patch into that win32all version just fine. Locate the method definition in win32com\client\dynamic.py, and just paste it directly into the relevant location in your older version. These files have been fairly stable for quite some time, so I fully expect that to work (but let me know if it doesn't and I'll try and track down the exact checkin I made) Mark From duanek at chorus.net Thu Jul 6 05:10:23 2006 From: duanek at chorus.net (duanek at chorus.net) Date: Wed, 5 Jul 2006 22:10:23 -0500 Subject: [python-win32] Trouble Automating Alibre CAD package Message-ID: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> Hello, I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express. The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines: [Python Code] import win32com.client AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook") [End Python code] Error traceback: AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook") File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) Any ideas what to try next? Thanks, Duane From propadovic.nenad at debitel.net Thu Jul 6 13:53:59 2006 From: propadovic.nenad at debitel.net (propadovic.nenad at debitel.net) Date: 6 Jul 2006 13:53:59 +0200 Subject: [python-win32] Calling Labview 8 via Python and COM In-Reply-To: <1b2c01c6a0c9$7e3ebfb0$100a0a0a@enfoldsystems.local> References: <1b2c01c6a0c9$7e3ebfb0$100a0a0a@enfoldsystems.local> Message-ID: <1152186839.44acf9d79be57@www.debitel.net> Hello Mr. Hammond, thanks once again, it worked fine, indeed. Have a nice day. Yours sincerelly, Nenad Propadovic > > Is there a way to patch this new feature into the > > distribution I'm using, > > without changing the whole setup of the SW? > > This function should patch into that win32all version just fine. Locate the > method definition in win32com\client\dynamic.py, and just paste it directly > into the relevant location in your older version. These files have been > fairly stable for quite some time, so I fully expect that to work (but let > me know if it doesn't and I'll try and track down the exact checkin I made) > > Mark ------------------------------------------------- debitel.net Webmail From rodrigo at 1bit.com.br Thu Jul 6 14:40:39 2006 From: rodrigo at 1bit.com.br (Rodrigo Strauss) Date: Thu, 6 Jul 2006 09:40:39 -0300 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> References: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> Message-ID: I think trying to create the object using VBScript is a good idea. This way you will know who to blame (pywin or the component). ===ThisIsJustATestIWouldLikeToDoItInPython.vbs === Dim x Set x = CreateObject ("AlibreX.AutomationHook") ===EOF== Does it work? I'm not 100% sure, but AFAIK VB doesn't need the IDispatch, as far as the component provide a type library and oleautomation types. Mark: can dispatch-less objects be used from win32com? Rodrigo Strauss On 7/6/06, duanek at chorus.net wrote: > Hello, > > I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express. > > The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines: > > [Python Code] > import win32com.client > AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook") > [End Python code] > > Error traceback: > AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook") > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch > dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) > pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) > > > Any ideas what to try next? > > Thanks, > Duane > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From timr at probo.com Thu Jul 6 18:20:02 2006 From: timr at probo.com (Tim Roberts) Date: Thu, 06 Jul 2006 09:20:02 -0700 Subject: [python-win32] Transparent Windows - API failure In-Reply-To: References: Message-ID: <44AD3832.1010809@probo.com> On Wed, 5 Jul 2006 18:32:30 -0500, "Metz, Bobby W, WWCS" wrote: >All, > This is my first attempt with setting transparent backgrounds, >so probably simple error. I've had some success making Notepad >transparent, but am getting no results against a Tkinter window. Also, >any workaround to using SetLayeredWindowAttributes on Win2000? I >noticed in the docs it's not in win32gui to prevent issues with NT? > SetLayeredWindowAttributes depends on having the target window respond in a standard way to the normal window messages. Tk does ALL of its own drawing -- every single pixel. It doesn't use the native OS UI services for anything. My guess is THAT'S why SetLayeredWindowAttributes fails. You may have to wait until Vista to get transparent Tk windows. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From bwmetz at att.com Thu Jul 6 23:54:46 2006 From: bwmetz at att.com (Metz, Bobby W, WWCS) Date: Thu, 6 Jul 2006 16:54:46 -0500 Subject: [python-win32] Transparent Windows - API failure In-Reply-To: <44AD3832.1010809@probo.com> Message-ID: <01D5341D04A2E64AB9B3457690473367020D7C2A@OCCLUST01EVS1.ugd.att.com> Thanks Tim & Mark. I was guessing Tk too but hoping it would work since the Tkinter alpha parameter for toplevel windows doesn't work and it seems sparsely documented. I was hoping it was something wrong with the way I was calling it. I'll hit up the tkinter list to see if others have had better luck. Thanks, Bobby -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Tim Roberts Sent: Thursday, July 06, 2006 9:20 AM To: python-win32 at python.org Subject: Re: [python-win32] Transparent Windows - API failure On Wed, 5 Jul 2006 18:32:30 -0500, "Metz, Bobby W, WWCS" wrote: >All, > This is my first attempt with setting transparent backgrounds, >so probably simple error. I've had some success making Notepad >transparent, but am getting no results against a Tkinter window. Also, >any workaround to using SetLayeredWindowAttributes on Win2000? I >noticed in the docs it's not in win32gui to prevent issues with NT? > SetLayeredWindowAttributes depends on having the target window respond in a standard way to the normal window messages. Tk does ALL of its own drawing -- every single pixel. It doesn't use the native OS UI services for anything. My guess is THAT'S why SetLayeredWindowAttributes fails. You may have to wait until Vista to get transparent Tk windows. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From billiejoex at fastwebnet.it Fri Jul 7 13:19:32 2006 From: billiejoex at fastwebnet.it (billiejoex at fastwebnet.it) Date: Fri, 7 Jul 2006 13:19:32 +0200 (CEST) Subject: [python-win32] Run a script/executable as a service Message-ID: <2548101.17241152271172929.JavaMail.root@pr003msr> Hi all. I would be very greatful if someone could give me an example code on how install an executable/python_script as a service under Windows NT platforms. I tried to play with win32serviceutil.InstallService() function and win32serviceutil.ServiceFramework class but I can't work it out yet. Can someone please give me an help? Thanks in advance. From duaneklean at tds.net Fri Jul 7 05:06:10 2006 From: duaneklean at tds.net (Duane Kaufman) Date: Thu, 6 Jul 2006 22:06:10 -0500 Subject: [python-win32] Trouble Automating Alibre CAD package Message-ID: <20060707030610.OCSS16096.outaamta01.mail.tds.net@smtp.tds.net> Hi, Thanks for the idea. When I create a minimal project in MS Basic Express (console App) the following works: Module Module1 Sub Main() Dim AlibreHook As AlibreX.AutomationHook AlibreHook = GetObject(, "AlibreX.AutomationHook") Dim AlibreRoot As AlibreX.IADRoot AlibreRoot = AlibreHook.Root Console.WriteLine("Version " & AlibreRoot.version) End Sub End Module When I try the same thing in a vbs script, and run with wscript: Dim AlibreHook AlibreHook = GetObject(, "AlibreX.AutomationHook") Dim AlibreRoot AlibreRoot = AlibreHook.Root WScript.Echo("Version " & AlibreRoot.version) I get the error: Line: 4 Char: 9 Error: Object required Code: 800A01A8 Source: Microsoft VBScript runtime error The TypeName(AlibreRoot) in the second example yields 'Unknown' All of the examples have this component started and attach to a running instance with GetObject. Any new insights? THanks, Duane> > I think trying to create the object using VBScript is a good idea. > This way you will know who to blame (pywin or the component). > > ===ThisIsJustATestIWouldLikeToDoItInPython.vbs === > Dim x > Set x = CreateObject ("AlibreX.AutomationHook") > ===EOF== > > Does it work? > > I'm not 100% sure, but AFAIK VB doesn't need the IDispatch, as far as > the component provide a type library and oleautomation types. > > Mark: can dispatch-less objects be used from win32com? > > Rodrigo Strauss > > On 7/6/06, duanek at chorus.net wrote: > > Hello, > > > > I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express. > > > > The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines: > > > > [Python Code] > > import win32com.client > > AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook") > > [End Python code] > > > > Error traceback: > > AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook") > > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch > > dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName> > return (_GetGoodDispatch(IDispatch, clsctx), userName) > > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch> > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) > > pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) > > > > > > Any ideas what to try next? > > > > Thanks, > > Duane> > > > > > _______________________________________________ > > 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 Jim.Vickroy at noaa.gov Fri Jul 7 20:17:30 2006 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri, 07 Jul 2006 12:17:30 -0600 Subject: [python-win32] ADOX Delete method ? In-Reply-To: References: Message-ID: <44AEA53A.60108@noaa.gov> ADOX Catalog objects appear to have a Delete method (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/admscadoddlmethods.asp) but I'm not seeing it from python-win: >>> from win32com.client import Dispatch >>> catalog = Dispatch('ADOX.Catalog') >>> print dir(catalog) ['CLSID', 'Create', 'GetObjectOwner', 'SetActiveConnection', 'SetObjectOwner', '_ApplyTypes_', '__call__', '__cmp__', '__doc__', '__getattr__', '__init__', '__int__', '__module__', '__repr__', '__setattr__', '__str__', '__unicode__', '_get_good_object_', '_get_good_single_object_', '_oleobj_', '_prop_map_get_', '_prop_map_put_', 'coclass_clsid'] I'm using Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] and pywin32 build 208. Have I overlooked something? Thanks, -- jv From rwupole at msn.com Fri Jul 7 21:41:58 2006 From: rwupole at msn.com (Roger Upole) Date: Fri, 7 Jul 2006 15:41:58 -0400 Subject: [python-win32] Re: ADOX Delete method ? Message-ID: Jim Vickroy wrote: > ADOX Catalog objects appear to have a Delete method > (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/admscadoddlmethods.asp) > but I'm not seeing it from python-win: > > >>> from win32com.client import Dispatch > >>> catalog = Dispatch('ADOX.Catalog') > >>> print dir(catalog) > ['CLSID', 'Create', 'GetObjectOwner', 'SetActiveConnection', > 'SetObjectOwner', '_ApplyTypes_', '__call__', '__cmp__', '__doc__', > '__getattr__', '__init__', '__int__', '__module__', '__repr__', > '__setattr__', '__str__', '__unicode__', '_get_good_object_', > '_get_good_single_object_', '_oleobj_', '_prop_map_get_', > '_prop_map_put_', 'coclass_clsid'] > > I'm using Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit > (Intel)] and pywin32 build 208. > > Have I overlooked something? > > Thanks, > The Delete method is part of the catalog's collections. catalog.Tables.Delete, catalog.Users.Delete, etc Roger From rwupole at msn.com Sat Jul 8 07:23:39 2006 From: rwupole at msn.com (Roger Upole) Date: Sat, 8 Jul 2006 01:23:39 -0400 Subject: [python-win32] Re: Transparent Windows - API failure Message-ID: "Metz, Bobby W, WWCS" wrote > All, > This is my first attempt with setting transparent backgrounds, > so probably simple error. I've had some success making Notepad > transparent, but am getting no results against a Tkinter window. Also, > any workaround to using SetLayeredWindowAttributes on Win2000? I > noticed in the docs it's not in win32gui to prevent issues with NT? Just checked in a change that loads the function pointer at run time so this function can be used from win32gui also. Roger From mhammond at skippinet.com.au Sun Jul 9 13:50:20 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 9 Jul 2006 21:50:20 +1000 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: <20060707030610.OCSS16096.outaamta01.mail.tds.net@smtp.tds.net> Message-ID: <282a01c6a34d$db317a60$100a0a0a@enfoldsystems.local> > When I try the same thing in a vbs script, and run with wscript: > > Dim AlibreHook AlibreHook = GetObject(, > "AlibreX.AutomationHook") > Dim AlibreRoot AlibreRoot = AlibreHook.Root > WScript.Echo("Version " & AlibreRoot.version) > > I get the error: > Line: 4 > Char: 9 > Error: Object required > Code: 800A01A8 > Source: Microsoft VBScript runtime error > > The TypeName(AlibreRoot) in the second example yields 'Unknown' > > All of the examples have this component started and attach to > a running instance with GetObject. > > Any new insights? The above just confirms what Rodrigo mentions in the text quoted below: > > I think trying to create the object using VBScript is a good idea. > > This way you will know who to blame (pywin or the component). > > > > ===ThisIsJustATestIWouldLikeToDoItInPython.vbs === > > Dim x > > Set x = CreateObject ("AlibreX.AutomationHook") > > ===EOF== > > > > Does it work? > > > > I'm not 100% sure, but AFAIK VB doesn't need the IDispatch, > as far as > > the component provide a type library and oleautomation types. > > > > Mark: can dispatch-less objects be used from win32com? The object doesn't support IDispatch, so win32com and VBScript can't use it. (ie, the answer to Rodrigo's question is "no") Cheers, Mark From duaneklean at tds.net Sun Jul 9 16:27:34 2006 From: duaneklean at tds.net (Duane Kaufman) Date: Sun, 9 Jul 2006 9:27:34 -0500 Subject: [python-win32] Trouble Automating Alibre CAD package Message-ID: <20060709142734.IBEU16096.outaamta01.mail.tds.net@smtp.tds.net> Hi, Thanks Mark. I know this isn't the (strictly) correct group to ask this, but does anyone know if ctypes has any more capabilities with regard to this problem? Thanks, Duane > > From: "Mark Hammond" > Date: 2006/07/09 Sun AM 06:50:20 CDT > To: , > Subject: RE: [python-win32] Trouble Automating Alibre CAD package > > > When I try the same thing in a vbs script, and run with wscript: > > > > Dim AlibreHook AlibreHook = GetObject(, > > "AlibreX.AutomationHook") > > Dim AlibreRoot AlibreRoot = AlibreHook.Root > > WScript.Echo("Version " & AlibreRoot.version) > > > > I get the error: > > Line: 4 > > Char: 9 > > Error: Object required > > Code: 800A01A8 > > Source: Microsoft VBScript runtime error > > > > The TypeName(AlibreRoot) in the second example yields 'Unknown' > > > > All of the examples have this component started and attach to > > a running instance with GetObject. > > > > Any new insights? > > The above just confirms what Rodrigo mentions in the text quoted below: > > > > I think trying to create the object using VBScript is a good idea. > > > This way you will know who to blame (pywin or the component). > > > > > > ===ThisIsJustATestIWouldLikeToDoItInPython.vbs === > > > Dim x > > > Set x = CreateObject ("AlibreX.AutomationHook") > > > ===EOF== > > > > > > Does it work? > > > > > > I'm not 100% sure, but AFAIK VB doesn't need the IDispatch, > > as far as > > > the component provide a type library and oleautomation types. > > > > > > Mark: can dispatch-less objects be used from win32com? > > The object doesn't support IDispatch, so win32com and VBScript can't use it. > (ie, the answer to Rodrigo's question is "no") > > Cheers, > > Mark > From mhammond at skippinet.com.au Mon Jul 10 01:22:27 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 10 Jul 2006 09:22:27 +1000 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: <20060709142734.IBEU16096.outaamta01.mail.tds.net@smtp.tds.net> Message-ID: <29b401c6a3ae$8b1e65e0$100a0a0a@enfoldsystems.local> > I know this isn't the (strictly) correct group to ask this, > but does anyone know if ctypes has any more capabilities with > regard to this problem? I believe it does, yes, although I've never attempted to use it. Longer term, I can picture ctypes being used by pywin32 to also provide that facility. Cheers, Mark From Jim.Vickroy at noaa.gov Mon Jul 10 23:52:58 2006 From: Jim.Vickroy at noaa.gov (Jim.Vickroy at noaa.gov) Date: Mon, 10 Jul 2006 15:52:58 -0600 Subject: [python-win32] ADOX catalog.Table.Append error -- 'The parameter is incorrect.', Message-ID: <7d5457ee61.7ee617d545@noaa.gov> Hello, I am a novice user of ADOX who is attempting to create a database and a table in it. I seem to be able to create a SQL Express database but am unable to add a table to it. The attached script (adox.py) illustrates the difficulty. Any suggestions would be appreciated. Thanks, -- jv -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: adox.py Url: http://mail.python.org/pipermail/python-win32/attachments/20060710/47ad2e7f/attachment.pot From eric.powell at srs.gov Tue Jul 11 13:27:19 2006 From: eric.powell at srs.gov (eric.powell at srs.gov) Date: Tue, 11 Jul 2006 07:27:19 -0400 Subject: [python-win32] ADOX catalog.Table.Append error -- 'The parameter is incorrect.', In-Reply-To: <7d5457ee61.7ee617d545@noaa.gov> Message-ID: Might I suggest just using a "CREATE TABLE" sql statement through ADO instead? sqlstatement = "CREATE TABLE SPAM (SpamID Int Not Null, Eggs Char(20));" conn = win32com.client.Dispatch(r'ADODB.Connection') DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' + self.dbpath + ';' conn.Open(DSN) #Query the recordset - should be in module with establishing connection stuff rs = win32com.client.Dispatch(r'ADODB.Recordset') try: rs.Open(sqlstatement, conn,1 ,3) except: print 'DB Error' Eric B. Powell BSRI Electronic Aids (803)208-6207 Jim.Vickroy at noaa.gov Sent by: python-win32-bounces at python.org 07/10/2006 05:52 PM To python-win32 at python.org cc Subject [python-win32] ADOX catalog.Table.Append error -- 'The parameter is incorrect.', Hello, I am a novice user of ADOX who is attempting to create a database and a table in it. I seem to be able to create a SQL Express database but am unable to add a table to it. The attached script (adox.py) illustrates the difficulty. Any suggestions would be appreciated. Thanks, -- jv _______________________________________________ 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: http://mail.python.org/pipermail/python-win32/attachments/20060711/78d417db/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: adox.py Type: application/octet-stream Size: 1277 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060711/78d417db/attachment.obj From johann.abraham at gmail.com Tue Jul 11 21:15:57 2006 From: johann.abraham at gmail.com (Johann Abraham) Date: Tue, 11 Jul 2006 12:15:57 -0700 Subject: [python-win32] Exchange Server Event Solution Message-ID: <9a7a0cc50607111215lf8fa406saeb67483ea52cd0c@mail.gmail.com> I wanted to post the solution to a question in Feb. of 2002 because it took me a little bit longer to solve than I thought it would and I thought if I could spare people having to rummage through the exchange SDK on MSDN I could also save them a lot of time. The question was how to access an exchange server event but a lot of the details were left out, including how to register the events with exchange. Step 1) Use the PythonWin Com MakePy utility to for EXOLEDB Step 2) Make your Com class: ie. from win32com.client import Dispatch from win32com import universal IExStoreSyncEvents_methods = ["OnSyncSave"] universal.RegisterInterfaces('{GUID for EXOLEDB MakePy file}',0,1,0, ["IExStoreSyncEvents"]) #GUID in file name class MyEventListener: _public_methods_ = IExStoreSyncEvents_methods _com_interfaces_ = ['IExStoreSyncEvents'] #interface to implement _reg_clsid_ = "{D7CDBFB7-7B49-4EA4-9F8E-47152ED86991}" #CLSID unique _reg_progid_ = "MyEventListener" _reg_desc_ = "My Event Listener" # IExStoreSyncEvents interfaces def OnSyncSave(self, pEventInfo, strUrl, lFlags): #pEventInfo,strUrl,IFlags <- check SDK # Called by a store when an item is saved. self.sendMessage('ToUser at Domain.com','FromUser at kelsan.com', 'tester','OnSyncSave') #tests that sync works properly return def OnSyncDelete(self, pEventInfo, strUrl, lFlags): # Called by a store when an item is deleted. pass def sendMessage(self, To, From, Subject, Text): #sends email Msg = Dispatch("CDO.Message") Msg.To = To Msg.From = From Msg.Subject = Subject Msg.TextBody = Text #' Send the message. Msg.Send() return if __name__=='__main__': try: # import event sink type library import win32com.server.register win32com.server.register.UseCommandLine(MyEventListener) except: raise RuntimeError, "could not import event sink type library" Step 3) Make a COM+ object Programs->Administrative tools->Component Services under Component Services tab, select: computers->My Computer->Com+ Applications right click Com+ Applications Select New->Application click next->Create An Empty Application Name application same as class Select Server Application Click next Define the scope for the com+ class, most likely you'll want it for a single user and want it to run regardless if someone is logged on so: Select: this user->browse, type name and Check names, click OK fill in password, click next click next, next, and finish expand Com+ Applications tree, expand your new com+ object tree right click Components->new->Component next->Import Component->select your Com class->finish select Com+ Application, Right click, select properties, find Security tab, turn off Enforce Access Checks for this application select Perform access checks only at process level. Select Okay Step 4) Open Command Prompt find regevent.vbs, should be in C:\Program Files\Exchange SDK\SDK\Support\OLEDB\Scripts C:\Program Files\Exchange SDK\SDK\Support\OLEDB\Scripts>cscript RegEvent.vbsadd onsyncsave MyEventListener file://./backofficestorage/Domain/mbx/user/inbox/evtreg1 Now send some mail to whichever inbox you set up the event at, give it a few minutes, and enjoy that you didn't have to read the MSDN Exchange SDK yet! Alas, the code isn't perfect and you'll receive two emails instead of one, thats what the IFlags are for in the OnSyncSave function, check out the VB or C++ code given in the SDK and you should have that whipped pretty fast. Johann -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060711/7d62ca35/attachment.htm From rwupole at msn.com Wed Jul 12 03:29:00 2006 From: rwupole at msn.com (Roger Upole) Date: Tue, 11 Jul 2006 21:29:00 -0400 Subject: [python-win32] Re: ADOX catalog.Table.Append error -- 'The parameter is Message-ID: Jim.Vickroy wrote: > Hello, > > I am a novice user of ADOX who is attempting to create a database and > a table in it. > > I seem to be able to create a SQL Express database but am unable to > add a table to it. > > The attached script (adox.py) illustrates the difficulty. > > Any suggestions would be appreciated. I think Sql Server requires that you create the table before adding any keys. Try moving the table.Keys.Append to after catalog.Tables.Append. Roger From theller at python.net Wed Jul 12 13:22:41 2006 From: theller at python.net (Thomas Heller) Date: Wed, 12 Jul 2006 13:22:41 +0200 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> References: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> Message-ID: duanek at chorus.net schrieb: > Hello, > > I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express. > > The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines: > > [Python Code] > import win32com.client > AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook") > [End Python code] > > Error traceback: > AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook") > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch > dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) > pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) > The problem seems that the COM object that Alibre implements is buggy. According to the type library (I've installed the free Express version) the call above should return an object that implements the IAutomationHook interface, which is derived from IDispatch: [ odl, uuid(424539A8-7014-4174-B0BF-F5EE5BB71DF5), helpstring("IAutomationHook interface"), dual, oleautomation ] interface IAutomationHook : IDispatch { [id(0x00000001), propget, helpstring("Returns the automation root")] HRESULT Root([out, retval] IDispatch** ppRoot); [id(0x00000002), helpstring("Initiates a new Alibre Design Automation client")] HRESULT Initialize( [in] BSTR serverURL, [in] BSTR loginID, [in] BSTR passwd, [in] VARIANT_BOOL disableSecureMode, [in] int unused); [id(0x00000003), helpstring("Initiates a new Debug client")] HRESULT InitializeDebug( [in] BSTR serverURL, [in] BSTR loginID, [in] BSTR passwd, [in] VARIANT_BOOL disableSecureMode, [in] int unused); }; Experiments with comtypes (the ctypes com framework) show that the object can successfully be QueryInterface'd for IAutomationHook, but not for IDispatch. I'm not sure pywin32 can handle such a buggy object, but you could probably try to run makepy on the typelib and then create the object. Others may have more knowledge if or how this would work. Thomas From theller at python.net Wed Jul 12 13:40:19 2006 From: theller at python.net (Thomas Heller) Date: Wed, 12 Jul 2006 13:40:19 +0200 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> References: <20060706031023.BSVO16096.outaamta01.mail.tds.net@smtp.tds.net> Message-ID: duanek at chorus.net schrieb: > > Hello, > > > > I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express. > > > > The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines: > > > > [Python Code] > > import win32com.client > > AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook") > > [End Python code] > > > > Error traceback: > > AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook") > > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch > > dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName > > return (_GetGoodDispatch(IDispatch, clsctx), userName) > > File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch > > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) > > pywintypes.com_error: (-2147467262, 'No such interface supported', None, None) > > The problem seems that the COM object that Alibre implements is buggy. According to the type library (I've installed the free Express version) the call above should return an object that implements the IAutomationHook interface, which is derived from IDispatch: [ odl, uuid(424539A8-7014-4174-B0BF-F5EE5BB71DF5), helpstring("IAutomationHook interface"), dual, oleautomation ] interface IAutomationHook : IDispatch { [id(0x00000001), propget, helpstring("Returns the automation root")] HRESULT Root([out, retval] IDispatch** ppRoot); [id(0x00000002), helpstring("Initiates a new Alibre Design Automation client")] HRESULT Initialize( [in] BSTR serverURL, [in] BSTR loginID, [in] BSTR passwd, [in] VARIANT_BOOL disableSecureMode, [in] int unused); [id(0x00000003), helpstring("Initiates a new Debug client")] HRESULT InitializeDebug( [in] BSTR serverURL, [in] BSTR loginID, [in] BSTR passwd, [in] VARIANT_BOOL disableSecureMode, [in] int unused); }; Experiments with comtypes (the ctypes com framework) show that the object can successfully be QueryInterface'd for IAutomationHook, but not for IDispatch. I'm not sure pywin32 can handle such a buggy object, but you could probably try to run makepy on the typelib and then create the object. Others may have more knowledge if or how this would work. Thomas From Jim.Vickroy at noaa.gov Wed Jul 12 16:39:51 2006 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed, 12 Jul 2006 08:39:51 -0600 Subject: [python-win32] ADOX catalog.Table.Append error -- 'The parameter is In-Reply-To: References: Message-ID: <44B509B7.8060005@noaa.gov> Roger Upole wrote: >Jim.Vickroy wrote: > > >>Hello, >> >>I am a novice user of ADOX who is attempting to create a database and >>a table in it. >> >>I seem to be able to create a SQL Express database but am unable to >>add a table to it. >> >>The attached script (adox.py) illustrates the difficulty. >> >>Any suggestions would be appreciated. >> >> > >I think Sql Server requires that you create the table before >adding any keys. Try moving the table.Keys.Append >to after catalog.Tables.Append. > > Roger > >_______________________________________________ >Python-win32 mailing list >Python-win32 at python.org >http://mail.python.org/mailman/listinfo/python-win32 > > Thank-you, Roger! You are correct. I was slowly being forced to the same conclusion, but you saved me considerable time trying permutations. I started by getting an Access script to work and then naively assumed all I had to do was change the connection string, but that was wrong. In case anyone is interested, I have attached a working example of how to create a SQL Express database with one table comprising two columns -- one of which is designated as the primary key. Thanks again to all who offered suggestions. -- jv -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060712/5e9039d7/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: sqlexpress.py Type: application/x-python Size: 1779 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060712/5e9039d7/attachment.bin From mhammond at skippinet.com.au Thu Jul 13 01:45:23 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 13 Jul 2006 09:45:23 +1000 Subject: [python-win32] Trouble Automating Alibre CAD package In-Reply-To: Message-ID: <365001c6a60d$3eb6c970$100a0a0a@enfoldsystems.local> Thomas wrote: > I'm not sure pywin32 can handle such a buggy object, > but you could probably try to run makepy on the typelib and then > create the object. What might work here is to pass a secret second arg to QueryInterface. This second arg can be the IID of the object returned from the call. So something like: ob = ob.QueryInterface(IID_IAutomationHook, pythoncom.IID_IDispatch) should theretically perform the QI for IAutomationHook, but return the resulting object in a PyIDispatch wrapper. What happens after that is anyone's guess though ;) Mark From duaneklean at tds.net Thu Jul 13 22:06:48 2006 From: duaneklean at tds.net (Duane Kaufman) Date: Thu, 13 Jul 2006 15:06:48 -0500 Subject: [python-win32] Trouble Automating Alibre CAD package Message-ID: <20060713200648.FRXS16096.outaamta01.mail.tds.net@smtp.tds.net> Hi, > > Thomas wrote: > > I'm not sure pywin32 can handle such a buggy object, > > but you could probably try to run makepy on the typelib and then > > create the object. > > What might work here is to pass a secret second arg to QueryInterface. This > second arg can be the IID of the object returned from the call. So > something like: > > ob = ob.QueryInterface(IID_IAutomationHook, pythoncom.IID_IDispatch) > I will admit to being a newbie to Python COM, but what is 'ob', and how do I create it? Thanks, Duane > should theretically perform the QI for IAutomationHook, but return the > resulting object in a PyIDispatch wrapper. > > What happens after that is anyone's guess though ;) > > Mark > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From Earle_Williams at ak.blm.gov Thu Jul 13 23:50:03 2006 From: Earle_Williams at ak.blm.gov (Earle_Williams at ak.blm.gov) Date: Thu, 13 Jul 2006 13:50:03 -0800 Subject: [python-win32] NTFS/MS Word file metadata - no PIDSI for Category? Message-ID: Hola, I'm trying to pull extended file properties from NTFS or MSWord files. List archives point to snippets from Mark Hammond and Roger Upole, and I can get to most of the metadata. However I'm having trouble getting to the 'Category' information. It seems in the NTFS metadata that item is flagged with a PIDSI_TITLE constant, at least that's what I get with my code (hacked from testStorage.py). If there is no 'Title' info and just Category info, the category info gets read as title., And in MSWord metadata I can't pull that info at all using Mark Hammond's DumpStorage snippet. I get everything else but not the 'Category' data. Anyone have advice on a method to definitively retrieve the category info? Regards, Earle From rwupole at msn.com Fri Jul 14 04:24:38 2006 From: rwupole at msn.com (Roger Upole) Date: Thu, 13 Jul 2006 22:24:38 -0400 Subject: [python-win32] Re: NTFS/MS Word file metadata - no PIDSI for Category? Message-ID: Earle Williams wrote: > Hola, > > I'm trying to pull extended file properties from NTFS or MSWord files. > List archives point to snippets from Mark Hammond and Roger Upole, and I > can get to most of the metadata. However I'm having trouble getting to the > 'Category' information. It seems in the NTFS metadata that item is flagged > with a PIDSI_TITLE constant, at least that's what I get with my code > (hacked from testStorage.py). If there is no 'Title' info and just > Category info, the category info gets read as title., > > And in MSWord metadata I can't pull that info at all using Mark Hammond's > DumpStorage snippet. I get everything else but not the 'Category' data. > > Anyone have advice on a method to definitively retrieve the category info? > Category is part of DocSummaryInformation, so you'll need the PIDDSI* constants instead of PIDSI*. (PIDDSI_CATEGORY just happens to be equal to PIDSI_TITLE) from win32com import storagecon import pythoncom fname='c:\\tmp.doc' pss=pythoncom.StgOpenStorageEx(fname, storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE, storagecon.STGFMT_DOCFILE, 0 , pythoncom.IID_IPropertySetStorage) ps=pss.Open(pythoncom.FMTID_DocSummaryInformation) print ps.ReadMultiple((storagecon.PIDDSI_CATEGORY,))[0] Roger From cbrossollet at imagine-optic.com Fri Jul 14 19:15:55 2006 From: cbrossollet at imagine-optic.com (Charles BROSSOLLET) Date: Fri, 14 Jul 2006 19:15:55 +0200 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails Message-ID: <20060714171021.B846F7BD25@imagine-optic.com> Hello, I cannot manage to use the ShowAllProcesses() function, it returns the following error : >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2. Thanks in advance for your support! Charles Brossollet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060714/9d4b73e2/attachment.htm From Earle_Williams at ak.blm.gov Fri Jul 14 23:55:34 2006 From: Earle_Williams at ak.blm.gov (Earle_Williams at ak.blm.gov) Date: Fri, 14 Jul 2006 13:55:34 -0800 Subject: [python-win32] Re: NTFS/MS Word file metadata - no PIDSI for Category? In-Reply-To: <000701c6a6ec$a9a519a0$0100a8c0@rupole> Message-ID: Posting this for posterity: a snippet to read and return the file properties summary information from a modern Windows file system. It works for me on Win XP Pro SP2 over NTFS and Active Directory. Thanks to Roger Upole and Mark Hammond for pointing the way, and my apologies for any python newb hacks
from win32com import storagecon
import pythoncom, os, sys


def get_stats(fname):
    author = title = subject = keywords = comments = category = None
    try:
        pssread=pythoncom.StgOpenStorageEx(fname,
storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE,
storagecon.STGFMT_FILE, 0 , pythoncom.IID_IPropertySetStorage)
    except:
        stg = pythoncom.StgOpenStorage(fname, None,
storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE )
        try:
            pssread = stg.QueryInterface(pythoncom.IID_IPropertySetStorage)
        except:
            print "No extended storage"
        else:
            try: ps =
pssread.Open(pythoncom.FMTID_SummaryInformation,storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE)
            except:
                pass
            else:
                author,title,subject,keywords,comments = ps.ReadMultiple(
(storagecon.PIDSI_AUTHOR, storagecon.PIDSI_TITLE, storagecon.PIDSI_SUBJECT,
storagecon.PIDSI_KEYWORDS, storagecon.PIDSI_COMMENTS) )
            try: ps =
pssread.Open(pythoncom.FMTID_DocSummaryInformation,storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE)
            except:
                pass
            else:
                category = ps.ReadMultiple( (storagecon.PIDDSI_CATEGORY,) )
[0]
        return author,title,subject,keywords,comments,category
    else:
        try: ps =
pssread.Open(pythoncom.FMTID_SummaryInformation,storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE)
        except:
            pass
        else:
            author,title,subject,keywords,comments = ps.ReadMultiple(
(storagecon.PIDSI_AUTHOR, storagecon.PIDSI_TITLE, storagecon.PIDSI_SUBJECT,
storagecon.PIDSI_KEYWORDS, storagecon.PIDSI_COMMENTS) )
        try: ps =
pssread.Open(pythoncom.FMTID_DocSummaryInformation,storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE)
        except:
            pass
        else:
            category = ps.ReadMultiple( (storagecon.PIDDSI_CATEGORY,) ) [0]
        try: ps =
pssread.Open(pythoncom.FMTID_UserDefinedProperties,storagecon.STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE)
        except:
            pass
        else:
            pass
        return author,title,subject,keywords,comments,category



if __name__=='__main__':
    args = sys.argv
    try: args[1]
    except:
        print "Usage: getstats filename"
    else:
        filename = args[1]
        print filename
        author,title,subject,keywords,comments,category = get_stats(
filename )
        print "  Author: %s" % author
        print "  Title: %s" % title
        print "  Subject: %s" % subject
        print "  Keywords: %s" % keywords
        print "  Comments: %s" % comments
        print "  Category: %s" % category
python-win32-bounces at python.org wrote on 07/13/2006 06:24:38 PM: > Earle Williams wrote: > > Hola, > > > > I'm trying to pull extended file properties from NTFS or MSWord files. > > List archives point to snippets from Mark Hammond and Roger Upole, and I > > can get to most of the metadata. However I'm having trouble getting to the > > 'Category' information. It seems in the NTFS metadata that item is flagged > > with a PIDSI_TITLE constant, at least that's what I get with my code > > (hacked from testStorage.py). If there is no 'Title' info and just > > Category info, the category info gets read as title., > > > > And in MSWord metadata I can't pull that info at all using Mark Hammond's > > DumpStorage snippet. I get everything else but not the 'Category' data. > > > > Anyone have advice on a method to definitively retrieve the category info? > > > > Category is part of DocSummaryInformation, so you'll need the PIDDSI* > constants instead of PIDSI*. (PIDDSI_CATEGORY just happens to be > equal to PIDSI_TITLE) > > from win32com import storagecon > import pythoncom > fname='c:\\tmp.doc' > > pss=pythoncom.StgOpenStorageEx(fname, storagecon. > STGM_READ|storagecon.STGM_SHARE_EXCLUSIVE, > storagecon.STGFMT_DOCFILE, 0 , pythoncom.IID_IPropertySetStorage) > ps=pss.Open(pythoncom.FMTID_DocSummaryInformation) > print ps.ReadMultiple((storagecon.PIDDSI_CATEGORY,))[0] > > Roger > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Sat Jul 15 02:59:32 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 15 Jul 2006 10:59:32 +1000 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails In-Reply-To: <20060714171021.B846F7BD25@imagine-optic.com> Message-ID: <3cf701c6a7a9$ef759550$100a0a0a@enfoldsystems.local> I'm afraid I can't help much. It looks like the API function is failing with PDH_CSTATUS_NO_OBJECT. A quick google for this shows a win2k related knowledge-base article, but nothing specific to Windows XP - but hopefully knowing the exact error code being returned by PDH is useful. Cheers, Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Charles BROSSOLLET Sent: Saturday, 15 July 2006 3:16 AM To: python-win32 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails Hello, I cannot manage to use the ShowAllProcesses() function, it returns the following error : >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2. Thanks in advance for your support! Charles Brossollet -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4120 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060715/06bce2aa/attachment.bin From comhari at hotmail.com Sat Jul 15 03:31:01 2006 From: comhari at hotmail.com (hari haran) Date: Sat, 15 Jul 2006 07:01:01 +0530 Subject: [python-win32] ConnectNamedPipe Defect??? Message-ID: Hi Mark, I noticed one thing while using ConnectNamedPipe() function. I am checking the return type something like this CreateNamedPipe..... While... hr = ConnectName.... if(hr !=0 and hr!=win32pipe.ERROR_PIPE_CONNECTED): raise MyOwnException DoSomeStuff Ideally it should return 535 for ERROR_PIPE_CONNECTED. But sometimes it returns 234 which is ERROR_MORE_DATA. When I read like 1024 byte of data from the Pipe I dont have any problem, since my data is always lesser than 200 Bytes. If I read only 10 bytes (BTW I am using pipe in Message Mode) First time it is working fine But when the client connects next time it returns me 234. The documentation says it will return the underlying HRESULT. I guess it is returning GetLastError() API result. I tested with Setting my own error codes and then ConnectnamedPipe returns Those:) Is it a defect??? or how can i get around my problem. Probably use SetlastError before Calling ConnectNamedPipe. --Hari _________________________________________________________________ One and only Ash. Find out all about her. Only on MSN Search http://server1.msn.co.in/profile/aishwarya.asp From comhari at hotmail.com Sat Jul 15 03:36:41 2006 From: comhari at hotmail.com (hari haran) Date: Sat, 15 Jul 2006 07:06:41 +0530 Subject: [python-win32] ConnectNamedPipe Message-ID: Hi, In my previous message i sid setlasterror fn. Actually I wrote my own which dows nothing but Create a temp file and forcibily make some errors. --hari _________________________________________________________________ One and only Ash. Find out all about her. Only on MSN Search http://server1.msn.co.in/profile/aishwarya.asp From mc at mclaveau.com Sat Jul 15 08:15:05 2006 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 15 Jul 2006 08:15:05 +0200 Subject: [python-win32] NTFS/MS Word file metadata - no PIDSI forCategory? References: Message-ID: <000401c6a7d6$05f4b140$0701a8c0@PORTABLES> Hi! Thank, Williams, for your little script on metada. (to share) your code is fun. @-salutations -- Michel Claveau From cbrossollet at imagine-optic.com Sat Jul 15 11:31:06 2006 From: cbrossollet at imagine-optic.com (Charles BROSSOLLET) Date: Sat, 15 Jul 2006 11:31:06 +0200 Subject: [python-win32] =?iso-8859-1?q?RE=A0=3A__win32pdhutil=2EShowAllPro?= =?iso-8859-1?q?cesses=28=29_fails?= References: <001101c6a7aa$1ecf0340$015b1eac@imagine.local> Message-ID: <20060715092810.67B2B7BD25@imagine-optic.com> when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? Cheers Charles ________________________________ De: Mark Hammond [mailto:mhammond at skippinet.com.au] Date: sam. 15/07/2006 03:00 ?: Charles BROSSOLLET; 'python-win32' Objet : RE: [python-win32] win32pdhutil.ShowAllProcesses() fails I'm afraid I can't help much. It looks like the API function is failing with PDH_CSTATUS_NO_OBJECT. A quick google for this shows a win2k related knowledge-base article, but nothing specific to Windows XP - but hopefully knowing the exact error code being returned by PDH is useful. Cheers, Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Charles BROSSOLLET Sent: Saturday, 15 July 2006 3:16 AM To: python-win32 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails Hello, I cannot manage to use the ShowAllProcesses() function, it returns the following error : >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2. Thanks in advance for your support! Charles Brossollet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060715/8b3172c0/attachment.htm From mc at mclaveau.com Sat Jul 15 12:34:57 2006 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 15 Jul 2006 12:34:57 +0200 Subject: [python-win32] =?iso-8859-1?q?RE=A0=3A__win32pdhutil=2EShowAllPro?= =?iso-8859-1?q?cesses=28=29_fails?= References: <001101c6a7aa$1ecf0340$015b1eac@imagine.local> <20060715092810.67B2B7BD25@imagine-optic.com> Message-ID: <001601c6a7fa$538efc20$0701a8c0@PORTABLES> Hi! After the Charles's message, I try, on my XP-SP2 "FRENCH". Same error : Traceback (most recent call last): File "D:\dev\python\ess.py", line 3, in ? win32pdhutil.ShowAllProcesses() File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) pywintypes.error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I try with ANSI, CP1252, UTF-8 (no link, just for test) Perhaps this help you (sorry, I can't do very more) @-salutations -- Michel Claveau -------------------------------------------------------------------------------- when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? Cheers Charles -------------------------------------------------------------------------------- De: Mark Hammond [mailto:mhammond at skippinet.com.au] Date: sam. 15/07/2006 03:00 ?: Charles BROSSOLLET; 'python-win32' Objet : RE: [python-win32] win32pdhutil.ShowAllProcesses() fails I'm afraid I can't help much. It looks like the API function is failing with PDH_CSTATUS_NO_OBJECT. A quick google for this shows a win2k related knowledge-base article, but nothing specific to Windows XP - but hopefully knowing the exact error code being returned by PDH is useful. Cheers, Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Charles BROSSOLLET Sent: Saturday, 15 July 2006 3:16 AM To: python-win32 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails Hello, I cannot manage to use the ShowAllProcesses() function, it returns the following error : >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2. Thanks in advance for your support! Charles Brossollet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060715/b55d348a/attachment.html From cbrossollet at imagine-optic.com Sat Jul 15 14:31:02 2006 From: cbrossollet at imagine-optic.com (Charles BROSSOLLET) Date: Sat, 15 Jul 2006 14:31:02 +0200 Subject: [python-win32] =?iso-8859-1?q?RE=A0=3A__win32pdhutil=2EShowAllPro?= =?iso-8859-1?q?cesses=28=29_fails?= References: <001101c6a7aa$1ecf0340$015b1eac@imagine.local> <000301c6a7f3$79df0bb0$015b1eac@imagine.local> Message-ID: <20060715122527.93A917BD25@imagine-optic.com> I think I found the problem : the object name that is passed to EnumObjectItems must be localized in the system language!! damned Windows... I used win32process functions to get the work done, I post it so in case it can help somebody... import win32process, win32api, winnt, os def GetProcessNames(): id_list = win32process.EnumProcesses() result = [] for id in id_list: try: try: proc_handle =win32api.OpenProcess( winnt.PROCESS_QUERY_INFORMATION | winnt.PROCESS_VM_READ, False, id) module_handle = win32process.EnumProcessModules(proc_handle)[0] process_path = win32process.GetModuleFileNameEx(proc_handle, module_handle) result.append(os.path.basename(process_path)) finally: win32api.CloseHandle(proc_handle) except: pass return result ________________________________ De: python-win32-bounces at python.org de la part de Charles BROSSOLLET Date: sam. 15/07/2006 11:45 ?: Mark Hammond; python-win32 Objet : [python-win32] RE : win32pdhutil.ShowAllProcesses() fails when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? Cheers Charles ________________________________ De: Mark Hammond [mailto:mhammond at skippinet.com.au] Date: sam. 15/07/2006 03:00 ?: Charles BROSSOLLET; 'python-win32' Objet : RE: [python-win32] win32pdhutil.ShowAllProcesses() fails I'm afraid I can't help much. It looks like the API function is failing with PDH_CSTATUS_NO_OBJECT. A quick google for this shows a win2k related knowledge-base article, but nothing specific to Windows XP - but hopefully knowing the exact error code being returned by PDH is useful. Cheers, Mark -----Original Message----- From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Charles BROSSOLLET Sent: Saturday, 15 July 2006 3:16 AM To: python-win32 Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails Hello, I cannot manage to use the ShowAllProcesses() function, it returns the following error : >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2. Thanks in advance for your support! Charles Brossollet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060715/2753ee9d/attachment.htm From p.f.moore at gmail.com Sat Jul 15 16:21:55 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Sat, 15 Jul 2006 15:21:55 +0100 Subject: [python-win32] Any chance of a new build for 2.5? Message-ID: <79990c6b0607150721l24a480feg12e1f0bd11cc1850@mail.gmail.com> Is there going to be a new release of pywin32 for Python 2.5 soon? The reason I ask is that 2.5 final is getting close, and the existing binary was built before the API number changes, so it generates a load of warnings with the current beta. It's not a big deal, but it would be nice... Thanks, Paul From mc at mclaveau.com Sat Jul 15 16:42:55 2006 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 15 Jul 2006 16:42:55 +0200 Subject: [python-win32] Any chance of a new build for 2.5? References: <79990c6b0607150721l24a480feg12e1f0bd11cc1850@mail.gmail.com> Message-ID: <000c01c6a81c$f6ec4db0$0701a8c0@PORTABLES> Hi! Until some months : http://sourceforge.net/project/showfiles.php?group_id=78018 @-salutations -- Michel Claveau From p.f.moore at gmail.com Sat Jul 15 17:35:09 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Sat, 15 Jul 2006 16:35:09 +0100 Subject: [python-win32] Any chance of a new build for 2.5? In-Reply-To: <000c01c6a81c$f6ec4db0$0701a8c0@PORTABLES> References: <79990c6b0607150721l24a480feg12e1f0bd11cc1850@mail.gmail.com> <000c01c6a81c$f6ec4db0$0701a8c0@PORTABLES> Message-ID: <79990c6b0607150835y3d92d907m844bd63378ce4741@mail.gmail.com> On 7/15/06, Michel Claveau wrote: > Hi! > > Until some months : > http://sourceforge.net/project/showfiles.php?group_id=78018 Sorry, I wasn't clear. That version produces API version mismatch warnings with the latest Python 2.5 beta. A rebuild of pywin32 is needed to fix this, unfortunately. Paul. From mc at mclaveau.com Sat Jul 15 17:44:17 2006 From: mc at mclaveau.com (Michel Claveau) Date: Sat, 15 Jul 2006 17:44:17 +0200 Subject: [python-win32] Any chance of a new build for 2.5? References: <79990c6b0607150721l24a480feg12e1f0bd11cc1850@mail.gmail.com> <000c01c6a81c$f6ec4db0$0701a8c0@PORTABLES> <79990c6b0607150835y3d92d907m844bd63378ce4741@mail.gmail.com> Message-ID: <00af01c6a825$8bdb76f0$0701a8c0@PORTABLES> Hi, Paul! >>> Sorry, I wasn't clear. That version produces API version mismatch >>> warnings with the latest Python 2.5 beta. A rebuild of pywin32 is needed >>> to fix this, unfortunately. Afflicted. It's me which has reacts inopportunely. Your message/intervention was justified. @+ Michel Claveau From rwupole at msn.com Sat Jul 15 18:58:46 2006 From: rwupole at msn.com (Roger Upole) Date: Sat, 15 Jul 2006 12:58:46 -0400 Subject: [python-win32] RE : win32pdhutil.ShowAllProcesses() fails Message-ID: Charles BROSSOLLET wrote: > when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? > Cheers > Charles According to this: http://support.microsoft.com/kb/q287159/ the solution for non-English Windows is to find the index for the english term in the registry, and then use PdhLookupPerfNameByIndex (win32pdh.LookupPerfNameByIndex) to translate the index to the localized name. Roger From rwupole at msn.com Sat Jul 15 20:46:51 2006 From: rwupole at msn.com (Roger Upole) Date: Sat, 15 Jul 2006 14:46:51 -0400 Subject: [python-win32] RE : win32pdhutil.ShowAllProcesses() fails Message-ID: > Charles BROSSOLLET wrote: > >> when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? >> Cheers >> Charles > Actually, I just noticed that win32pdhutil already has a function to retrieve the localized counter name. If you change the first line of ShowAllProcesses to object = find_pdh_counter_localized_name('Process') does it work ? Roger From cbrossollet at imagine-optic.com Sat Jul 15 23:22:46 2006 From: cbrossollet at imagine-optic.com (Charles BROSSOLLET) Date: Sat, 15 Jul 2006 23:22:46 +0200 Subject: [python-win32] =?iso-8859-1?q?RE=A0=3A____RE_=3A_win32pdhutil=2ES?= =?iso-8859-1?q?howAllProcesses=28=29_fails?= References: <000001c6a840$efc5f8a0$015b1eac@imagine.local> Message-ID: <20060715212129.B363F7BD25@imagine-optic.com> Yes, it works! Thank you very much! (actually "Process ID" also had to changed) Maybe the function should be updated in next releases? Cheers, Charles. ________________________________ De: python-win32-bounces at python.org de la part de Roger Upole Date: sam. 15/07/2006 21:00 ?: python-win32 at python.org Objet : [python-win32] RE : win32pdhutil.ShowAllProcesses() fails > Charles BROSSOLLET wrote: > >> when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? >> Cheers >> Charles > Actually, I just noticed that win32pdhutil already has a function to retrieve the localized counter name. If you change the first line of ShowAllProcesses to object = find_pdh_counter_localized_name('Process') does it work ? Roger _______________________________________________ Python-win32 mailing list Python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060715/c1302612/attachment.html From mhammond at skippinet.com.au Sun Jul 16 11:39:40 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 16 Jul 2006 19:39:40 +1000 Subject: [python-win32] =?iso-8859-1?q?RE=A0=3A____RE_=3A_win32pdhutil=2ES?= =?iso-8859-1?q?howAllProcesses=28=29_fails?= In-Reply-To: <20060715212129.B363F7BD25@imagine-optic.com> Message-ID: <401e01c6a8bb$c33d8f20$100a0a0a@enfoldsystems.local> > Yes, it works! Thank you very much! (actually "Process ID" also had to changed) > Maybe the function should be updated in next releases? Hi Charles, I've changed that module to localize the 'constant' names in that file. Thanks, Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 1660 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20060716/50213a57/attachment.bin From mhammond at skippinet.com.au Sun Jul 16 13:08:15 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 16 Jul 2006 21:08:15 +1000 Subject: [python-win32] ConnectNamedPipe Defect??? In-Reply-To: Message-ID: <404201c6a8c8$2a1dcf00$100a0a0a@enfoldsystems.local> > I am checking the return type something like this > > > CreateNamedPipe..... > > While... > hr = ConnectName.... > > if(hr !=0 and hr!=win32pipe.ERROR_PIPE_CONNECTED): > raise MyOwnException > > DoSomeStuff > > Ideally it should return 535 for ERROR_PIPE_CONNECTED. But > sometimes it > returns 234 which is ERROR_MORE_DATA. I see the problem here. In summary, ConnectNamedPipe() would always return the result of GetLastError() - even if the function worked. As the docs implied, ERROR_IO_PENDING and ERROR_PIPE_CONNECTED get special treatment - so in effect, the rules have been: * If rc == ERROR_IO_PENDING or ERROR_PIPE_CONNECTED, then rc was accurate. * If the function failed for any other reason, an exception was thrown. * Otherwise, rc should be ignored (currently, it is GetLastError()) I've fixed that to always return zero if the function succeeds. If the function fails, the semantics are otherwise the same (actually, for the record, slightly different - previously, if the function failed but GetLastError() returned 0, we would still return 0. Now we will raise an exception - ie, we trust the BOOL result more than we trust GetLastError()) > Is it a defect??? or how can i get around my problem. Probably use > SetlastError before Calling ConnectNamedPipe. It will be fixed in 209 - but otherwise, see above - just completely ignore the rc unless it is one of those 2 values. Cheers, Mark From mhammond at skippinet.com.au Sun Jul 16 13:58:22 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun, 16 Jul 2006 21:58:22 +1000 Subject: [python-win32] pywin32 build 209 Message-ID: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> Hi all, I've just released pywin32 build 209. Due to my error while uploading the files, builds for Python 2.2 and 2.3 will be delayed for about 48 hours - but Python 2.4, 2.5 and source releases are available now. Particular thanks goes to Roger Upole who contributed the majority of the work in this release, including a new 'terminal services' module, and many other enhancements - the full change notes are at: https://sourceforge.net/project/shownotes.php?release_id=432365 Get it now via https://sourceforge.net/project/showfiles.php?group_id=78018 As an aside: I'll be at OSCON in just over a week - let me know if anyone would like a beer! Cheers, Mark From mc at mclaveau.com Sun Jul 16 14:50:47 2006 From: mc at mclaveau.com (Michel Claveau) Date: Sun, 16 Jul 2006 14:50:47 +0200 Subject: [python-win32] pywin32 build 209 References: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> Message-ID: <000b01c6a8d6$770aebf0$0701a8c0@PORTABLES> Mark & Roger : thank you very very much!!! -- Michel Claveau From p.f.moore at gmail.com Sun Jul 16 16:21:53 2006 From: p.f.moore at gmail.com (Paul Moore) Date: Sun, 16 Jul 2006 15:21:53 +0100 Subject: [python-win32] pywin32 build 209 In-Reply-To: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> References: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> Message-ID: <79990c6b0607160721m3179e5ffv7b526fc5b2687486@mail.gmail.com> On 7/16/06, Michel Claveau wrote: > Mark & Roger : thank you very very much!!! Agreed! On 7/16/06, Mark Hammond wrote: > As an aside: I'll be at OSCON in just over a week - let me know if anyone > would like a beer! If I was there, I'd buy you one. Thanks for all your work. Paul. From rakesur at gmail.com Mon Jul 17 07:27:31 2006 From: rakesur at gmail.com (rakesh surana) Date: Mon, 17 Jul 2006 10:57:31 +0530 Subject: [python-win32] get new mails from thunderbird Message-ID: Hello !!! I am trying to get new mails form thunderbird. which stores the mail in mbox format. Is any way to identify new mails from it. thanx rakesh -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060717/1d723490/attachment.html From mark.m.mcmahon at gmail.com Mon Jul 17 10:58:21 2006 From: mark.m.mcmahon at gmail.com (Mark Mc Mahon) Date: Mon, 17 Jul 2006 04:58:21 -0400 Subject: [python-win32] get new mails from thunderbird In-Reply-To: References: Message-ID: <71b6302c0607170158t217c161axa56133cd3c726568@mail.gmail.com> Hi, Maybe the following would help...? http://aspn.activestate.com/ASPN/Mail/Message/python-list/2673166 Mark On 7/17/06, rakesh surana wrote: > > Hello !!! > > I am trying to get new mails form thunderbird. > which stores the mail in mbox format. > > Is any way to identify new mails from it. > > thanx > > rakesh > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > From shahmed at sfwmd.gov Mon Jul 17 20:23:27 2006 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Mon, 17 Jul 2006 14:23:27 -0400 Subject: [python-win32] unzip a file Message-ID: <14A2A120D369B6469BB154B2D2DC34D20536E833@EXCHVS01.ad.sfwmd.gov> HI all, I am new python and looking scripts for unzip files form a local folder. Any help is highly appreciated. Thanks in advance. Shakir From Jim.Vickroy at noaa.gov Mon Jul 17 20:44:56 2006 From: Jim.Vickroy at noaa.gov (Jim.Vickroy at noaa.gov) Date: Mon, 17 Jul 2006 12:44:56 -0600 Subject: [python-win32] unzip a file Message-ID: ----- Original Message ----- From: "Ahmed, Shakir" Date: Monday, July 17, 2006 12:23 pm Subject: Re: [python-win32] unzip a file > HI all, > > I am new python and looking scripts for unzip files form a local > folder.Any help is highly appreciated. > > Thanks in advance. > > Shakir > > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > Hello Shakir, Does the "zipfile" module (standard with recent Python distributions) provide the capabilities you seek? -- jv From davidf at sjsoft.com Tue Jul 18 12:31:08 2006 From: davidf at sjsoft.com (David Fraser) Date: Tue, 18 Jul 2006 12:31:08 +0200 Subject: [python-win32] pywin32 build 209 In-Reply-To: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> References: <405101c6a8cf$2405e2e0$100a0a0a@enfoldsystems.local> Message-ID: <44BCB86C.4080503@sjsoft.com> Mark Hammond wrote: > Hi all, > I've just released pywin32 build 209. Due to my error while uploading the > files, builds for Python 2.2 and 2.3 will be delayed for about 48 hours - > but Python 2.4, 2.5 and source releases are available now. Fantastic! BTW If you're waiting for the files to disappear from the sourceforge upload area, simply adding them to the release system (even if they're wrong) and then deleting them will clear them so you can upload a clean version Cheers David From mhammond at skippinet.com.au Wed Jul 19 01:18:58 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 19 Jul 2006 09:18:58 +1000 Subject: [python-win32] pywin32 build 209 In-Reply-To: <44BCB86C.4080503@sjsoft.com> Message-ID: <48af01c6aac0$8c7098f0$100a0a0a@enfoldsystems.local> > Mark Hammond wrote: > > Hi all, > > I've just released pywin32 build 209. Due to my error > while uploading the > > files, builds for Python 2.2 and 2.3 will be delayed for > about 48 hours - > > but Python 2.4, 2.5 and source releases are available now. > Fantastic! BTW If you're waiting for the files to disappear from the > sourceforge upload area, simply adding them to the release > system (even > if they're wrong) and then deleting them will clear them so you can > upload a clean version I did hope that would work - but the SF docs are quite clear, so I didn't want to take the chance: >From http://sourceforge.net/docman/display_doc.php?docid=6445&group_id=1: How do I remove a file from the incoming directory on upload.sourceforge.net? ... If you cannot wait, you have the second option of attaching the bad upload to your file release, then deleting the file from the file release; it is important that you not do this on files you intend to overwrite (i.e. that you intend to replace with a file of the same file name). But either way - I have now updated Python 2.2 and 2.3 versions of build 209! Cheers, Mark From guy.lateur at telenet.be Wed Jul 19 19:08:56 2006 From: guy.lateur at telenet.be (guy lateur) Date: Wed, 19 Jul 2006 19:08:56 +0200 Subject: [python-win32] How to have Excel use a Python callback function Message-ID: <000801c6ab56$05300c90$1f11e0d5@thuisbak> Hi all, I'm trying to extend the RMB popup menu in Excel to let the user easily select the project she's working on. The construction of the (hierarchical) menu is written in a Python COM server. This server is used by some VBA code in the paricular workbook (a 'timesheet'), in the Workbook_Open() function. The problem is that i can't seem to set the (event-) callback function, ie what happens when a user selects a given menu item. Below is the code I'd hoped would work but doesn't: excel = Dispatch("Excel.application") cbr = excel.CommandBars("Cell") # make a sub-menu smp = cbr.Controls.Add(Type = constants.msoControlPopup) smp.Caption = "[BB] Projecten" smp.Tag = "[BB] Projecten" # make a menu item smpo = CastTo(smp, "CommandBarPopup") nc = smpo.Controls.Add(Type = constants.msoControlButton) nc.Caption = "Butt" # callback nc.OnAction = onProject # <-- PROBLEM onProject() can be a global function, an instancemethod or a staticmethod, it always says this: . I did some research and came up with the following strategy: a. Write a callback class, deriving from some COM interface b. Convert (an object of) this class to the appropriate 'COM VARIANT' My questions are: 1. Is this the way to do this? If not, what is? 2. If so, what is the interface to inherit from? Functions to override (eg Invoke())? 3. Do I use pythoncom.WrapObject() for b.? If so, what should be my gatewayIID & interfaceIID? Thank you very much for your time, g PS: In VBA you have to give it the name of a macro, eg nc.OnAction = Macro1. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060719/78d6c3f4/attachment.htm From rodrigo at 1bit.com.br Wed Jul 19 19:33:47 2006 From: rodrigo at 1bit.com.br (Rodrigo Strauss) Date: Wed, 19 Jul 2006 14:33:47 -0300 Subject: [python-win32] Events in the same object Message-ID: I need to receive events from a COM object, but using the same object that's using it (!?), because I need to maintain some state about the events. Actually, after calling the Connect method from COM obj, it will fire the onConnected event after the connection is done. I can call Login method only after I receive the OnConnect. I need something like this: class ApiTester: # events def OnConnect(self): self.connection.Logon(uid, pwd) def OnLogon(self): print 'ready to go' def __init__(self): # self as event sink. Beside circular references, any other problem? self.connection = DispatchWithEvents("BlaBlaApi.Connection", self) The above code just give a "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 264, in DispatchWithEvents result_class = new.classobj("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) TypeError: instance() takes at most 2 arguments (3 given) Looking at win32com code, it says it's ok to create a circular reference between sink and object, as long as I break this calling close() sometime. Any idea? Rodrigo Strauss From Matthias.Wolf at al-lighting.com Thu Jul 20 09:43:52 2006 From: Matthias.Wolf at al-lighting.com (Wolf, Matthias ALRT/ELD) Date: Thu, 20 Jul 2006 09:43:52 +0200 Subject: [python-win32] makepy.py excel-libs Message-ID: <7ED3CA664474C84891E0DD86162C70F20120B498@dereu1nexc3.al-lighting.com> Hello I've made a 'Microsoft Excel 11.0 Object Library' from the 'EXCEL.EXE'-File and can now create excel-diagrams with python. But if want to use some special variables e.g. 'MajorGridlines': ####### VBA-Marco-Example ActiveChart.Axes(xlValue).MajorGridlines.Select With Selection.Border .ColorIndex = 57 .Weight = xlHairline .LineStyle = xlDot End With End Sub ####### ####### Python-Example c = excel.ActiveChart c.Axes(excelcom.constants.xlValue).MajorGridlines.Weight = excelcom.constants.xlHairline ####### I get the following error: AttributeError: '' object has no attribute 'Weight' Why can I not manipulate this 'MajorGridlines'? Is there anything missing in my Library. If yes, which library i have to use? Thanks in advanced! Kind regards, Wolf -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060720/cd24e40f/attachment.html From guy.lateur at telenet.be Thu Jul 20 10:03:12 2006 From: guy.lateur at telenet.be (guy lateur) Date: Thu, 20 Jul 2006 10:03:12 +0200 Subject: [python-win32] makepy.py excel-libs In-Reply-To: <7ED3CA664474C84891E0DD86162C70F20120B498@dereu1nexc3.al-lighting.com> Message-ID: <000b01c6abd2$f26699d0$9a11e0d5@thuisbak> Looking at your VBA code, it seems like Weight is a property of Border, not of MajorGridlines. You may want to try MajorGridlines.Border.Weight = ... best regards, g _____ From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Wolf, Matthias ALRT/ELD Sent: donderdag 20 juli 2006 9:44 To: python-win32 at python.org Subject: [python-win32] makepy.py excel-libs Hello I've made a 'Microsoft Excel 11.0 Object Library' from the 'EXCEL.EXE'-File and can now create excel-diagrams with python. But if want to use some special variables e.g. 'MajorGridlines': ####### VBA-Marco-Example ActiveChart.Axes(xlValue).MajorGridlines.Select With Selection.Border .ColorIndex = 57 .Weight = xlHairline .LineStyle = xlDot End With End Sub ####### ####### Python-Example c = excel.ActiveChart c.Axes(excelcom.constants.xlValue).MajorGridlines.Weight = excelcom.constants.xlHairline ####### I get the following error: AttributeError: '' object has no attribute 'Weight' Why can I not manipulate this 'MajorGridlines'? Is there anything missing in my Library. If yes, which library i have to use? Thanks in advanced! Kind regards, Wolf -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20060720/72f334aa/attachment.html From robin at reportlab.com Thu Jul 20 17:20:41 2006 From: robin at reportlab.com (Robin Becker) Date: Thu, 20 Jul 2006 16:20:41 +0100 Subject: [python-win32] starnge error at startup Message-ID: <44BF9F49.7050603@chamonix.reportlab.co.uk> I get the following error when starting pythonwin on a particular script. I would like to be able to debug the script, but pythonwin won't seem to open it. Has anyone any idea what could cause this? I assume it must be something to do with the way the script is laid out or some obscure syntax I'm using. File "C:\Python\Lib\site-packages\pythonwin\pywin\framework\intpyapp.py", line 171, in InitInstance import interact File "C:\Python\Lib\site-packages\pythonwin\pywin\framework\interact.py", line 21, in ? import pywin.scintilla.IDLEenvironment File "C:\Python\Lib\site-packages\pythonwin\pywin\scintilla\IDLEenvironment.py", line 54, in ? GetIDLEModule("AutoIndent").IndentSearcher.readline = fast_readline File "C:\Python\Lib\site-packages\pythonwin\pywin\scintilla\IDLEenvironment.py", line 24, in GetIDLEModule __import__(modname) File "C:\Python\Lib\site-packages\pythonwin\pywin\idle\AutoIndent.py", line 503, in ? import tokenize File "C:\Python\lib\tokenize.py", line 38, in ? COMMENT = N_TOKENS exceptions.NameError: name 'N_TOKENS' is not defined -- Robin Becker From gagsl-p32 at yahoo.com.ar Thu Jul 20 22:20:42 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Thu, 20 Jul 2006 17:20:42 -0300 Subject: [python-win32] starnge error at startup In-Reply-To: <44BF9F49.7050603@chamonix.reportlab.co.uk> References: <44BF9F49.7050603@chamonix.reportlab.co.uk> Message-ID: <7.0.1.0.0.20060720171220.03987ff8@yahoo.com.ar> At Thursday 20/7/2006 12:20, Robin Becker wrote: >I get the following error when starting pythonwin on a particular script. I >would like to be able to debug the script, but pythonwin won't seem >to open it. > import tokenize > File "C:\Python\lib\tokenize.py", line 38, in ? > COMMENT = N_TOKENS >exceptions.NameError: name 'N_TOKENS' is not defined Looking at tokenize.py, it imports all from token.py Look at your token.py. There is a notice at the top of the file, it should have been built automatically, but perhaps something failed. Gabriel Genellina Softlab SRL __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas From comhari at hotmail.com Sat Jul 22 08:16:42 2006 From: comhari at hotmail.com (hari haran) Date: Sat, 22 Jul 2006 11:46:42 +0530 Subject: [python-win32] How to return dict from Python COM Message-ID: Hi, I am trying to write a Simple COM using Python. I am trying to use it in VB. 1. If I return a dict from Python VB throws a COM exception saying that dict cannot be converted tio COM VARIANT. 2. This is just a testing. What I am trying to see is to develope UI in VB and try to use Python as my engine. Is there any proven ways to do it. (Other than using Python UIs like Tkinter, WxPython etc) Thanks --Hari _________________________________________________________________ Fall in Love... Get married! Join FREE! http://www.shaadi.com/ptnr.php?ptnr=msnhottag From rodrigo at 1bit.com.br Sat Jul 22 15:31:27 2006 From: rodrigo at 1bit.com.br (Rodrigo Strauss) Date: Sat, 22 Jul 2006 10:31:27 -0300 Subject: [python-win32] How to return dict from Python COM In-Reply-To: References: Message-ID: The Python dict object is not a compatible COM object, you need to use a COM compatible dictionary. You can develop one or use the Scripting.Dictionary: http://windowssdk.msdn.microsoft.com/en-us/library/x4k5wbx4.aspx Rodrigo Strauss On 7/22/06, hari haran wrote: > Hi, > > I am trying to write a Simple COM using Python. I am trying to use it in VB. > 1. > If I return a dict from Python VB throws a COM exception saying that dict > cannot be converted tio COM VARIANT. > 2. > This is just a testing. What I am trying to see is to develope UI in VB and > try to use Python as my engine. Is there any proven ways to do it. (Other > than using Python UIs like Tkinter, WxPython etc) > > > Thanks > --Hari > > _________________________________________________________________ > Fall in Love... Get married! Join FREE! > http://www.shaadi.com/ptnr.php?ptnr=msnhottag > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From comhari at hotmail.com Sun Jul 23 23:45:30 2006 From: comhari at hotmail.com (hari haran) Date: Mon, 24 Jul 2006 03:15:30 +0530 Subject: [python-win32] How to return dict from Python COM Message-ID: Hi, How can I create a COM compatible dictionary. So The python code has to be modified to return a Com compatible dict. Is that right Should I use Scripting.Dictionary in Python code. Ay pointers on Creating a COM compatible dictionary will be of help. Thanks -Hari The Python dict object is not a compatible COM object, you need to use a COM compatible dictionary. You can develop one or use the Scripting.Dictionary: http://windowssdk.msdn.microsoft.com/en-us/library/x4k5wbx4.aspx Rodrigo Strauss On 7/22/06, hari haran wrote: >Hi, > >I am trying to write a Simple COM using Python. I am trying to use it in >VB. >1. >If I return a dict from Python VB throws a COM exception saying that dict >cannot be converted tio COM VARIANT. >2. >This is just a testing. What I am trying to see is to develope UI in VB and >try to use Python as my engine. Is there any proven ways to do it. (Other >than using Python UIs like Tkinter, WxPython etc) > > >Thanks >--Hari > >_________________________________________________________________ >Fall in Love... Get married! Join FREE! >http://www.shaadi.com/ptnr.php?ptnr=msnhottag > >_______________________________________________ >Python-win32 mailing list >Python-win32 at python.org >http://mail.python.org/mailman/listinfo/python-win32 _________________________________________________________________ Best IT jobs on naukri.com http://www.naukri.com/tieups/tieups.php?othersrcp=3246 From aniapte at gmail.com Mon Jul 24 08:19:47 2006 From: aniapte at gmail.com (Aniruddha Apte) Date: Mon, 24 Jul 2006 11:49:47 +0530 Subject: [python-win32] IPC between Python and a win32 process Message-ID: <3a5569ad0607232319q663d57a8u91e7b9aeee363f97@mail.gmail.com> Hi Folks, I have a win32 application written in C that does some background processing (process1). Users can have some limited interaction with the C application via a python Gui running in a separate process (process2). What is the easiest way for the C application and the python Gui to communicate? I would like to be able to pass messages and data between these two processes. Thanks in advance for you help. regards, -anir From timr at probo.com Mon Jul 24 18:25:57 2006 From: timr at probo.com (Tim Roberts) Date: Mon, 24 Jul 2006 09:25:57 -0700 Subject: [python-win32] How to return dict from Python COM In-Reply-To: References: Message-ID: <44C4F495.1060203@probo.com> On Mon, 24 Jul 2006 03:15:30 +0530, "hari haran" wrote: >Hi, >How can I create a COM compatible dictionary. > > There is no such thing. Visual Basic and VC++, for example, have no native "dictionary" type. >So The python code has to be modified to return a Com compatible dict. Is >that right >Should I use Scripting.Dictionary in Python code. > >Ay pointers on Creating a COM compatible dictionary will be of help. > > What are you actually trying to do? If you just want your VB code to be able to do lookups by string, why not just implement Get and Set methods in your Python code and hide the underlying implementation? Let Python keep the dictionary in its most natural and efficient form. It won't be any less efficient; if you return an object which implements a dictionary, the VB code will still have to make COM calls to query it. It IS possible (I believe) to create a Scripting.Dictionary object and return it to VB, but I'm not convinced it is a better solution. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From dprovins at tridentexploration.ca Mon Jul 24 20:49:34 2006 From: dprovins at tridentexploration.ca (Dean Allen Provins) Date: Mon, 24 Jul 2006 12:49:34 -0600 Subject: [python-win32] build on Linus, install on Windows: site packages not registered Message-ID: <44C5163E.1030900@tridentexploration.ca> Hello; I built a code on Linux and moved it to Windows successfully a month or so ago. The user asked for a change, and after re-arranging the code and making the alterations, tried to re-send it. It gets there, but the 2 site packages aren't registered. The command used to build the Windows installer was (with python 2.4.1): python win_batch_setup.py bdist_wininst The file win_batch_setup.py contains: #!/usr/bin/python # Execute as 'python this_file.py bdist_wininst' to create a # Windows install file ('thisfile-1.4.win32.exe') # from distutils.core import setup setup ( name = 'batch', \ version = '1.14', \ description= 'Converts LAS files from MD to TVD in batch',\ long_description= 'snipped...',\ author = 'Dean Allen Provins, P. Geoph.',\ author_email = 'dprovins at tridentexploration.ca',\ url = 'none',\ license = 'open',\ py_modules = [\ 'BATCH/batch', \ 'ROOT/BATCH_MD_TVD', \ 'ROOT/MD_TVD', \ 'ROOT/LAS', \ 'ROOT/spline', \ 'ROOT/func'], \ platforms = 'Linux, MS Windows',\ data_files = [('.', \ ['BATCH/pywintypes24.dll', \ 'BATCH/batch.py', 'BATCH/batch_readme.txt', 'BATCH/100082406303W600_ACCUCARD_tab.OUT',\ 'BATCH/100082406303W600_ACCUMAP.CSV',\ 'BATCH/petra_well_MD_unwrap.las'])]\ ) This resulted in the following - and note the WARNING at the end. I believe it is a symptom of the problem: dean at debian:~/python/LAS$ python win_batch_setup.py bdist_wininst # re-create bu ild and dist running bdist_wininst running build running build_py creating build creating build/lib creating build/lib/BATCH copying BATCH/batch.py -> build/lib/BATCH creating build/lib/ROOT copying ROOT/BATCH_MD_TVD.py -> build/lib/ROOT copying ROOT/MD_TVD.py -> build/lib/ROOT copying ROOT/LAS.py -> build/lib/ROOT copying ROOT/spline.py -> build/lib/ROOT copying ROOT/func.py -> build/lib/ROOT installing to build/bdist.linux-i686/wininst running install_lib creating build/bdist.linux-i686 creating build/bdist.linux-i686/wininst creating build/bdist.linux-i686/wininst/PURELIB creating build/bdist.linux-i686/wininst/PURELIB/BATCH copying build/lib/BATCH/batch.py -> build/bdist.linux-i686/wininst/PURELIB/BATCH creating build/bdist.linux-i686/wininst/PURELIB/ROOT copying build/lib/ROOT/BATCH_MD_TVD.py -> build/bdist.linux-i686/wininst/PURELIB/ROOT copying build/lib/ROOT/MD_TVD.py -> build/bdist.linux-i686/wininst/PURELIB/ROOT copying build/lib/ROOT/LAS.py -> build/bdist.linux-i686/wininst/PURELIB/ROOT copying build/lib/ROOT/spline.py -> build/bdist.linux-i686/wininst/PURELIB/ROOT copying build/lib/ROOT/func.py -> build/bdist.linux-i686/wininst/PURELIB/ROOT running install_data creating build/bdist.linux-i686/wininst/DATA copying BATCH/pywintypes24.dll -> build/bdist.linux-i686/wininst/DATA/. copying BATCH/batch.py -> build/bdist.linux-i686/wininst/DATA/. copying BATCH/batch_readme.txt -> build/bdist.linux-i686/wininst/DATA/. copying BATCH/100082406303W600_ACCUCARD_tab.OUT -> build/bdist.linux-i686/wininst/DATA/. copying BATCH/100082406303W600_ACCUMAP.CSV -> build/bdist.linux-i686/wininst/DATA/. copying BATCH/petra_well_MD_unwrap.las -> build/bdist.linux-i686/wininst/DATA/. creating '/tmp/tmp5iHDWK.zip' and adding '.' to it adding 'PURELIB/BATCH/batch.py' adding 'PURELIB/ROOT/BATCH_MD_TVD.py' adding 'PURELIB/ROOT/MD_TVD.py' adding 'PURELIB/ROOT/LAS.py' adding 'PURELIB/ROOT/spline.py' adding 'PURELIB/ROOT/func.py' adding 'DATA/pywintypes24.dll' adding 'DATA/batch.py' adding 'DATA/batch_readme.txt' adding 'DATA/100082406303W600_ACCUCARD_tab.OUT' adding 'DATA/100082406303W600_ACCUMAP.CSV' adding 'DATA/petra_well_MD_unwrap.las' Warning: Can't read registry to find the necessary compiler setting Make sure that Python modules _winreg, win32api or win32con are installed. removing 'build/bdist.linux-i686/wininst' (and everything under it) The code is installed in .../site-packages/BATCH and .../site-packages/ROOT. The modules therein aren't visible to python unless I force the sys.path variable in the mainline. It seems odd that a Linux setup.py run should ask for a windows registery module... Any ideas on what I'm missing? Dean -- Dean Provins, P. Geoph. dprovins at tridentexploration.ca dprovins at alumni.ucalgary.ca KeyID at at pgpkeys.mit.edu:11371: 0x9643AE65 Fingerprint: 9B79 75FB 5C2B 22D0 6C8C 5A87 D579 9BE5 9643 AE65 Confidentiality Notice: The information transmitted herein may contain confidential, proprietary and/or privileged material which belongs to Trident Exploration Corp. and its affiliates and is intended only for the addressee(s). Any unauthorized review, distribution or other use or the taking of any action in reliance upon this information is prohibited. If you received this email in error, please contact the sender or call (403) 770-1765 and delete this email and any copies. From schaffer at optonline.net Mon Jul 24 21:18:20 2006 From: schaffer at optonline.net (Les Schaffer) Date: Mon, 24 Jul 2006 15:18:20 -0400 Subject: [python-win32] setting access to Windows services Message-ID: <44C51CFC.2050107@optonline.net> I am having a hard time setting up non-Administrator access to MySQL service START|STOP capabilities. been reading MSDN and python-win32 and ActiveState docs for a couple days, and am stuck. can anyone see a problem here? with the SetNamedSecurityInfo call, i get a Error 1069: The service did not start due to a logon failure. i know i am getting somehwere, before i changed from SetServiceObjectSecurity to SetNamedSecurityInfo i was getting "access denied" for non-Admins. but i am not quite there yet. many thanks les schaffer ============= import win32api from win32service import * import win32security, pywintypes from win32security import * import win32con hnd = OpenSCManager(None, None, SC_MANAGER_ALL_ACCESS) svcH = OpenService(hnd, "MySQL", SC_MANAGER_ALL_ACCESS) sd = QueryServiceObjectSecurity(svcH, DACL_SECURITY_INFORMATION) grp = sd.GetSecurityDescriptorGroup() dacl = sd.GetSecurityDescriptorDacl() bcs_sid = win32security.LookupAccountName('','BCS')[0] start_stop = SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS dacl.AddAccessAllowedAce(dacl.GetAclRevision(),start_stop,bcs_sid) sd.SetSecurityDescriptorDacl(1,dacl,0) sd.SetSecurityDescriptorGroup(bcs_sid,0) result = SetServiceObjectSecurity(svcH, DACL_SECURITY_INFORMATION, sd) if not result: print 'SetServiceObjectSecurity returned error: ', win32api.GetLastError() # GetLastError prints Error code 122 result = SetNamedSecurityInfo("MySQL", SE_SERVICE, DACL_SECURITY_INFORMATION, None, bcs_sid, dacl, None) if not result: print 'SetNamedSecurityInfo returned error: ', win32api.GetLastError() # GetLastError prints 0 --- ERROR_SUCCESS even though result is None??? From schaffer at optonline.net Mon Jul 24 21:56:37 2006 From: schaffer at optonline.net (Les Schaffer) Date: Mon, 24 Jul 2006 15:56:37 -0400 Subject: [python-win32] setting access to Windows services Message-ID: <44C525F5.60906@optonline.net> well, actually it did work, once i uninstalled the service, and re-installed it without the attempt to set the acccount name in the CreateService call, made elsewhere. maybe someone will find my code helpful for getting Services running under non-Admin rights. les schaffer From rodrigo at 1bit.com.br Mon Jul 24 22:03:26 2006 From: rodrigo at 1bit.com.br (Rodrigo Strauss) Date: Mon, 24 Jul 2006 17:03:26 -0300 Subject: [python-win32] How to return dict from Python COM In-Reply-To: References: Message-ID: To use a Scripting.Dictionary, here goes an example code: >>> from win32com.client import Dispatch >>> d = Dispatch('Scripting.Dictionary') >>> d.Add('key1', 'Value1') >>> d.Add('key2', 2) >>> d.Add(3, 'Value3') Just return the object 'd' from your python COM object. Rodrigo Strauss On 7/23/06, hari haran wrote: > Hi, > How can I create a COM compatible dictionary. > So The python code has to be modified to return a Com compatible dict. Is > that right > Should I use Scripting.Dictionary in Python code. > > Ay pointers on Creating a COM compatible dictionary will be of help. > Thanks > -Hari > > > > The Python dict object is not a compatible COM object, you need to use > a COM compatible dictionary. You can develop one or use the > Scripting.Dictionary: > > http://windowssdk.msdn.microsoft.com/en-us/library/x4k5wbx4.aspx > > Rodrigo Strauss > > On 7/22/06, hari haran wrote: > >Hi, > > > >I am trying to write a Simple COM using Python. I am trying to use it in > >VB. > >1. > >If I return a dict from Python VB throws a COM exception saying that dict > >cannot be converted tio COM VARIANT. > >2. > >This is just a testing. What I am trying to see is to develope UI in VB and > >try to use Python as my engine. Is there any proven ways to do it. (Other > >than using Python UIs like Tkinter, WxPython etc) > > > > > >Thanks > >--Hari > > > >_________________________________________________________________ > >Fall in Love... Get married! Join FREE! > >http://www.shaadi.com/ptnr.php?ptnr=msnhottag > > > >_______________________________________________ > >Python-win32 mailing list > >Python-win32 at python.org > >http://mail.python.org/mailman/listinfo/python-win32 > > _________________________________________________________________ > Best IT jobs on naukri.com > http://www.naukri.com/tieups/tieups.php?othersrcp=3246 > > _______________________________________________ > Python-win32 mailing list > Python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From rwupole at msn.com Mon Jul 24 22:36:10 2006 From: rwupole at msn.com (Roger Upole) Date: Mon, 24 Jul 2006 16:36:10 -0400 Subject: [python-win32] Re: setting access to Windows services Message-ID: Les Schaffer" wrote: >I am having a hard time setting up non-Administrator access to MySQL > service START|STOP capabilities. been reading MSDN and python-win32 and > ActiveState docs for a couple days, and am stuck. can anyone see a > problem here? > > with the SetNamedSecurityInfo call, i get a Error 1069: The service did > not start due to a logon failure. > > i know i am getting somehwere, before i changed from > SetServiceObjectSecurity to SetNamedSecurityInfo i was getting "access > denied" for non-Admins. but i am not quite there yet. > > many thanks > > les schaffer > > > > ============= > > import win32api > from win32service import * > import win32security, pywintypes > from win32security import * > import win32con > > hnd = OpenSCManager(None, None, SC_MANAGER_ALL_ACCESS) > svcH = OpenService(hnd, "MySQL", SC_MANAGER_ALL_ACCESS) The access here should be SERVICE_ALL_ACCESS instead of SC_MANAGER_ALL_ACCESS. Usually it's a good idea to just specify the types of access required for the current operation, though. READ_CONTROL|WRITE_DAC should be sufficient for getting and setting the permissions. > sd = QueryServiceObjectSecurity(svcH, DACL_SECURITY_INFORMATION) > > grp = sd.GetSecurityDescriptorGroup() > dacl = sd.GetSecurityDescriptorDacl() > bcs_sid = win32security.LookupAccountName('','BCS')[0] > > start_stop = SERVICE_START | SERVICE_STOP | SERVICE_QUERY_STATUS > dacl.AddAccessAllowedAce(dacl.GetAclRevision(),start_stop,bcs_sid) > sd.SetSecurityDescriptorDacl(1,dacl,0) > sd.SetSecurityDescriptorGroup(bcs_sid,0) > > result = SetServiceObjectSecurity(svcH, DACL_SECURITY_INFORMATION, sd) > > if not result: > print 'SetServiceObjectSecurity returned error: ', > win32api.GetLastError() > # GetLastError prints Error code 122 > > result = SetNamedSecurityInfo("MySQL", SE_SERVICE, > DACL_SECURITY_INFORMATION, None, bcs_sid, dacl, None) > > if not result: > print 'SetNamedSecurityInfo returned error: ', win32api.GetLastError() > # GetLastError prints 0 --- ERROR_SUCCESS even though result is None??? Both SetNamedSecurityInfo and SetServiceObjectSecurity return None on success, and throw an exception if they fail. Checking "not result" will cause it to print an error anytime they succeed. You can wrap them in a try/except if you need to trap errors. Here's a thought: It should be possible to use the win32com.authorization module to create a custom permissions editor for services. Roger From mhammond at skippinet.com.au Tue Jul 25 01:49:06 2006 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 25 Jul 2006 09:49:06 +1000 Subject: [python-win32] IPC between Python and a win32 process In-Reply-To: <3a5569ad0607232319q663d57a8u91e7b9aeee363f97@mail.gmail.com> Message-ID: > I have a win32 application written in C that does some background > processing (process1). Users can have some limited interaction with > the C application via a python Gui running in a separate process > (process2). What is the easiest way for the C application and the > python Gui to communicate? > > I would like to be able to pass messages and data between these > two processes. I assume you are looking for the *easiest* way to do it from the POV of your C code (otherwise you can use any technique you like, all the way to xmlrpc) I would suggest you look at either win32 "named pipes" (and the win32pipe module for the Python process) or simple sockets. Cheers, Mark From shahmed at sfwmd.gov Wed Jul 26 21:33:15 2006 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Wed, 26 Jul 2006 15:33:15 -0400 Subject: [python-win32] [Errno 2] No such file or directory: Message-ID: <14A2A120D369B6469BB154B2D2DC34D205432C56@EXCHVS01.ad.sfwmd.gov> HI All, I am trying to change the file permission for all of the files in a directory but getting errno 2, the code is as follows, any help is highly appreciated. I am using pythonwin version 2.1 permission.py for fl in os.listdir("V:\\data\\tst\\mdb"): import os def unicode_test(fl): try: f = file(fl, 'w') f.close() except IOError, e: print e return try: os.chmod(fl, -0777) except OSError, e: print e ==== The error I am getting : >>> [Errno 2] No such file or directory: 'gend_taskstatus.mdb' [Errno 2] No such file or directory: 'str.mdb' Regards, Shakir From primmer at google.com Thu Jul 27 00:44:31 2006 From: primmer at google.com (David Primmer) Date: Wed, 26 Jul 2006 15:44:31 -0700 Subject: [python-win32] testing ADSI GUID buffer objects Message-ID: <44C7F04F.5030006@google.com> I am trying to write a unit test for a function that accepts a buffer object. As far as I can tell, buffer's cannot be directly represented in code. How do I create the object for the test? (The buffer object comes through ADSI in an Active Directory query of the user GUID property). If I print the GUID property, it prints a Unicode encoded string of the byte stream: u'8108fd1ac12c0d42924355c8d9987f19'. I don't believe this is the 'native' representation. The function I'm trying to test translates it to MS's hex format: '{38303138-6466-6131-6331-326330643432}' Any danger using this unicode format? -- David Primmer Google WinOps Mail primmer at google.com 650-253-3956 From gagsl-p32 at yahoo.com.ar Thu Jul 27 04:08:32 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Wed, 26 Jul 2006 23:08:32 -0300 Subject: [python-win32] [Errno 2] No such file or directory: In-Reply-To: <14A2A120D369B6469BB154B2D2DC34D205432C56@EXCHVS01.ad.sfwmd .gov> References: <14A2A120D369B6469BB154B2D2DC34D205432C56@EXCHVS01.ad.sfwmd.gov> Message-ID: <7.0.1.0.0.20060726225805.03bd4d70@yahoo.com.ar> At Wednesday 26/7/2006 16:33, Ahmed, Shakir wrote: >I am trying to change the file permission for all of the files in a >directory but getting errno 2, the code is as follows, any help is >highly appreciated. I am using pythonwin version 2.1 > > > >permission.py > >for fl in os.listdir("V:\\data\\tst\\mdb"): > > > import os > > > def unicode_test(fl): > try: > f = file(fl, 'w') > f.close() > except IOError, e: > print e > return > try: > os.chmod(fl, -0777) > except OSError, e: > print e > > >==== >The error I am getting : > > >>> [Errno 2] No such file or directory: 'gend_taskstatus.mdb' >[Errno 2] No such file or directory: 'str.mdb' os.listdir() returns the names *without* path. Use os.path.join to join path+name. -0777 looks like Unix permission bits (negative?), but a path with \\ is strange... The enclosed function unicode_test is useless. And, the import statement usually is located at the top of the module. Gabriel Genellina Softlab SRL __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas From gagsl-p32 at yahoo.com.ar Thu Jul 27 04:25:37 2006 From: gagsl-p32 at yahoo.com.ar (Gabriel Genellina) Date: Wed, 26 Jul 2006 23:25:37 -0300 Subject: [python-win32] testing ADSI GUID buffer objects In-Reply-To: <44C7F04F.5030006@google.com> References: <44C7F04F.5030006@google.com> Message-ID: <7.0.1.0.0.20060726231330.03bc7118@yahoo.com.ar> At Wednesday 26/7/2006 19:44, David Primmer wrote: >I am trying to write a unit test for a function that accepts a buffer > object. As far as I can tell, buffer's cannot be directly represented >in code. How do I create the object for the test? (The buffer object comes >through ADSI in an Active Directory query of the user GUID property). >If I print the GUID property, it prints a Unicode encoded string of the >byte stream: u'8108fd1ac12c0d42924355c8d9987f19'. I don't believe this >is the 'native' representation. The function I'm trying to test >translates it to MS's hex format: '{38303138-6466-6131-6331-326330643432}' > >Any danger using this unicode format? I think you are mixing many things. You *can* create a buffer object, using the built-in function buffer(): >>> x=buffer('hello') >>> print x[0] h >>> print x[4] o >>> print x[5] Traceback (most recent call last): File "", line 1, in ? IndexError: buffer index out of range A GUID is always 16 bytes length. Your Unicode string is 32 bytes length; apparently it is the hex representation (two hex chars per byte). If you feed the function with that string, it interprets the first 16 bytes only, *each* hex number as a byte: 38h='8', 30h='0', 31h='1'...64h='d' 34h='4' 32h='2' Can you post an example showing the expected interfase? Gabriel Genellina Softlab SRL __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas From rwupole at msn.com Thu Jul 27 05:28:18 2006 From: rwupole at msn.com (Roger Upole) Date: Wed, 26 Jul 2006 23:28:18 -0400 Subject: [python-win32] Re: testing ADSI GUID buffer objects Message-ID: David Primmer wrote: >I am trying to write a unit test for a function that accepts a buffer > object. As far as I can tell, buffer's cannot be directly represented > in code. How do I create the object for the test? (The buffer object comes > through ADSI in an Active Directory query of the user GUID property). > If I print the GUID property, it prints a Unicode encoded string of the > byte stream: u'8108fd1ac12c0d42924355c8d9987f19'. I don't believe this > is the 'native' representation. The function I'm trying to test > translates it to MS's hex format: '{38303138-6466-6131-6331-326330643432}' > A guid buffer returned from an ADSI query can be translated into a PyIID object using pywintypes.IID(bufferobject, True). The second parameter to IID() indicates that the input shoud be treated as raw bytes. Roger From sourceforge at metrak.com Fri Jul 28 12:15:18 2006 From: sourceforge at metrak.com (paul sorenson) Date: Fri, 28 Jul 2006 20:15:18 +1000 Subject: [python-win32] COM IPicture, accessing image data from python Message-ID: <44C9E3B6.1070009@metrak.com> I am trying to communicate with a COM interface which, among other things, provides an IPicture. I can read the IPicture attribute without too much trouble but it is not clear to me how one goes about accessing the image data in python. If anyone has any tips that would be most helpful. cheers From rwupole at msn.com Fri Jul 28 22:46:19 2006 From: rwupole at msn.com (Roger Upole) Date: Fri, 28 Jul 2006 16:46:19 -0400 Subject: [python-win32] Re: COM IPicture, accessing image data from python Message-ID: paul sorenson wrote: >I am trying to communicate with a COM interface which, among other > things, provides an IPicture. > > I can read the IPicture attribute without too much trouble but it is not > clear to me how one goes about accessing the image data in python. If > anyone has any tips that would be most helpful. > According to MSDN, the IPicture interface exposes the bitmap handle, so you should be able to use win32ui.CreateBitmapFromHandle, and then PyBitmap.GetBitmapBits to get the raw data. Roger From mark.m.mcmahon at gmail.com Mon Jul 31 13:47:38 2006 From: mark.m.mcmahon at gmail.com (Mark Mc Mahon) Date: Mon, 31 Jul 2006 07:47:38 -0400 Subject: [python-win32] ANN: pywinauto 3.6 released Message-ID: <71b6302c0607310447uc67cfcavab77fac1a43dc52c@mail.gmail.com> Hi, 0.3.6 release of pywinauto is now available. pywinauto is an open-source (LGPL) package for using Python as a GUI automation 'driver' for Windows NT based Operating Systems (NT/W2K/XP). SourceForge project page: http://sourceforge.net/projects/pywinauto Download from SourceForge http://sourceforge.net/project/showfiles.php?group_id=157379 Here is the list of changes from 0.3.5: 0.3.6 Scrolling and Treview Item Clicking added ------------------------------------------------------------------ 28-July-2006 * Added parameter to ``_treeview_item.Rectangle()`` to have an option to get the Text rectangle of the item. And defaulted to this. * Added ``_treeview_item.Click()`` method to make it easy to click on tree view items. * Fixed a bug in ``TreeView.GetItem()`` that was expanding items when it shouldn't. * Added ``HwndWrapper.Scroll()`` method to allow scrolling. This is a very minimal implementation - and if the scrollbars are implemented as separate controls (rather then a property of a control - this will probably not work for you!). It works for Notepad and Paint - that is all I have tried so far. * Added a call to ``HwndWrapper.SetFocus()`` in ``_perform_click_input()`` so that calls to ``HwndWrapper.ClickInput()`` will make sure to click on the correct window. Thanks Mark -------------------------------------------- Mark Mc Mahon Manchester, NH 03110, USA

pywinauto 0.3.6 Simple Windows GUI automation with Python. (28-Jul-06) From shahmed at sfwmd.gov Mon Jul 31 20:42:09 2006 From: shahmed at sfwmd.gov (Ahmed, Shakir) Date: Mon, 31 Jul 2006 14:42:09 -0400 Subject: [python-win32] Python help for Access database Message-ID: <14A2A120D369B6469BB154B2D2DC34D205508C17@EXCHVS01.ad.sfwmd.gov> HI All, I need help for inserting recods into the access database using python script through ODBC. I can insert data without any problem if I hard coded the run_Date field. But I need run_Date field should be mytime. I really appreciate if anyone can help me. Thanks in advance Shakir The script is as follows: #mdbupdate.py import sys import os import os.path import win32com.client import time import sys, string, import odbc mytime = time.strftime('%m/%d/%Y') mytimeYMD = time.strftime('%Y%m%d') conn = odbc.odbc("test1_Data") cursor = conn.cursor() # data type in mdb is as follows: application -> Text, Run_Date -> # Date, Run_dateYMD -> number, status -> Script cursor.execute("INSERT INTO local_cmgenadm (Application,Run_Date,Run_DateYMD,status) values (\'rimDev2PrdMdbDistrictPermit\',\'%s\', \'20060731\' , \'Good\')")%mytime cursor.close() conn.close() From fumanchu at amor.org Mon Jul 31 21:08:18 2006 From: fumanchu at amor.org (Robert Brewer) Date: Mon, 31 Jul 2006 12:08:18 -0700 Subject: [python-win32] Python help for Access database Message-ID: <435DF58A933BA74397B42CDEB8145A8603DBFA01@ex9.hostedexchange.local> Shakir wrote: > I need help for inserting recods into the access database using python > script through ODBC. I can insert data without any problem if I hard > coded the run_Date field. But I need run_Date field should be > mytime. I really appreciate if anyone can help me. > > The script is as follows: > ... > mytime = time.strftime('%m/%d/%Y') > mytimeYMD = time.strftime('%Y%m%d') > conn = odbc.odbc("test1_Data") > cursor = conn.cursor() > > # data type in mdb is as follows: application -> Text, Run_Date -> > # Date, Run_dateYMD -> number, status -> Script > > cursor.execute("INSERT INTO local_cmgenadm > (Application,Run_Date,Run_DateYMD,status) values > (\'rimDev2PrdMdbDistrictPermit\',\'%s\', \'20060731\' , > \'Good\')")%mytime MS Access Dates are best input using the #date# syntax. Here's an example to convert a datetime.datetime object to that format: return ('#%s/%s/%s %02d:%02d:%02d#' % (value.month, value.day, value.year, value.hour, value.minute, value.second)) Should be easy enough to adapt to time.time. Robert Brewer System Architect Amor Ministries fumanchu at amor.org