From mhammond at skippinet.com.au Mon Nov 3 01:22:36 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 3 Nov 2008 11:22:36 +1100 Subject: [python-win32] ByRef params not working with PythonCOM In-Reply-To: <4907546F.3010700@ata-e.com> References: <48E2C006.5030301@ata-e.com> <48EA467F.7070500@ata-e.com> <015901c928ea$440f9520$cc2ebf60$@com.au> <48ECE505.3030502@ata-e.com> <48FF5E90.8070701@ata-e.com> <4907546F.3010700@ata-e.com> Message-ID: <066801c93d4a$486a4c90$d93ee5b0$@com.au> > But, in Imodel, the 'feSelector' attribute is defined as follows: > "feSelector": (10349, 2, (9, 0), (), "feSelector", None) > That 'None' at the end is the "resultCLSID" entry, and apparently > that's how 'feSelector' is supposed to be connected to 'ISelector'. > I edited PyFemap.py and manually replaced that 'None' with the > CLSID from the ISelector definition shown above: > "feSelector": (10349, 2, (9, 0), (), "feSelector", '{8A3498F7-A383-419E-8117-86A0305175FF}') > Problem solved!? The code starts using the ISelector class, and I can get my output argument! > Swell.? Imodel has 315 (three hundred and fifteen) such entries, and there are hundreds more > on dozens of other objects, so manual editing to correct all of them is not feasible. Eek. So there are 315 map entries you need to adjust? Note that in the general case, you can probably do: >>> mod = win32com.client.gencache.EnsureModule(...) # see 'makepy -i' for details... >>> selector = some_object.feSelector # now a 'generic' object. >>> selector = mod.ISelector(selector) # convert to a real ISelector object But this doesn't really scale either. > Question:? can something be done to makepy to fix this, or this an > inherent and hopeless flaw in the TLB? There's not much win32com can do by itself if the typelib doesn't indicate the type of the param and *also* doesn't provide its CLSID at runtime. Obviously, you are dealing with a normal python module and normal python classes, so you could programatically update the dictionaries - but you are still faced with the problem of knowing what to update the dictionaries with! Cheers, Mark From ysystudio at sohu.com Mon Nov 3 08:52:49 2008 From: ysystudio at sohu.com (ysystudio) Date: Mon, 3 Nov 2008 15:52:49 +0800 Subject: [python-win32] how to call the dll in python Message-ID: <200811031552463435608@sohu.com> I have a windows dll1.dll with a export function: int f1(char filename,char **buf,int *bufLen) { int len; //got the length of file anyway,such as 100 len = 100;//len = getLen(filename); *buf = (char*)calloc(100); *bufLen = len; return 0; } then how can I call the f1 function with python. thanks for your response. 2008-11-03 ysystudio -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.antal at ata-e.com Mon Nov 3 19:12:27 2008 From: greg.antal at ata-e.com (Greg Antal) Date: Mon, 03 Nov 2008 10:12:27 -0800 Subject: [python-win32] ByRef params not working with PythonCOM In-Reply-To: <066801c93d4a$486a4c90$d93ee5b0$@com.au> References: <48E2C006.5030301@ata-e.com> <48EA467F.7070500@ata-e.com> <015901c928ea$440f9520$cc2ebf60$@com.au> <48ECE505.3030502@ata-e.com> <48FF5E90.8070701@ata-e.com> <4907546F.3010700@ata-e.com> <066801c93d4a$486a4c90$d93ee5b0$@com.au> Message-ID: <490F3F0B.1040208@ata-e.com> An HTML attachment was scrubbed... URL: From timr at probo.com Mon Nov 3 20:13:41 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 03 Nov 2008 11:13:41 -0800 Subject: [python-win32] how to call the dll in python In-Reply-To: <200811031552463435608@sohu.com> References: <200811031552463435608@sohu.com> Message-ID: <490F4D65.8030601@probo.com> ysystudio wrote: > I have a windows dll1.dll with a export function: > > int f1(char filename,char **buf,int *bufLen) > { > int len; > //got the length of file anyway,such as 100 > len = 100;//len = getLen(filename); > *buf = (char*)calloc(100); > *bufLen = len; > return 0; > } > > then how can I call the f1 function with python. I assume this is just an example, because this is not a good way to design a DLL. It is never a good idea to allocate memory in one DLL and pass it to another, because they might be using different C runtime libraries. If you need to fill in a string, you should allocate the buffer in the calling program, then hand in the buffer and the length to let the DLL fill it in. In general, you use the ctypes module to call into foreign DLLs. The details depend strongly on the parameters. If you could be a little more specific about what you need, we could provide better advice. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From lubomir.kamensky at gmail.com Thu Nov 6 15:36:32 2008 From: lubomir.kamensky at gmail.com (=?ISO-8859-1?Q?Lubom=EDr_Kamensk=FD?=) Date: Thu, 6 Nov 2008 15:36:32 +0100 Subject: [python-win32] classic ASP pages using Python interpreter on IIS 7 Message-ID: <1cf372c00811060636x6767bec7v4202eee011cde91@mail.gmail.com> Is anybody here experienced with running classic ASP pages using Python interpreter on IIS 7? Lubas -------------- next part -------------- An HTML attachment was scrubbed... URL: From ckkart at hoc.net Fri Nov 7 20:02:45 2008 From: ckkart at hoc.net (Christian K.) Date: Fri, 07 Nov 2008 20:02:45 +0100 Subject: [python-win32] how to call the dll in python In-Reply-To: <200811031552463435608@sohu.com> References: <200811031552463435608@sohu.com> Message-ID: ysystudio wrote: > I have a windows dll1.dll with a export function: > > int f1(char filename,char **buf,int *bufLen) > { > int len; > //got the length of file anyway,such as 100 > len = 100;//len = getLen(filename); > *buf = (char*)calloc(100); > *bufLen = len; > return 0; > } > > then how can I call the f1 function with python. > thanks for your response. Have a look at ctypes (which is included in python since 2.5): http://python.net/crew/theller/ctypes/ Christian From mc at mclaveau.com Mon Nov 10 13:27:25 2008 From: mc at mclaveau.com (Michel Claveau) Date: Mon, 10 Nov 2008 13:27:25 +0100 Subject: [python-win32] Problem of value returned by COM, from IE, with prototype.js Message-ID: (Problem of value returned by COM, from IE, with prototype.js) Hi! I have this file (C:\titi.htm): I call it, with (Python version): import win32com.client ie=win32com.client.Dispatch('InternetExplorer.Application') ie.Navigate('file:///C:/titi.htm') ie.Visible=True win=ie.Document.parentWindow print win.montableau[1] #==> show 222 Or, with this JScript (launch like: CSCRIPT toto.js): var ie = new ActiveXObject("InternetExplorer.Application"); ie.Navigate('file:///C:/titi.htm'); ie.Visible=1; var win=ie.Document.parentWindow; WScript.StdOut.Write(win.montableau[1]); //==> show 222 it's OK. BUT... If I add prototype.js, the firt file ((C:\titi.htm) become: And with the SAME scripts, I obtain: with JScript: 222 with Python: "function(item, i) { i || (i = 0); var length = this.length; if (i < 0) i = length + i; for (; i < length; i++) if (this[i] === item) return i; return -1; }" OK, prototype.js add methods to Array. But, why the difference between Jscript & Python? And how get the good value/object from Python; after prototype.js? Thanks by advance. And, sorry for my primitive/simplist/bad english. -- Michel Claveau From Brad.Johnson at ballardtech.com Mon Nov 10 20:31:48 2008 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Mon, 10 Nov 2008 19:31:48 +0000 (UTC) Subject: [python-win32] =?utf-8?q?WIN32COM=3A_Cannot_get_event_interface_g?= =?utf-8?q?iven_a=09wrapped_dispatch_pointer?= References: <033301c93562$00f3bad0$02db3070$@com.au> Message-ID: Brad Johnson ballardtech.com> writes: Just as a follow-up, this didn't even end up being a complete solution. With my particular combination of type libraries in my application, I can't rely on the gencache to hold the correct mapping in the mapCLSIDToClass dict for reasons stated earlier. I need to go find out which type library the coclass truly lives in and use the structure in that particular genpy generated file to get to the correct class. Even this solution is limited to dispatch interfaces that only point to a single coclass in a given type library. Fortunately this is the case for us but certainly isn't universal. It is my opinion that the architecture is flawed, and that one cannot assume a particular coclass given a dispatch pointer no matter what type information is emitted. Unless that object implements IProvideClassInfo or IPersist, we cannot infer which coclass we are dealing with from a simple dispatch pointer. From greg.ewing at canterbury.ac.nz Tue Nov 11 03:47:59 2008 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 11 Nov 2008 15:47:59 +1300 Subject: [python-win32] Python COM: Automatic wrap/unwrap? Message-ID: <4918F25F.2080504@canterbury.ac.nz> I'm creating a COM server in Python that will have one main class, with methods that create and return instances of other classes. I've found that I need to use win32com.server.util.wrap and unwrap on these objects when they pass over a COM connection. This doesn't seem very convenient, especially for methods that can be called either via COM or internally from other Python code. It seems that the basic Python types are wrapped and unwrapped automatically when needed. Is there some way of extending this mechanism? Is there a class I can inherit from, or a magic attribute I can set, or some registration process I can use, to get instances of my class automatically wrapped and unwrapped? -- Greg From mhammond at skippinet.com.au Tue Nov 11 07:24:27 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 11 Nov 2008 17:24:27 +1100 Subject: [python-win32] ODBC dates and buffers Message-ID: <004401c943c6$2c4a4420$84decc60$@com.au> The 'odbc' module has always had its own 'date' object - an object with a 'value' attribute holding a integer which is supposed to be compatible with the time module. It predates the datetime module by many years. As part of the py3k work Roger has been doing, he dropped the custom types from the (dbi) module, so datetime and buffer objects are used directly - we have decided it is reasonable that when people are porting to py3k they examine their use of the custom date objects and convert them to use datetime objects. This is also the approach we will probably take with the pywintypes PyTime object in py3k (ie, drop it completely), but that is a digression for now - this message is just about the odbc and dbi modules. In py2k, the ideal thing would be for us to invent a "forwards compatibility" mechanism for this module - existing code can continue to work but a transition plan could be put in place, somewhat similarly to how pythoncom is doing the 'currency' changes. However, best I can tell, the date support in the odbc module is so broken as to render it unusable - eg, in Feb 2007, Robin Becker pointed out this fact on this mailing list and a suggested workaround was to use strings to manipulate the date fields! Further, my attempts to get the (old) odbc test suite passing with date objects is failing, which is further evidence to me of its broken-ness. Similar broken-ness exists when using blob/binary fields, which Roger addressed in py3k by switching them to native objects too. My question is: will breaking the support for these types actually inconvenience anyone? To put it another way, is anyone aware of real apps that successfully use the odbc module to work with dates in a database? If not, I won't bother trying to invent a transition plan and "just do it" (as Roger advocates - and indeed the trunk already has!) [My gut feeling is that we can break odbc dates without hurting anyone, but we will need a transition plan for the pywintypes PyTime object in py2k - but that is for another day...] Thanks, Mark From mhammond at skippinet.com.au Tue Nov 11 07:39:30 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 11 Nov 2008 17:39:30 +1100 Subject: [python-win32] Python COM: Automatic wrap/unwrap? In-Reply-To: <4918F25F.2080504@canterbury.ac.nz> References: <4918F25F.2080504@canterbury.ac.nz> Message-ID: <005201c943c8$43a0c660$cae25320$@com.au> > It seems that the basic Python types are wrapped and > unwrapped automatically when needed. Is there some way of > extending this mechanism? Is there a class I can inherit > from, or a magic attribute I can set, or some registration > process I can use, to get instances of my class automatically > wrapped and unwrapped? Unfortunately not - autowrap support has been 'on the list' for a long time now, but it never makes it to the top. The "right" place to do this would be in pythoncom itself in the function used to convert a PyObject to a COM pointer. What you could do is write a custom policy derived from win32com.server.policy.DesignatedWrapPolicy(). You could override _invokeex_, and examine the return value from each of the functions, and when you decide to, perform the wrapping at that stage. As long as each object you wrap also uses that same policy, then all objects will get the same behaviour - its just that "first" wrap you will need to explicitly do specifying your policy. This is a little messy if you return arrays etc, but might be doable in the simple case. Cheers, Mark From mhammond at skippinet.com.au Tue Nov 11 08:10:15 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 11 Nov 2008 18:10:15 +1100 Subject: [python-win32] WIN32COM: Cannot get event interface given a wrapped dispatch pointer In-Reply-To: References: <033301c93562$00f3bad0$02db3070$@com.au> Message-ID: <005c01c943cc$8f1ea770$ad5bf650$@com.au> > It is my opinion that the architecture is flawed, While you have obviously struck a bug, I need to understand it more before I can comment further. I'll try and reproduce it using the C++ test object and IDL file - if you could help do that it would be greatly appreciated and help a timely solution. >From your previous mail: > The interfaces are referenced in other typelibs, but not defined. > Unfortunately, in the gencache each one of these references creates > their own stub in its own file generated from its own typelib. This is the crux of the problem and shouldn't be happening. However, the gencache mechanism does allow for cross-module definitions - so there shouldn't be a problem if we ensure that each interface only appears exactly once in the gencache. > and that one cannot assume a particular coclass given a dispatch > pointer no matter what type information is emitted. Why do you say that? If the typeinfo references an IID or CLSID, why can't we trust it? In what scenario would it be incorrect? It seems to be working well so far, not withstanding the bug which you say causes duplicate entries for the same interface. Cheers, Mark From ricercar at infinito.it Tue Nov 11 09:43:01 2008 From: ricercar at infinito.it (ricercar at infinito.it) Date: Tue, 11 Nov 2008 09:43:01 +0100 Subject: [python-win32] COM server and pointer to pointer parameter Message-ID: <7f3124d4a15eba98e0e33c29c3111160@79.16.19.89> Hello, some weeks ago I posted a message, and opened a bug ticket, but got not reply. Probably few of us are working with servers or dealing with pointer to pointer parameters (or simply have no time). Anyway I try to post the request once again, maybe somebody missed the issue. (Unfortunately at the moment I'm not in the condition to debug the library so my last option is to write the server in C.). Sorry for those who already read this message. ================================ I have the same problem with pippo_server, the test file in the win32com package. I don't know if somebody can have more info from this. I used a client written with python and comtypes and, with a little effort I can see the call to QueryInterface with IID_NULL (as happens if the caller is a C++ client). The client is very simple (it needs comtypes): ------------------- import comtypes from comtypes.client import * from comtypes.GUID import GUID from ctypes import * tlb_id = GUID('{41059C57-975F-4B36-8FF3-C5117426647A}') GetModule((tlb_id, 1, 0)) import comtypes.gen.TESTSERVERLib as llib obj = CreateObject('Python.Test.Pippo', interface=llib.IPippo) p = obj.Method1() ------------------ To show the problem I registered the pippo_server with the --debug option. Then I changed the function Method1 in this way to have a debug output: def Method1(self): #return wrap(CPippo()) return wrap(CPippo(),useDispatcher=1) Last, in the file policy.py at line 261, at the begin of the _QueryInterface_ function I added a line: print iid The result in PythonWin trace Collector is: Object with win32trace dispatcher created (object=None) Object with win32trace dispatcher created (object=) {00000000-0000-0000-0000-000000000000}Traceback (most recent call last): File "C:Python25Libsite-packageswin32comserverdispatcher.py", line 41, in _QueryInterface_ return self.policy._QueryInterface_(iid) File "C:Python25libsite-packageswin32comserverpolicy.py", line 261, in _QueryInterface_ print iid com_error: (-2147221005, "Stringa dell'interfaccia non valida.", None, None) pythoncom error: Failed to call the universal dispatcher There is a QueryInterface with iid={00000000-0000-0000-0000-000000000000} and I don't know who's doing it. Thanks for any tip, Enrico From mhammond at skippinet.com.au Tue Nov 11 11:23:33 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 11 Nov 2008 21:23:33 +1100 Subject: [python-win32] COM server and pointer to pointer parameter In-Reply-To: <7f3124d4a15eba98e0e33c29c3111160@79.16.19.89> References: <7f3124d4a15eba98e0e33c29c3111160@79.16.19.89> Message-ID: <007101c943e7$8ffdc890$aff959b0$@com.au> > The result in PythonWin trace Collector is: > Object with win32trace dispatcher created (object=None) > Object with win32trace dispatcher created (object= instance at 0x015DF210>) > {00000000-0000-0000-0000-000000000000}Traceback (most recent call > last): > File "C:Python25Libsite-packageswin32comserverdispatcher.py", line 41, > in > _QueryInterface_ > return self.policy._QueryInterface_(iid) > File "C:Python25libsite-packageswin32comserverpolicy.py", line 261, in > _QueryInterface_ > print iid > com_error: (-2147221005, "Stringa dell'interfaccia non valida.", None, > None) > pythoncom error: Failed to call the universal dispatcher > > There is a QueryInterface with iid={00000000-0000-0000-0000- > 000000000000} > and I don't know who's doing it. I'm afraid that with the exact same process (although the 'print' says 'print "QI", iid' - using python 2.6 on vista) I see exactly: | Object with win32trace dispatcher created (object=None) | Object with win32trace dispatcher created (object=) | QI {F1A3CC2E-4B2A-4A81-992D-67862076949B} So I see no such QI. Also, I've lost the context - what problem is caused by this QI? We should return E_NOINTERFACE. Cheers, Mark From Brad.Johnson at ballardtech.com Tue Nov 11 17:50:03 2008 From: Brad.Johnson at ballardtech.com (Brad Johnson) Date: Tue, 11 Nov 2008 16:50:03 +0000 (UTC) Subject: [python-win32] =?utf-8?q?WIN32COM=3A_Cannot_get_event_interface_g?= =?utf-8?q?iven_a=09wrapped_dispatch_pointer?= References: <033301c93562$00f3bad0$02db3070$@com.au> <005c01c943cc$8f1ea770$ad5bf650$@com.au> Message-ID: Mark Hammond skippinet.com.au> writes: > > While you have obviously struck a bug, I need to understand it more before I > can comment further. I'll try and reproduce it using the C++ test object > and IDL file - if you could help do that it would be greatly appreciated and > help a timely solution. I'd be happy to provide you more info for your test case. Please email me directly if you have any questions for me. I'd spend more time isolating it myself except that I have a workaround that works for me and work doesn't permit me to do anything further unless on my own time. > This is the crux of the problem and shouldn't be happening. However, the > gencache mechanism does allow for cross-module definitions - so there > shouldn't be a problem if we ensure that each interface only appears exactly > once in the gencache. I understand the gencache should be a composite of all the loaded IIDs/CLSIDs. The problem appears to be a "last guy wins" where a new IID mapping will overwrite the old (possibly correct) IID mapping when a new wrapper module is created. > Why do you say that? If the typeinfo references an IID or CLSID, why can't > we trust it? In what scenario would it be incorrect? It seems to be > working well so far, not withstanding the bug which you say causes duplicate > entries for the same interface. Because the typeinfo does not emit any CLSID information as far as I can tell, but rather the IID of the dispatch interface. Exemplified by this line disp_clsid = ti.GetTypeAttr()[0] This is the crux: The CLSID is not returned, which truly would be a one-to-one mapping to a coclass, but rather the IID, which is one-to-many, though the map only supports a single entry. From vernondcole at gmail.com Wed Nov 12 03:20:28 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 11 Nov 2008 19:20:28 -0700 Subject: [python-win32] ODBC dates and buffers In-Reply-To: <004401c943c6$2c4a4420$84decc60$@com.au> References: <004401c943c6$2c4a4420$84decc60$@com.au> Message-ID: +1 for an immediate switch to using datetime objects in odbc. That will make adodbapi and odbc a little more compatible. (They will never be completely compatible since odbc was written to an earlier api spec.) Because of historical reasons, adodbapi defaults to mxDateTime, if present, and datetime if not. (It will also return old Python time objects if you ask it to.) . I am thinking that adodbapi should also default to datetime in some future revision (Perhaps Roger's py3k version?). The present default has bit me before. The two types don't support all of the same operations, so if you install eGenix base suddenly your time comparisons quit working. My guess is that most people who use mxDateTime also use mxODBC rather than either of our free api's, so a change in default would not bite as many people as the status quo. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Nov 12 03:20:28 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 11 Nov 2008 19:20:28 -0700 Subject: [python-win32] ODBC dates and buffers In-Reply-To: <004401c943c6$2c4a4420$84decc60$@com.au> References: <004401c943c6$2c4a4420$84decc60$@com.au> Message-ID: +1 for an immediate switch to using datetime objects in odbc. That will make adodbapi and odbc a little more compatible. (They will never be completely compatible since odbc was written to an earlier api spec.) Because of historical reasons, adodbapi defaults to mxDateTime, if present, and datetime if not. (It will also return old Python time objects if you ask it to.) . I am thinking that adodbapi should also default to datetime in some future revision (Perhaps Roger's py3k version?). The present default has bit me before. The two types don't support all of the same operations, so if you install eGenix base suddenly your time comparisons quit working. My guess is that most people who use mxDateTime also use mxODBC rather than either of our free api's, so a change in default would not bite as many people as the status quo. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From ricercar at infinito.it Wed Nov 12 12:20:44 2008 From: ricercar at infinito.it (ricercar at infinito.it) Date: Wed, 12 Nov 2008 12:20:44 +0100 Subject: [python-win32] COM server and pointer to pointer parameter Message-ID: <942da9855990361821acaccd61a2f88c@79.16.19.89> >I'm afraid that with the exact same process (although the 'print' says >'print "QI", iid' - using python 2.6 on vista) I see exactly: > >| Object with win32trace dispatcher created (object=None) >| Object with win32trace dispatcher created (object=instance at 0x02AD8210>) >| QI {F1A3CC2E-4B2A-4A81-992D-67862076949B} > >So I see no such QI. Also, I've lost the context - what problem is caused >by this QI? We should return E_NOINTERFACE. Thanks Mark for the test. I'm running the test on Windows XP and Windows 2k, both with python 2.5.2. The problem is that the QI with value to 0 is raised somewhere in the pythoncom code (or in the OS COM stuff), but I cannot find where. This cause the call to the function to fail with an exception. I guess that if you return E_NOINTERFACE the effect changes a little but not the concept. Why somebody is asking for an interface with iid to null? This happens with functions that want to return a **param as in the pippo server. On the weekend I could try on Vista but I suspect that there's something else since on your side it's working. thanks, Enrico From Thomas.Lohse at tracetronic.de Wed Nov 12 13:46:16 2008 From: Thomas.Lohse at tracetronic.de (Lohse, Thomas) Date: Wed, 12 Nov 2008 13:46:16 +0100 Subject: [python-win32] Calling ShellIconOverlayHandlers does not work Message-ID: Hello, could anyone provide some assistance in using ShellIconOverlay-Handlers with pythoncom. I implement a kind of file explorer and would like to call the ShellIconOverlay-Handlers (registered by TortoiseSVN) of the windows explorer to visualize SVN-states. (I'm NOT about to implement my own handler). I can successfully CoCreateInstance these handlers and receive an implementation of IShellIconOverlayIdentifier interface. GetOverlayInfo() and GetPriority() both work fine on the interface, but IsMemberOf(path, attributes) always returns None instead of S_OK, S_FALSE, E_FAIL or an exception. This is the case whether the passed path exists or not and is independent of the passed attributes. Why does IShellIconOverlayIdentifier::IsMemberOf() not work? Any advice or hint would be very appreciated. Yours sincerely, Thomas My approach to using ShellIconOverlay handlers: import sys import pythoncom import win32api, win32con from win32com.shell import shell from winerror import S_OK, S_FALSE, E_FAIL def CallIconOverlayHandler(): path = sys.argv[1] if len(sys.argv) > 1 else u"C:\\foo" # Query CLSID for 1st registered IconOverlayHandler # (there should be handler "Offline Files" at least, since included in Win) regKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayId entifiers") name = win32api.RegEnumKey(regKey, 0) clsId = win32api.RegQueryValue(regKey, name) win32api.RegCloseKey(regKey) print u"Using %s: %s" % (name, clsId) ovHdl = pythoncom.CoCreateInstance(clsId, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellIconOverlayIdentifier) #Works fine print u"GetOverlayInfo():", ovHdl.GetOverlayInfo() print u"GetPriority():", ovHdl.GetPriority() #Problem: IsMemberOf returns always None print u"IsMemberOf(\"%s\", 0):" % path, ovHdl.IsMemberOf(path, 0) print u"Done." if __name__ == "__main__": CallIconOverlayHandler() From rwupole at msn.com Wed Nov 12 14:50:59 2008 From: rwupole at msn.com (Roger Upole) Date: Wed, 12 Nov 2008 08:50:59 -0500 Subject: [python-win32] Re: Calling ShellIconOverlayHandlers does not work Message-ID: Thomas Lohse wrote: > Hello, > > could anyone provide some assistance in using ShellIconOverlay-Handlers > with pythoncom. I implement a kind of file explorer and would like to > call the ShellIconOverlay-Handlers (registered by TortoiseSVN) of the > windows explorer to visualize SVN-states. (I'm NOT about to implement my > own handler). > > I can successfully CoCreateInstance these handlers and receive an > implementation of IShellIconOverlayIdentifier interface. > GetOverlayInfo() and GetPriority() both work fine on the interface, but > IsMemberOf(path, attributes) always returns None instead of S_OK, > S_FALSE, E_FAIL or an exception. This is the case whether the passed > path exists or not and is independent of the passed attributes. > > Why does IShellIconOverlayIdentifier::IsMemberOf() not work? Any advice > or hint would be very appreciated. > > > Yours sincerely, > Thomas > > > My approach to using ShellIconOverlay handlers: > > import sys > import pythoncom > import win32api, win32con > > from win32com.shell import shell > from winerror import S_OK, S_FALSE, E_FAIL > > > def CallIconOverlayHandler(): > path = sys.argv[1] if len(sys.argv) > 1 else u"C:\\foo" > > # Query CLSID for 1st registered IconOverlayHandler > # (there should be handler "Offline Files" at least, since included > in Win) > regKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, > > ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayId > entifiers") > name = win32api.RegEnumKey(regKey, 0) > clsId = win32api.RegQueryValue(regKey, name) > win32api.RegCloseKey(regKey) > > print u"Using %s: %s" % (name, clsId) > ovHdl = pythoncom.CoCreateInstance(clsId, None, > pythoncom.CLSCTX_INPROC_SERVER, > shell.IID_IShellIconOverlayIdentifier) > > #Works fine > print u"GetOverlayInfo():", ovHdl.GetOverlayInfo() > print u"GetPriority():", ovHdl.GetPriority() > > #Problem: IsMemberOf returns always None > print u"IsMemberOf(\"%s\", 0):" % path, ovHdl.IsMemberOf(path, 0) > > print u"Done." > > if __name__ == "__main__": > CallIconOverlayHandler() Try upgrading to build 212. There was a bug in this method that was fixed recently. Roger From Thomas.Lohse at tracetronic.de Wed Nov 12 16:18:09 2008 From: Thomas.Lohse at tracetronic.de (Lohse, Thomas) Date: Wed, 12 Nov 2008 16:18:09 +0100 Subject: [python-win32] Calling ShellIconOverlayHandlers does not work In-Reply-To: References: Message-ID: Thanks a lot, Roger. Upgrading to build 212 solved the problem. Cheers, Thomas Thomas Lohse wrote: > Hello, > > could anyone provide some assistance in using ShellIconOverlay-Handlers > with pythoncom. I implement a kind of file explorer and would like to > call the ShellIconOverlay-Handlers (registered by TortoiseSVN) of the > windows explorer to visualize SVN-states. (I'm NOT about to implement my > own handler). > > I can successfully CoCreateInstance these handlers and receive an > implementation of IShellIconOverlayIdentifier interface. > GetOverlayInfo() and GetPriority() both work fine on the interface, but > IsMemberOf(path, attributes) always returns None instead of S_OK, > S_FALSE, E_FAIL or an exception. This is the case whether the passed > path exists or not and is independent of the passed attributes. > > Why does IShellIconOverlayIdentifier::IsMemberOf() not work? Any advice > or hint would be very appreciated. > > > Yours sincerely, > Thomas > > > My approach to using ShellIconOverlay handlers: > > import sys > import pythoncom > import win32api, win32con > > from win32com.shell import shell > from winerror import S_OK, S_FALSE, E_FAIL > > > def CallIconOverlayHandler(): > path = sys.argv[1] if len(sys.argv) > 1 else u"C:\\foo" > > # Query CLSID for 1st registered IconOverlayHandler > # (there should be handler "Offline Files" at least, since included > in Win) > regKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, > > ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayId > entifiers") > name = win32api.RegEnumKey(regKey, 0) > clsId = win32api.RegQueryValue(regKey, name) > win32api.RegCloseKey(regKey) > > print u"Using %s: %s" % (name, clsId) > ovHdl = pythoncom.CoCreateInstance(clsId, None, > pythoncom.CLSCTX_INPROC_SERVER, > shell.IID_IShellIconOverlayIdentifier) > > #Works fine > print u"GetOverlayInfo():", ovHdl.GetOverlayInfo() > print u"GetPriority():", ovHdl.GetPriority() > > #Problem: IsMemberOf returns always None > print u"IsMemberOf(\"%s\", 0):" % path, ovHdl.IsMemberOf(path, 0) > > print u"Done." > > if __name__ == "__main__": > CallIconOverlayHandler() Try upgrading to build 212. There was a bug in this method that was fixed recently. Roger _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Wed Nov 12 23:35:40 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 13 Nov 2008 09:35:40 +1100 Subject: [python-win32] COM server and pointer to pointer parameter In-Reply-To: <942da9855990361821acaccd61a2f88c@79.16.19.89> References: <942da9855990361821acaccd61a2f88c@79.16.19.89> Message-ID: <00b701c94517$01a6e910$04f4bb30$@com.au> > Thanks Mark for the test. I'm running the test on Windows XP and > Windows 2k, > both with python 2.5.2. The problem is that the QI with value to 0 is > raised somewhere in the pythoncom code I'm pretty sure pythoncom never (explicitly) QI's for IID_NULL. It may QI for one of its private interfaces though, or in general for *any* interface - so I'm still surprised that a QI for an interface you don't support breaks anything - its *designed* to be called with interfaces you don't understand. In out-of-process situations the COM marshaller may do the same to see if you can help with the marshalling - indeed, that might be a clue here. > This cause the call to the function to fail with an exception. What exception exactly? > I guess that if you return E_NOINTERFACE the effect changes a little but > not > the concept. Why somebody is asking for an interface with iid to null? > This > happens with functions that want to return a **param as in the pippo > server. That is another clue that makes me think the marshaller might be involved. Have you changed pippo to only support out-of-process registration? Cheers, Mark From bikash.sherchan at gmail.com Thu Nov 13 12:31:48 2008 From: bikash.sherchan at gmail.com (bikash.sherchan at gmail.com) Date: Thu, 13 Nov 2008 12:31:48 +0100 Subject: [python-win32] PythonWin Message-ID: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> I am using Windows Vista and installed python 2.6. I am working on my masters thesis and would like to write python scripts to automize some tools in ArcGIS. To do so I am following "Writing Geoprocessing Scripts with ArcGIS" from ESRI which is based on pythonWin. Unfortunately I could not find this pythonWin environment in my case. Any suggestions on how to solve this problem would be highly appreciated. Thanks in advance -- Bikash Sherchan University of Applied Science Stuttgart Germany Tel: +4971112164816 (Home Zone) +4917664081666 (Mobile Zone) -------------- next part -------------- An HTML attachment was scrubbed... URL: From haraldarminmassa at gmail.com Thu Nov 13 12:37:17 2008 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Thu, 13 Nov 2008 12:37:17 +0100 Subject: [python-win32] PythonWin In-Reply-To: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> References: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> Message-ID: <7be3f35d0811130337k3bb7533ofc9b72b752b099a1@mail.gmail.com> Bikash, to use pythonwin you need to install the python windows 32 extensions. Search at http://www.python.org/download/windows/ which leads you to http://sourceforge.net/projects/pywin32/ Maybe, just maybe, you could be better of to "downgrade" to Python 2.5 if you are just a beginner with Python and want to use some description from the web. Many tools and documentations are not updated to Python 2.6 yet. Best wishes, Harald On Thu, Nov 13, 2008 at 12:31, wrote: > I am using Windows Vista and installed python 2.6. I am working on my > masters thesis and would like to write python scripts to automize some tools > in ArcGIS. To do so I am following "Writing Geoprocessing Scripts with > ArcGIS" from ESRI which is based on pythonWin. Unfortunately I could not > find this pythonWin environment in my case. > > Any suggestions on how to solve this problem would be highly appreciated. > Thanks in advance > > -- > Bikash Sherchan > University of Applied Science Stuttgart > Germany > Tel: +4971112164816 (Home Zone) > +4917664081666 (Mobile Zone) > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - EuroPython 2009 will take place in Birmingham - Stay tuned! From timr at probo.com Thu Nov 13 19:19:17 2008 From: timr at probo.com (Tim Roberts) Date: Thu, 13 Nov 2008 10:19:17 -0800 Subject: [python-win32] PythonWin In-Reply-To: <7be3f35d0811130337k3bb7533ofc9b72b752b099a1@mail.gmail.com> References: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> <7be3f35d0811130337k3bb7533ofc9b72b752b099a1@mail.gmail.com> Message-ID: <491C6FA5.50402@probo.com> Harald Armin Massa wrote: > Maybe, just maybe, you could be better of to "downgrade" to Python 2.5 > if you are just a beginner with Python and want to use some > description from the web. Many tools and documentations are not > updated to Python 2.6 yet. > This is reasonable advice, but since he's a beginner, I'd like to expand on WHY this is reasonable advice. Python is in the middle of a rather significant transition, from Python 2 to Python 3. Python 3 makes some many changes in the language, some of which are incompatible with current code. This was done to clean up some of the things that should have been cleaned up long ago, but couldn't because of compatibility. Python 3.0 should be formally released within the next 4 weeks or so. Python 2.6 is a special "bridge" release; it contains some of the Python 3.0 changes, but in a way that helps you identify things that will need to be migrated. Because of that, it issues warnings for constructs that are valid in Python 2.x, but will be invalid in Python 3.x. For someone who is just beginning, that is an unnecessary distraction. Python 2.x and Python 3.x will coexist in the world for many years yet, so there's nothing wrong with learning Python 2.x today. But to do that, I agree with Harald that you should probably start with Python 2.5. Virtually all of the major tools work with Python 2.5. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Andrew.MacIntyre at acma.gov.au Fri Nov 14 01:03:26 2008 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Fri, 14 Nov 2008 11:03:26 +1100 Subject: [python-win32] PythonWin [SEC=UNCLASSIFIED] In-Reply-To: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> References: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> Message-ID: <7B01D7143C4AD54899EA079D4557562AFEF52F@ACT01EXC02.internal.govt> > bikash.sherchan at gmail.com wrote: > > I am using Windows Vista and installed python 2.6. I am working on my > masters thesis and would like to write python scripts to automize some > tools in ArcGIS. To do so I am following "Writing Geoprocessing > Scripts with ArcGIS" from ESRI which is based on pythonWin. > Unfortunately I could not find this pythonWin environment in my case. Given your interest in ArcGIS, I would strongly suggest checking the ArcGIS installation materials for the version you are using to determine the Python version supported with that ArcGIS release. ESRI may supply a PythonWin installer (I'm pretty sure they supply a Python installer). Python extensions, such as the extension ESRI supplies to interface with ArcGIS, usually have a dependency on the particular version of the Python DLL in the Windows environment (eg Python 2.5.x -> python25.dll). If the ArcGIS media kit doesn't contain PythonWin, you can retrieve a copy of the PythonWin installer to match the Python version via PythonWin's home page: http://starship.python.net/crew/mhammond/win32/ -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre National Licensing and Allocations Branch tel: +61 2 6219 5356 Inputs to Industry Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au If you have received this email in error, please notify the sender immediately and erase all copies of the email and any attachments to it. The information contained in this email and any attachments may be private, confidential and legally privileged or the subject of copyright. If you are not the addressee it may be illegal to review, disclose, use, forward, or distribute this email and/or its contents. Unless otherwise specified, the information in the email and any attachments is intended as a guide only and should not be relied upon as legal or technical advice or regarded as a substitute for legal or technical advice in individual cases. Opinions contained in this email or any of its attachments do not necessarily reflect the opinions of ACMA. From bikash.sherchan at gmail.com Fri Nov 14 11:31:51 2008 From: bikash.sherchan at gmail.com (bikash.sherchan at gmail.com) Date: Fri, 14 Nov 2008 11:31:51 +0100 Subject: [python-win32] PythonWin In-Reply-To: <491C6FA5.50402@probo.com> References: <9a3229810811130331l12a8854bq5da6d1e99d6f621c@mail.gmail.com> <7be3f35d0811130337k3bb7533ofc9b72b752b099a1@mail.gmail.com> <491C6FA5.50402@probo.com> Message-ID: <9a3229810811140231s753bd1efide2ca48b561356fa@mail.gmail.com> **** Thanks everybody, I have decided to downgrade to python 2.5 and try that. I will of course share my experience later how it works. thank you all again and wish you all a nice weekend. Bikash On 11/13/08, Tim Roberts wrote: > > Harald Armin Massa wrote: > > Maybe, just maybe, you could be better of to "downgrade" to Python 2.5 > > if you are just a beginner with Python and want to use some > > description from the web. Many tools and documentations are not > > updated to Python 2.6 yet. > > > > This is reasonable advice, but since he's a beginner, I'd like to expand > on WHY this is reasonable advice. > > Python is in the middle of a rather significant transition, from Python > 2 to Python 3. Python 3 makes some many changes in the language, some > of which are incompatible with current code. This was done to clean up > some of the things that should have been cleaned up long ago, but > couldn't because of compatibility. Python 3.0 should be formally > released within the next 4 weeks or so. > > Python 2.6 is a special "bridge" release; it contains some of the Python > 3.0 changes, but in a way that helps you identify things that will need > to be migrated. Because of that, it issues warnings for constructs that > are valid in Python 2.x, but will be invalid in Python 3.x. For someone > who is just beginning, that is an unnecessary distraction. > > Python 2.x and Python 3.x will coexist in the world for many years yet, > so there's nothing wrong with learning Python 2.x today. But to do > that, I agree with Harald that you should probably start with Python > 2.5. Virtually all of the major tools work with Python 2.5. > > -- > 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 > -- Bikash Sherchan In der Au 16C/3102 70327 Untert?rkheim Germany Tel: +4971112164816 (Home Zone) +4917664081666 (Mobile Zone) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.neve at gmail.com Fri Nov 14 14:46:28 2008 From: ryan.neve at gmail.com (Ryan Neve) Date: Fri, 14 Nov 2008 08:46:28 -0500 Subject: [python-win32] win32com and DispatchWithEvents() Message-ID: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> I posted this on comp.lang.python. but it has been pointed out to me that this is a better place to ask. I'm trying to get DispatchWithEvents() to work with HyperAccess (terminal program) without much success. This works but doesn't handle the "Event Driven Functions": haObj = win32com.client.Dispatch(r"HAWin32") I'm certainly new to all this but I've done a bunch of searching on google and found some examples using IE. This is derived from eventsFreeThreaded.py and eventsApartmentThreaded.py included as demos with win32com. I have to admit I don't really get the difference between Free Threaded and Apartment threaded or which I should be using. I feel like I'm in over my ability level, but that's usually how you learn. This Internet Explorer Example works: ieObj = win32com.client.DispatchWithEvents("InternetExplorer.Application", ExplorerEvents) But this does not: haObj = win32com.client.DispatchWithEvents("HAWin32", HAEvents) It fails with the error message: "TypeError: This COM object can not automate the makepy process - please run makepy manually for this object" I looked in the files generated by makepy (I used the COM Makepy utility in PythonWin) and after some searching I tried: mod = win32com.client.gencache.EnsureModule('{5178CCE1-AAEF-11CE-AE75-00AA0030EBC8}', 0, 1, 0) haObj = win32com.client.DispatchWithEvents(mod, HAEvents) Which fails with the error message: ttributeError: 'module' object has no attribute 'GetTypeInfo' So I tried this approach with IE: mod = win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B8}', 0, 1, 0) ieObj = win32com.client.DispatchWithEvents(mod, ExplorerEvents) But this too breaks with the same GetTypeInfo error. Any ideas or resources? I can provide the makepy output if that helps. Here's a thread that almost mirrors my experience but never seems to come to a conclusion: http://mail.python.org/pipermail/python-win32/2006-August/004888.html Regards, -Ryan Neve UNC CH Inst. of Marine Sciences -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Sat Nov 15 00:38:22 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 15 Nov 2008 10:38:22 +1100 Subject: [python-win32] win32com and DispatchWithEvents() In-Reply-To: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> References: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> Message-ID: <01db01c946b2$19dd5b30$4d981190$@com.au> > haObj = win32com.client.DispatchWithEvents("HAWin32", HAEvents) > It fails with the error message: > "TypeError: This COM object can not automate the makepy process - please > run makepy manually for this object" At this point, all you need to do is execute makepy, then select the typelib for your object. Once executed, you can then try the DispatchWithEvents line again - there isn't a need to use EnsureModule yet. If you *do* get that working, then you should try running "makepy.py -i" and re-selecting the typelib - that will then spit out some 'EnsureModule' lines you could use to automate the makepy process. > http://mail.python.org/pipermail/python-win32/2006-August/004888.html hrm - its quite possible that there are objects we can do events for, but those objects do *not* provide typeinfo at runtime. We could probably handle this situation, but unfortunately I'm not in a position to test things. Ultimately, the message comes from a block in win32com\client\__init__.py: except pythoncom.com_error: raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") It might be informative to remove that exception handler so we can see what the original exception raised by the object was. Cheers, Mark From m.echavarriagregory at umiami.edu Sat Nov 15 00:43:32 2008 From: m.echavarriagregory at umiami.edu (Echavarria Gregory, Maria Angelica) Date: Fri, 14 Nov 2008 18:43:32 -0500 Subject: [python-win32] Scary message when opening the Interpreter Message-ID: <2E95F75EDC25D54999387A1E2E6EF62796B02A0A@MBX02.cgcent.miami.edu> Hello group! I'm a new member, I hope to be of help some time! As today, I have troubles, hope you can solve them: When I open my Python interpreter, this is appearing instead of the command arrows (>>>): File "boot_com_servers.py", line 21, in File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in pywintypes.__import_pywin32_system_module__("pythoncom", globals ()) File "C:\Python25\lib\site-packages\win32\lib\pywintypes.py", line 98, in __import_pywin32_system_module__ ('.dll', 'rb', imp.C_EXTENSION)) ImportError: DLL load failed: The specified procedure could not be found. I also noticed some basic commands are not working. What should I do? I'm afraid to update and replace all the modules of different parties that I have compiled and installed in my directory, and don't know how to do it without damaging everything... PLEASE HELP! Angelica From timr at probo.com Sat Nov 15 01:51:32 2008 From: timr at probo.com (Tim Roberts) Date: Fri, 14 Nov 2008 16:51:32 -0800 Subject: [python-win32] Scary message when opening the Interpreter In-Reply-To: <2E95F75EDC25D54999387A1E2E6EF62796B02A0A@MBX02.cgcent.miami.edu> References: <2E95F75EDC25D54999387A1E2E6EF62796B02A0A@MBX02.cgcent.miami.edu> Message-ID: <491E1D14.3080303@probo.com> Echavarria Gregory, Maria Angelica wrote: > Hello group! I'm a new member, I hope to be of help some time! As today, I have troubles, hope you can solve them: > > When I open my Python interpreter, this is appearing instead of the command > arrows (>>>): > > File "boot_com_servers.py", line 21, in > File "C:\Python25\lib\site-packages\pythoncom.py", line 3, in > > pywintypes.__import_pywin32_system_module__("pythoncom", globals > ()) > File "C:\Python25\lib\site-packages\win32\lib\pywintypes.py", line > 98, in __import_pywin32_system_module__ > ('.dll', 'rb', imp.C_EXTENSION)) > ImportError: DLL load failed: The specified procedure could not be > found. > > I also noticed some basic commands are not working. > What should I do? > I'm afraid to update and replace all the modules of different parties that I have compiled > and installed in my directory, and don't know how to do it without damaging everything... > This looks like a problem with mixed versions. Are you saying that you built Python and Python-Win32 from source? If so, may I ask why? There is virtually no benefit to doing so on Windows. The pre-built executables provide everything you need. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From theller at ctypes.org Sat Nov 15 12:23:14 2008 From: theller at ctypes.org (Thomas Heller) Date: Sat, 15 Nov 2008 12:23:14 +0100 Subject: [python-win32] win32com and DispatchWithEvents() In-Reply-To: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> References: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> Message-ID: Ryan Neve schrieb: > I posted this on comp.lang.python. but it has been pointed out to me that > this is a better place to ask. > > I'm trying to get DispatchWithEvents() to work with HyperAccess (terminal > program) without much success. My apologies for (again) advertising comtypes on this list - if this is inappropriate please tell me and I'll stop. So, I suggest you try out comtypes: http://starship.python.net/crew/theller/comtypes/ Thomas From mail at timgolden.me.uk Sat Nov 15 13:11:45 2008 From: mail at timgolden.me.uk (Tim Golden) Date: Sat, 15 Nov 2008 12:11:45 +0000 Subject: [python-win32] win32com and DispatchWithEvents() In-Reply-To: References: <4b9c95910811140546r36f01b54t81567b93d993ff7d@mail.gmail.com> Message-ID: <491EBC81.6040507@timgolden.me.uk> Thomas Heller wrote: > Ryan Neve schrieb: >> I posted this on comp.lang.python. but it has been pointed out to me that >> this is a better place to ask. >> >> I'm trying to get DispatchWithEvents() to work with HyperAccess (terminal >> program) without much success. > > My apologies for (again) advertising comtypes on this list - if this is > inappropriate please tell me and I'll stop. My 2.5p-worth [*] is that this is a list for the use of Python under win32 (or, these days, win32/64). So anything which is relevant to that is relevant here. And comtypes *definitely* passes the "relevant" test. It's certainly not confined to the use of the pywin32 packages, if that's what your post was hinting at. TJG [*] This is pronounced tuppence-ha'penny-worth for those of you who have the misfortune not to be English :) From yeosuanaik at gmail.com Sun Nov 16 19:04:04 2008 From: yeosuanaik at gmail.com (sayeo87) Date: Sun, 16 Nov 2008 10:04:04 -0800 (PST) Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) Message-ID: <20528072.post@talk.nabble.com> Right now on Windows I have added ".py" to my PATHEXT so that I can run .py files by doing ./.py. But when I do this the output of the program goes to a new command prompt window which instantly disappears. How can I instead make the output go to the current command prompt window I'm working in, like in a linux terminal? Sorry if this has been answered before but I've googled high and low and still can't seem to find how to do this. Thanks, Suan -- View this message in context: http://www.nabble.com/How-to-make-python-scripts-output-to-current-cmd-window--%28like-linux-terminal%29-tp20528072p20528072.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From gerdusvanzyl at gmail.com Sun Nov 16 21:11:20 2008 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Sun, 16 Nov 2008 22:11:20 +0200 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <20528072.post@talk.nabble.com> References: <20528072.post@talk.nabble.com> Message-ID: <91882ea90811161211s3bfa87b5w198cb76197b84931@mail.gmail.com> Try removing it from PATHEXT, it seems to work fine without just going on the file association. At least on my PC. ~Gerdus On Sun, Nov 16, 2008 at 8:04 PM, sayeo87 wrote: > > Right now on Windows I have added ".py" to my PATHEXT so that I can run .py > files by doing ./.py. But when I do this the output of the program > goes to a new command prompt window which instantly disappears. How can I > instead make the output go to the current command prompt window I'm working > in, like in a linux terminal? > > Sorry if this has been answered before but I've googled high and low and > still can't seem to find how to do this. > > > Thanks, > Suan > -- > View this message in context: http://www.nabble.com/How-to-make-python-scripts-output-to-current-cmd-window--%28like-linux-terminal%29-tp20528072p20528072.html > Sent from the Python - python-win32 mailing list archive at Nabble.com. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mc at mclaveau.com Sun Nov 16 22:42:24 2008 From: mc at mclaveau.com (Michel Claveau) Date: Sun, 16 Nov 2008 22:42:24 +0100 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <20528072.post@talk.nabble.com> References: <20528072.post@talk.nabble.com> Message-ID: <1B39EFF9041B4C3B8DAF0D7D16C0DD49@MCI1330> Hi! Use: cmd /k Example: cmd /k C:\myscripts\python\filename.py But... After, it's you, who must close the window... @-salutations -- Michel Claveau From yeosuanaik at gmail.com Mon Nov 17 03:19:53 2008 From: yeosuanaik at gmail.com (sayeo87) Date: Sun, 16 Nov 2008 18:19:53 -0800 (PST) Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <20528072.post@talk.nabble.com> References: <20528072.post@talk.nabble.com> Message-ID: <20532800.post@talk.nabble.com> Yeah I eventually figured it out...... I don't know why i took me so long....... its "myFile.py" or "python myFile.py" in the command prompt or "python myFile.py" if you're using PowerShell -- View this message in context: http://www.nabble.com/How-to-make-python-scripts-output-to-current-cmd-window--%28like-linux-terminal%29-tp20528072p20532800.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From timr at probo.com Mon Nov 17 19:50:03 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 17 Nov 2008 10:50:03 -0800 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <20528072.post@talk.nabble.com> References: <20528072.post@talk.nabble.com> Message-ID: <4921BCDB.9000203@probo.com> sayeo87 wrote: > Right now on Windows I have added ".py" to my PATHEXT so that I can run .py > files by doing ./.py. But when I do this the output of the program > goes to a new command prompt window which instantly disappears. How can I > instead make the output go to the current command prompt window I'm working > in, like in a linux terminal? > > Sorry if this has been answered before but I've googled high and low and > still can't seem to find how to do this. > What PATHEXT lets you do is run the command without specifying a path at all. As long as the file is in the same directory, the file association will work. PATHEXT allows you to put Python scripts in your c:\bin directory, for example, and then use them without specifying the path or the extension. So, I have a Python version of "which" that I store in my \bin directory under the name "which.py". But from a command line, all I have to type is "which". I'm surprised by your description. Check your file associations. From your command line, say assoc .py On my machine, it says: .py=Python.File Then, check the ftype: ftype Python.File On my machine, it says: python.file="C:\Apps\Python24\Python.exe" "%1" "%* I see that you wrote "./.py". Was that an accident, or are you using a shell other than "cmd"? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Mon Nov 17 20:09:45 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 17 Nov 2008 11:09:45 -0800 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <4921BCDB.9000203@probo.com> References: <20528072.post@talk.nabble.com> <4921BCDB.9000203@probo.com> Message-ID: <4921C179.5000904@probo.com> Tim Roberts wrote: > sayeo87 wrote: > >> Right now on Windows I have added ".py" to my PATHEXT so that I can run .py >> files by doing ./.py. But when I do this the output of the program >> goes to a new command prompt window which instantly disappears. How can I >> instead make the output go to the current command prompt window I'm working >> in, like in a linux terminal? >> >> Sorry if this has been answered before but I've googled high and low and >> still can't seem to find how to do this. >> >> > > What PATHEXT lets you do is run the command without specifying a path at > all. I realized when I read my reply that I really did nothing to clear up any confusion. Allow me to provide an example. Let's say I have c:\bin\remote.py, and client.py in the current directory. WIthout the file associations for .py and .pyw, I can say: python client.py pythonw client.py If I set up file associations for .py and .py, then I can also say: client.py .\client.py Further, as long as "c:\bin" is in the path, I can also say: remote.py When I add .PY and .PYW to PATHEXT, that also lets me say: client remote without the extension. That's the sole purpose for PATHEXT. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From yeosuanaik at gmail.com Mon Nov 17 21:42:23 2008 From: yeosuanaik at gmail.com (sayeo87) Date: Mon, 17 Nov 2008 12:42:23 -0800 (PST) Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <4921C179.5000904@probo.com> References: <20528072.post@talk.nabble.com> <4921BCDB.9000203@probo.com> <4921C179.5000904@probo.com> Message-ID: <20547776.post@talk.nabble.com> Tim Roberts wrote: > > Tim Roberts wrote: >> sayeo87 wrote: >> >>> Right now on Windows I have added ".py" to my PATHEXT so that I can run >>> .py >>> files by doing ./.py. But when I do this the output of the >>> program >>> goes to a new command prompt window which instantly disappears. How can >>> I >>> instead make the output go to the current command prompt window I'm >>> working >>> in, like in a linux terminal? >>> >>> Sorry if this has been answered before but I've googled high and low and >>> still can't seem to find how to do this. >>> >>> >> >> What PATHEXT lets you do is run the command without specifying a path at >> all. > > I realized when I read my reply that I really did nothing to clear up > any confusion. Allow me to provide an example. > > Let's say I have c:\bin\remote.py, and client.py in the current > directory. WIthout the file associations for .py and .pyw, I can say: > python client.py > pythonw client.py > If I set up file associations for .py and .py, then I can also say: > client.py > .\client.py > Further, as long as "c:\bin" is in the path, I can also say: > remote.py > > When I add .PY and .PYW to PATHEXT, that also lets me say: > client > remote > > without the extension. That's the sole purpose for PATHEXT. > > -- > 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 > > Thanks for your reply, Tim. Regarding your earlier question about me not using cmd when doing "./myFile.py", that was true - I was using PowerShell. And I learned something about your explanation regarding PATHEXT. Turns out I won't need that in the forseeable future, as all I want to do is execute .py files in the CURRENT directory, WITHOUT taking away the ".py" extension. I guess that has something to say about trying random solutions one sees online without actually finding out what they do =^D -- View this message in context: http://www.nabble.com/How-to-make-python-scripts-output-to-current-cmd-window--%28like-linux-terminal%29-tp20528072p20547776.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From mdriscoll at co.marshall.ia.us Tue Nov 18 15:38:39 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 18 Nov 2008 08:38:39 -0600 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <4921C179.5000904@probo.com> References: <20528072.post@talk.nabble.com> <4921BCDB.9000203@probo.com> <4921C179.5000904@probo.com> Message-ID: <4922D36F.1000406@co.marshall.ia.us> Tim Roberts wrote: > Tim Roberts wrote: > >> sayeo87 wrote: >> >> >>> Right now on Windows I have added ".py" to my PATHEXT so that I can run .py >>> files by doing ./.py. But when I do this the output of the program >>> goes to a new command prompt window which instantly disappears. How can I >>> instead make the output go to the current command prompt window I'm working >>> in, like in a linux terminal? >>> >>> Sorry if this has been answered before but I've googled high and low and >>> still can't seem to find how to do this. >>> >>> >>> >> What PATHEXT lets you do is run the command without specifying a path at >> all. >> > > I realized when I read my reply that I really did nothing to clear up > any confusion. Allow me to provide an example. > > Let's say I have c:\bin\remote.py, and client.py in the current > directory. WIthout the file associations for .py and .pyw, I can say: > python client.py > pythonw client.py > If I set up file associations for .py and .py, then I can also say: > client.py > .\client.py > Further, as long as "c:\bin" is in the path, I can also say: > remote.py > Sorry to intrude, but what is "C:\bin" ? I don't have it on Windows XP and I couldn't find a "bin" folder in my Python25 directory either. Is this some kind of custom wizardry on your part? Mike From timr at probo.com Tue Nov 18 18:58:18 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 18 Nov 2008 09:58:18 -0800 Subject: [python-win32] How to make python scripts output to current cmd window? (like linux terminal) In-Reply-To: <4922D36F.1000406@co.marshall.ia.us> References: <20528072.post@talk.nabble.com> <4921BCDB.9000203@probo.com> <4921C179.5000904@probo.com> <4922D36F.1000406@co.marshall.ia.us> Message-ID: <4923023A.9010603@probo.com> Mike Driscoll wrote: > Tim Roberts wrote: >> >> I realized when I read my reply that I really did nothing to clear up >> any confusion. Allow me to provide an example. >> >> Let's say I have c:\bin\remote.py, and client.py in the current >> directory. WIthout the file associations for .py and .pyw, I can say: >> python client.py >> pythonw client.py >> If I set up file associations for .py and .py, then I can also say: >> client.py >> .\client.py >> Further, as long as "c:\bin" is in the path, I can also say: >> remote.py >> > > > Sorry to intrude, but what is "C:\bin" ? I don't have it on Windows XP > and I couldn't find a "bin" folder in my Python25 directory either. Is > this some kind of custom wizardry on your part? It's not wizardry. I spend most of my life in a command line, so my computer is organized to make command line life easier, using lessons learned from Unix. I create directories called \apps, \bin, \etc, and \tmp. If I install a program that I think I will need in a command line, I install it in \Apps instead of "\Program Files" (because it's shorter, and because spaces are evil). All the tools I write, all the command line tools I download, and shortcut batch files to the other tools I need all go in c:\bin. That way, I can put "C:\bin" in the path, instead of cluttering it up with dozens of directories that each have one tool. A long path costs performance. Some people think they are stuck with the "\Documents and Settings" and "\Program Files" nonsense that Microsoft dictates. Not so. It's your computer, do what works for YOU. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Solomon.Zewdie.Altek at zf.com Wed Nov 19 09:55:18 2008 From: Solomon.Zewdie.Altek at zf.com (Solomon.Zewdie.Altek at zf.com) Date: Wed, 19 Nov 2008 09:55:18 +0100 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value Message-ID: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> Hi, the statement: worksheet.Cells(row, col).Value returns a Value of type of Strings, Can anyone tell me how I can get an Integer value? Casting (int(worksheet.Cells(row, col).Value ) didn't work. Many Tnx! solomon From greg.antal at ata-e.com Wed Nov 19 17:15:13 2008 From: greg.antal at ata-e.com (Greg Antal) Date: Wed, 19 Nov 2008 08:15:13 -0800 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value In-Reply-To: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> Message-ID: <49243B91.5030402@ata-e.com> Solomon: To do this in a Visual Basic module within Excel, you would use intValue = Val(worksheet.Cells(row, col).Value) I haven't tried to use Excel as a COM server, but I think if you can use the "Val()" function, you'll get the data you want instead of a string. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.antal at ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) Solomon.Zewdie.Altek at zf.com wrote: > Hi, > the statement: worksheet.Cells(row, col).Value returns a Value of type of Strings, > Can anyone tell me how I can get an Integer value? > Casting (int(worksheet.Cells(row, col).Value ) didn't work. > > Many Tnx! > > solomon > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From Solomon.Zewdie.Altek at zf.com Wed Nov 19 18:03:27 2008 From: Solomon.Zewdie.Altek at zf.com (Solomon.Zewdie.Altek at zf.com) Date: Wed, 19 Nov 2008 18:03:27 +0100 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> <49243B91.5030402@ata-e.com> Message-ID: <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> I just tried it ( I did: IntValue = Val(self.worksheet.Cells(row, col).Value)) Though It seems that the COM server doesn't know Val()... or am i doin something wrong?? I got the error: "NameError: global name 'Val' is not defined" ________________________________ Von: python-win32-bounces+solomon.zewdie.altek=zf.com at python.org im Auftrag von Greg Antal Gesendet: Mi 19.11.2008 17:15 An: python-win32 at python.org Betreff: Re: [python-win32] getting integer value for worksheet.Cells(row, col).Value Solomon: To do this in a Visual Basic module within Excel, you would use intValue = Val(worksheet.Cells(row, col).Value) I haven't tried to use Excel as a COM server, but I think if you can use the "Val()" function, you'll get the data you want instead of a string. - Greg Antal Gregory W. Antal Senior Technical Advisor ATA Engineering, Inc. 11995 El Camino Real, Suite 200 San Diego, CA 92130 www.ata-e.com greg.antal at ata-e.com 858-480-2072 (Phone) 858-792-8932 (Fax) Solomon.Zewdie.Altek at zf.com wrote: > Hi, > the statement: worksheet.Cells(row, col).Value returns a Value of type of Strings, > Can anyone tell me how I can get an Integer value? > Casting (int(worksheet.Cells(row, col).Value ) didn't work. > > Many Tnx! > > solomon > _______________________________________________ > 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 bgailer at gmail.com Wed Nov 19 18:32:56 2008 From: bgailer at gmail.com (bob gailer) Date: Wed, 19 Nov 2008 12:32:56 -0500 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value In-Reply-To: <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> <49243B91.5030402@ata-e.com> <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> Message-ID: <49244DC8.9070407@gmail.com> Solomon.Zewdie.Altek at zf.com wrote: > I just tried it ( I did: IntValue = Val(self.worksheet.Cells(row, col).Value)) > Though It seems that the COM server doesn't know Val()... or am i doin something wrong?? > I got the error: "NameError: global name 'Val' is not defined" Greg offered that for use "... in a Visual Basic module ...". You are using Val as part of a Python expression, and Python does not know "Val". Has nothing to do with COM. Try int instead of Val. -- Bob Gailer Chapel Hill NC 919-636-4239 From modriscoll at rim.com Wed Nov 19 18:40:02 2008 From: modriscoll at rim.com (Mike O'Driscoll) Date: Wed, 19 Nov 2008 12:40:02 -0500 Subject: [python-win32] COM AttributeError Inquiry Message-ID: <2FF82E3869C54346AB7644EC634F901B02876D80@XCH60YKF.rim.net> Hi, First time contacting this mailing list... please forgive and discrepancies I may make. I have a threaded module with an internal com object. If I make a call from outside the module everything works ok. If I make a call internal to the module it decides to give me the following exception: File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line 500, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: MyApp.AutomationProxy.Control #################Code Snippet################## import win32com.client from threading import Thread, Event import thread, threading class AppController(Thread): def __init__(self): """Set up the class""" Thread.__init__(self) self.stopevent = threading.Event() self.app = win32com.client.Dispatch("MyApp.AutomationProxy") if not(self.app): print "Could not open MyApp Application" exit(1) def join(self, timeout=None): """Stop the thread and wait for it to finish""" del self.app print "App Finished" self.stopevent.set() Thread.join(self, timeout) def run(self): while not self.stopevent.isSet(): self.app.Control("myCommand") #Exception raised Here!? #-------------------------------------------------- # Main Program #-------------------------------------------------- if __name__ == '__main__': appCtrl = AppController() appCtrl.start() appCtrl.app.Control("myCommand") #Exception NOT raised? print "Press Any Key to Quit" import msvcrt while not msvcrt.kbhit(): pass # Gobble the key. msvcrt.getch() rtgCtrl.join() exit(0) #################End Code######################## I'm confused as to why using the object can complete the call, but when calling within the class raises the attributeError exception. Does the threading have something to do with it? (I have other threads like this but removed to keep this short) Any help appreciated. Thanks, Mike O'Driscoll Intern Software Application Developer 3G Architecture | RIM Cellular Technologies --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.antal at ata-e.com Wed Nov 19 20:41:11 2008 From: greg.antal at ata-e.com (Greg Antal) Date: Wed, 19 Nov 2008 11:41:11 -0800 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value In-Reply-To: <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> <49243B91.5030402@ata-e.com> <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> Message-ID: <49246BD7.5090801@ata-e.com> An HTML attachment was scrubbed... URL: From timr at probo.com Wed Nov 19 21:10:50 2008 From: timr at probo.com (Tim Roberts) Date: Wed, 19 Nov 2008 12:10:50 -0800 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value In-Reply-To: <49246BD7.5090801@ata-e.com> References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> <49243B91.5030402@ata-e.com> <8A13418356E45E4784744371A8B4DD79059ADBA6@frds00501.emea.zf-world.com> <49246BD7.5090801@ata-e.com> Message-ID: <492472CA.1030802@probo.com> Greg Antal wrote: > > I think "Val" will be a method on the Excel server. For example, if > you have > xl = win32com.client.Dispatch("Excel.Application") > > for your server, you would have say something like > iValue = xl.Val(worksheet.Cells(row, col).Value) > > Again, I haven't used Excel this way, so I'm just going by standard > object-oriented practice. You'll have to work out those details yourself. No. Bob had the right answer here. "Val" is a Visual Basic function, because the sample snippet was Visual Basic code. To do the same conversion in Python, you need to use a Python function -- int() in this case. Cells().Value returns a string. It's just that simple. If you want an integer, you convert it. No mystery, no COM. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mhammond at skippinet.com.au Wed Nov 19 22:53:50 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 20 Nov 2008 08:53:50 +1100 Subject: [python-win32] COM AttributeError Inquiry In-Reply-To: <2FF82E3869C54346AB7644EC634F901B02876D80@XCH60YKF.rim.net> References: <2FF82E3869C54346AB7644EC634F901B02876D80@XCH60YKF.rim.net> Message-ID: <01d301c94a91$51840650$f48c12f0$@com.au> Search this mailing list for discussions about the COM threading model. In short, you can't create a COM object on one thread and use it on another - the object must be marshalled. Cheers, Mark From: python-win32-bounces+skippy.hammond=gmail.com at python.org [mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf Of Mike O'Driscoll Sent: Thursday, 20 November 2008 4:40 AM To: python-win32 at python.org Subject: [python-win32] COM AttributeError Inquiry Hi, First time contacting this mailing list. please forgive and discrepancies I may make. I have a threaded module with an internal com object. If I make a call from outside the module everything works ok. If I make a call internal to the module it decides to give me the following exception: File "C:\Python25\Lib\site-packages\win32com\client\dynamic.py", line 500, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: MyApp.AutomationProxy.Control #################Code Snippet################## import win32com.client from threading import Thread, Event import thread, threading class AppController(Thread): def __init__(self): """Set up the class""" Thread.__init__(self) self.stopevent = threading.Event() self.app = win32com.client.Dispatch("MyApp.AutomationProxy") if not(self.app): print "Could not open MyApp Application" exit(1) def join(self, timeout=None): """Stop the thread and wait for it to finish""" del self.app print "App Finished" self.stopevent.set() Thread.join(self, timeout) def run(self): while not self.stopevent.isSet(): self.app.Control("myCommand") #Exception raised Here!? #-------------------------------------------------- # Main Program #-------------------------------------------------- if __name__ == '__main__': appCtrl = AppController() appCtrl.start() appCtrl.app.Control("myCommand") #Exception NOT raised? print "Press Any Key to Quit" import msvcrt while not msvcrt.kbhit(): pass # Gobble the key. msvcrt.getch() rtgCtrl.join() exit(0) #################End Code######################## I'm confused as to why using the object can complete the call, but when calling within the class raises the attributeError exception. Does the threading have something to do with it? (I have other threads like this but removed to keep this short) Any help appreciated. Thanks, Mike O'Driscoll Intern Software Application Developer 3G Architecture | RIM Cellular Technologies --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Nov 19 23:59:17 2008 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 19 Nov 2008 15:59:17 -0700 Subject: [python-win32] getting integer value for worksheet.Cells(row, col).Value In-Reply-To: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> References: <8A13418356E45E4784744371A8B4DD79059ADBA4@frds00501.emea.zf-world.com> Message-ID: Solomon: In what way did *int(worksheet.Cells(row, col).Value *not work? It seems that it should have. (You should not do a "cast", you want a conversion). To find out what's going on, try something like: alpha = worksheet.Cells(row,col).Value print 'Value was=', repr(alpha) Perhaps there is something about the received string that will not convert. For example, an empty string will give you a ValueError. You may have to use something like: try: val = int(alpha) except ValueError: val = 0 # or do you want val = None ? -- Vernon Cole On Wed, Nov 19, 2008 at 1:55 AM, wrote: > Hi, > the statement: worksheet.Cells(row, col).Value returns a Value of type of > Strings, > Can anyone tell me how I can get an Integer value? > Casting (int(worksheet.Cells(row, col).Value ) didn't work. > > Many Tnx! > > solomon > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pahudnet at gmail.com Thu Nov 20 05:04:04 2008 From: pahudnet at gmail.com (Pahud) Date: Thu, 20 Nov 2008 12:04:04 +0800 Subject: [python-win32] dispatch and minimize the window? Message-ID: <359737a80811192004k2fc0bc73q1e80f75ae45b67a2@mail.gmail.com> Hello list, I am trying to use win32com.client.Dispatch() to run my program but I would like to minimize it in the system tray. What can I do? thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From buck.christoph at googlemail.com Thu Nov 20 16:38:30 2008 From: buck.christoph at googlemail.com (Christoph Buck) Date: Thu, 20 Nov 2008 16:38:30 +0100 Subject: [python-win32] Hook windows messages with python Message-ID: <30ff7ecc0811200738n2eb6a9e7oaa49ddb0e84f96d0@mail.gmail.com> Hi! I'm trying to set a message hook with python to catch WM_DROPFILES. The guiframework is Tkinter. Here a code snippet: > hwnd = eval(self.wm_frame()) > win32gui.DragAcceptFiles(hwnd,1) > wnd = win32ui.CreateWindowFromHandle(hwnd) > wnd.HookMessage(self.test,w32con.WM_DROPFILES) > def test(self): > print "blala" The DragAcceptFiles-Call seems to be alright. When i drag a file over the gui there is this drag-and-drop icon. But the problem is, that the callback-function (test) is never executed. I also try different messages like Mousemove or Buttondown. So i think there is a problem with the HookMessage function. I read that you must compile Python with PYWIN_WITH_WINDOWPROC option enabled. Is this the problem? Can someone give me a short working code to hook a message so i can try it on my workstation? Thx in advance! From timr at probo.com Thu Nov 20 19:20:13 2008 From: timr at probo.com (Tim Roberts) Date: Thu, 20 Nov 2008 10:20:13 -0800 Subject: [python-win32] dispatch and minimize the window? In-Reply-To: <359737a80811192004k2fc0bc73q1e80f75ae45b67a2@mail.gmail.com> References: <359737a80811192004k2fc0bc73q1e80f75ae45b67a2@mail.gmail.com> Message-ID: <4925AA5D.50506@probo.com> Pahud wrote: > > I am trying to use win32com.client.Dispatch() to run my program but I > would like to minimize it in the system tray. What can I do? Your message could mean several things. Are you saying that you have written a COM server, and when someone starts your COM server using Dispatch, you want to put an icon in the tray? If so, it's entirely up to your COM server to do this. There are a number of example on Google of how to put an icon in the tray. Here's one: http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mc at mclaveau.com Fri Nov 21 09:39:43 2008 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 21 Nov 2008 09:39:43 +0100 Subject: [python-win32] Problem on install PyWin32 Message-ID: Hi, all! When I want install PyWin32 (212) on a computer, I obtain: EOFError Traceback (most recent call last): File "", line 565, in File "", line 443, in install File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 12, in import dynamic, gencache, pythoncom File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 662, in __init__() File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 54, in __init__ _LoadDicts() File "C:\Python25\Lib\site-packages\win32com\client\gencache.py", line 109, in _LoadDicts version = p.load() EOFError *** run_installscript: internal error 0xFFFFFFFF *** I do not had this message/problem. I tried to uninstall/reinstall PyWin ; uninstall/reinstall Python. Same problem. Details: Vista ultimate, UAC not active, Win-defender uninstalled, Firewall not active, Python 2.5.2 HELP!!! And... thanks by advance for all solutions. Michel Claveau From mc at mclaveau.com Fri Nov 21 10:42:35 2008 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 21 Nov 2008 10:42:35 +0100 Subject: [python-win32] Problem on install PyWin32 In-Reply-To: References: Message-ID: <74E54E6D444249DC9EF746573E53C3DE@MCI1330> Hi! (bis) Found solution. Disabling the antivirus had not enough. But, after uninstall the antivirus (avast), the installation is performed normally. Note that, once avast reinstalled, the problem is not persisted. @-salutations -- Michel Claveau From lhutzelmann at nero.com Mon Nov 24 19:03:51 2008 From: lhutzelmann at nero.com (Lars Hutzelmann) Date: Mon, 24 Nov 2008 19:03:51 +0100 Subject: [python-win32] Use Python DCOM object without having python installed locally Message-ID: Dear all, I recently wrote a class in Python that I want to be accessible by other programming and scripting languages under Windows. I converted it into a COM-server and it works quite well - on the same machine. Now I want to go a step further and provide the class to users on other machines that do/must not have python installed. It seems that I can not get it to work. What I have done so far: 1. defined the attribute "_reg_clsctx_" as follows in the class: _reg_clsctx_ = pythoncom.CLSCTX_REMOTE_SERVER|pythoncom.CLSCTX_LOCAL_SERVER|pythoncom.CLSCTX_INPROC_SERVER 2. Register the server on the REMOTE MACHINE using import win32com.server.register win32com.server.register.UseCommandLine(MyComObject) 3. Create an exception for port 135 in the Windows firewall settings on the local and remote machine 4. DCOM is activated on both machines 5. DCOM security settings are activated for "everybody" What is missing now is registering the client. Is it possible to create some kind of stub or proxy that can be used on the client? Is there any other way to achieve what I want to achieve? Thanks for your help, Lars From venutaurus539 at gmail.com Tue Nov 25 07:20:04 2008 From: venutaurus539 at gmail.com (venu madhav) Date: Tue, 25 Nov 2008 11:50:04 +0530 Subject: [python-win32] Fwd: Accessing Modification Time of an Outlook Mail in Python In-Reply-To: <8358786d-ccbf-4626-beb8-26dba0c7b72b@v13g2000yqm.googlegroups.com> References: <8358786d-ccbf-4626-beb8-26dba0c7b72b@v13g2000yqm.googlegroups.com> Message-ID: Hi all, I am writing a small application which reads the contents of an Outlook Mail using python. I am able to read the contents, subject along with senders and receivers of a mail using MAPI objects. But may I know how can I get access to the "modification time" or the receiving time of an outlook mail in Python. For the others I have used message object of MAPI session. Here I am pasting a sample code to get an idea of what am I doing. session = Dispatch("MAPI.session") session.Logon('outlook') # MAPI profile name inbox = session.Inbox print "Inbox name is:", inbox.Name print "Number of messages:", inbox.Messages.Count for i in range(inbox.Messages.Count): message = inbox.Messages.Item(i + 1) objSender = message.Sender.Address objRecip = message.Recipients.Item(j+1) Now here I want to access the modification time of each mail. And if possible if you can guide me to a place where I can get the elements of that message object, that would be helpful. Please mail back for further information. Thanks in advance, Venu. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau.com Tue Nov 25 07:34:13 2008 From: mc at mclaveau.com (Michel Claveau) Date: Tue, 25 Nov 2008 07:34:13 +0100 Subject: [python-win32] Use Python DCOM object without having pythoninstalled locally In-Reply-To: References: Message-ID: <937F42BC6A2C483E99966413398B97EA@MCI1330> Hi! > What is missing now? Python & PyWin32 @-salutations -- Michel Claveau From joelbryan.juliano at gmail.com Tue Nov 25 12:16:55 2008 From: joelbryan.juliano at gmail.com (Joel Bryan Juliano) Date: Tue, 25 Nov 2008 19:16:55 +0800 Subject: [python-win32] Simple context-menu question. Message-ID: Based on the context_menu.py example found in win32comext\shell\demos\servers\context_menu.py, there is a function callback when an item is chosen, def InvokeCommand(self, ci): mask, hwnd, verb, params, dir, nShow, hotkey, hicon = ci win32gui.MessageBox(hwnd, "Hello", "Wow", win32con.MB_OK) My question is how can I get the current names of the "MenuName > SubMenuName > SubItemName" when InvokeCommand is called? I apologize if this may sound like a dumb question, I'm really new to win32/COM programming.. My approach is when I get the names, I can easily call a function for them, since the subitems are dynamic and always changing. From ricercar at infinito.it Tue Nov 25 16:32:54 2008 From: ricercar at infinito.it (ricercar at infinito.it) Date: Tue, 25 Nov 2008 16:32:54 +0100 Subject: [python-win32] COM server and pointer to pointer parameter Message-ID: At 09.35 13/11/2008 +1100, you wrote: >That is another clue that makes me think the marshaller might be involved. >Have you changed pippo to only support out-of-process registration? >Cheers, >Mark Sorry for replying late, I had some problems and I could not do tests on pippo_server before. Well the situation is this: - on Windows Vista everything is working fine (python 2.5) - on XP and 2K the QueryInterface with iid to NULL is always called. I tried to set _reg_clsctx to both CLSCTX_LOCAL_SERVER and CLSCTX_INPROC_SERVER without success. The messages have minimal differences but the result is that Method1 fails. At this point I don't known what to test and don't know what are the differences between the OSes. with _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER {1C733A30-2A1C-11CE-ADE5-00AA0044773D} in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) {F1A3CC2E-4B2A-4A81-992D-67862076949B} Object with win32trace dispatcher created (object=) {00000000-0000-0000-0000-000000000000} Traceback (most recent call last): File "C:Python25libsite-packageswin32comserverdispatcher.py", line 41, in _QueryInterface_ return self.policy._QueryInterface_(iid) File "C:Python25libsite-packageswin32comserverpolicy.py", line 261, in _QueryInterface_ print iid com_error: (-2147221005, "Stringa dell'interfaccia non valida.", None, None) pythoncom error: Failed to call the universal dispatcher Traceback (most recent call last): File "C:Python25libsite-packageswin32comuniversal.py", line 193, in dispatch WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) : (-2147467262, 'Interfaccia non supportata.', None, None) {1C733A30-2A1C-11CE-ADE5-00AA0044773D} in ._QueryInterface_ with unsupported IID {1C733A30-2A1C-11CE-ADE5-00AA0044773D} ({1C733A30-2A1C-11CE-ADE5-00AA0044773D}) -------------- without _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER Object with win32trace dispatcher created (object=) {00000000-0000-0000-0000-000000000000} Traceback (most recent call last): File "C:Python25libsite-packageswin32comserverdispatcher.py", line 41, in _QueryInterface_ return self.policy._QueryInterface_(iid) File "C:Python25libsite-packageswin32comserverpolicy.py", line 261, in _QueryInterface_ print iid com_error: (-2147221005, "Stringa dell'interfaccia non valida.", None, None) pythoncom error: Failed to call the universal dispatcher Traceback (most recent call last): File "C:Python25libsite-packageswin32comuniversal.py", line 193, in dispatch WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) : (-2147467262, 'Interfaccia non supportata.', None, None) Traceback (most recent call last): File "pippo-test.py", line 21, in p = obj.Method1() _ctypes.COMError: COMError(0x80004005, 'Errore non specificato.', (None, None, None, 0, None)) Best regards, Enrico From quesada at gmail.com Tue Nov 25 16:46:43 2008 From: quesada at gmail.com (Jose Quesada) Date: Tue, 25 Nov 2008 16:46:43 +0100 Subject: [python-win32] rdflib install fails Message-ID: Hi all, I'm new to python. I'm trying to install rdflib. It needs to compile some C code, so it relies on cywin/gcc. It seems that it doesn't like something in my system. Here is the error: invalid version number '2.18.50.20080625' I have no idea what software this version number is about. Can you help? I have pasted the full command used and error log. Thanks a lot, -Jose E:\install\rdflib-read-only>easy_install -U "rdflib>=2.4,<=3.0a" Traceback (most recent call last): File "E:\Python25\Scripts\easy_install-script.py", line 8, in load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')() File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 1671, in main with_ei_usage(lambda: File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 1659, in with_ei_usa ge return f() File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 1675, in distclass=DistributionWithoutHelpCommands, **kw File "E:\Python25\lib\distutils\core.py", line 151, in setup dist.run_commands() File "E:\Python25\lib\distutils\dist.py", line 974, in run_commands self.run_command(cmd) File "E:\Python25\lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 211, in run self.easy_install(spec, not self.no_deps) File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 476, in install_item dists = self.install_eggs(spec, download, tmpdir) File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 655, in install_eggs return self.build_and_install(setup_script, setup_base) File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 930, in build_and_in stall self.run_setup(setup_script, setup_base, args) File "e:\python25\lib\site-packages\setuptools\command\easy_install.py", line 919, in run_setup run_setup(setup_script, args) File "E:\Python25\Lib\site-packages\setuptools\sandbox.py", line 27, in run_setup lambda: execfile( File "E:\Python25\Lib\site-packages\setuptools\sandbox.py", line 63, in run return func() File "E:\Python25\Lib\site-packages\setuptools\sandbox.py", line 29, in {'__file__':setup_script, '__name__':'__main__'} File "setup.py", line 56, in File "E:\Python25\lib\distutils\core.py", line 151, in setup dist.run_commands() File "E:\Python25\lib\distutils\dist.py", line 974, in run_commands self.run_command(cmd) File "E:\Python25\lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "e:\python25\lib\site-packages\setuptools\command\bdist_egg.py", line 174, in run cmd = self.call_command('install_lib', warn_dir=0) File "e:\python25\lib\site-packages\setuptools\command\bdist_egg.py", line 161, in call_command self.run_command(cmdname) File "E:\Python25\lib\distutils\cmd.py", line 333, in run_command self.distribution.run_command(command) File "E:\Python25\lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "e:\python25\lib\site-packages\setuptools\command\install_lib.py", line 20, in run self.build() File "E:\Python25\lib\distutils\command\install_lib.py", line 112, in build self.run_command('build_ext') File "E:\Python25\lib\distutils\cmd.py", line 333, in run_command self.distribution.run_command(command) File "E:\Python25\lib\distutils\dist.py", line 994, in run_command cmd_obj.run() File "e:\python25\lib\site-packages\setuptools\command\build_ext.py", line 46, in run _build_ext.run(self) File "E:\Python25\lib\distutils\command\build_ext.py", line 264, in run force=self.force) File "E:\Python25\lib\distutils\ccompiler.py", line 1175, in new_compiler return klass (None, dry_run, force) File "E:\Python25\lib\distutils\cygwinccompiler.py", line 292, in __init__ CygwinCCompiler.__init__ (self, verbose, dry_run, force) File "E:\Python25\lib\distutils\cygwinccompiler.py", line 84, in __init__ get_versions() File "E:\Python25\lib\distutils\cygwinccompiler.py", line 424, in get_versions ld_version = StrictVersion(result.group(1)) File "E:\Python25\lib\distutils\version.py", line 40, in __init__ self.parse(vstring) File "E:\Python25\lib\distutils\version.py", line 107, in parse raise ValueError, "invalid version number '%s'" % vstring ValueError: invalid version number '2.18.50.20080625' -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.andrew.cmu.edu/~jquesada From quesada at gmail.com Tue Nov 25 17:04:06 2008 From: quesada at gmail.com (Jose Quesada) Date: Tue, 25 Nov 2008 17:04:06 +0100 Subject: [python-win32] nevermind, I found the solution: Message-ID: http://boodebr.org/main/python/build-windows-extensions Update: 2008-09-10 Recent versions of Cygwin binutils have version numbers that are breaking the version number parsing, resulting in errors like: ValueError: invalid version number '2.18.50.20080625' To fix this, edit distutils/version.py. At line 100, replace: version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE) with version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? (\. (\d+))?$', re.VERBOSE) Thanks! -- Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.andrew.cmu.edu/~jquesada From timr at probo.com Tue Nov 25 18:33:23 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 25 Nov 2008 09:33:23 -0800 Subject: [python-win32] Simple context-menu question. In-Reply-To: References: Message-ID: <492C36E3.6050908@probo.com> Joel Bryan Juliano wrote: > Based on the context_menu.py example found in > win32comext\shell\demos\servers\context_menu.py, there is a function > callback when an item is chosen, > > def InvokeCommand(self, ci): > mask, hwnd, verb, params, dir, nShow, hotkey, hicon = ci > win32gui.MessageBox(hwnd, "Hello", "Wow", win32con.MB_OK) > > My question is how can I get the current names of the "MenuName > > SubMenuName > SubItemName" when InvokeCommand is called? I apologize > if this may sound like a dumb question, I'm really new to win32/COM > programming.. My approach is when I get the names, I can easily call a > function for them, since the subitems are dynamic and always changing. > You can't get the names. What you get is the menu identifier (idCmd in the sample) of the item that was clicked, as the "verb" -- the 3rd member of the tuple you get in InvokeCommand. It's up to you to assign a meaning to that identifier. The Win32 menu handling doesn't track the menu "tree". The tree is only meaningful for display. It only notifies you that a menu item was clicked. I would also caution you that it is not good practice to create deeply nested context menus. It makes for a very confusing user experience. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Tue Nov 25 18:41:17 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 25 Nov 2008 09:41:17 -0800 Subject: [python-win32] Fwd: Accessing Modification Time of an Outlook Mail in Python In-Reply-To: References: <8358786d-ccbf-4626-beb8-26dba0c7b72b@v13g2000yqm.googlegroups.com> Message-ID: <492C38BD.7090605@probo.com> venu madhav wrote: > > Hi all, > I am writing a small application which reads the contents of an > Outlook Mail using python. I am able to read the contents, subject > along with senders and receivers of a mail using MAPI objects. But may > I know how can I get access to the "modification time" or the > receiving time of an outlook mail in Python. For the others I have > used message object of MAPI session. http://msdn.microsoft.com/en-us/library/ms526861.aspx You should be able to fetch message.TimeLastModified, but be aware that email messages do not really have a "modification time". The only thing they have is the "Date:" header, which is really the creation time (message.TimeCreated). -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mdriscoll at co.marshall.ia.us Tue Nov 25 19:05:19 2008 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 25 Nov 2008 12:05:19 -0600 Subject: [python-win32] Simple context-menu question. In-Reply-To: <492C36E3.6050908@probo.com> References: <492C36E3.6050908@probo.com> Message-ID: <492C3E5F.20407@co.marshall.ia.us> Tim Roberts wrote: > Joel Bryan Juliano wrote: > >> Based on the context_menu.py example found in >> win32comext\shell\demos\servers\context_menu.py, there is a function >> callback when an item is chosen, >> >> def InvokeCommand(self, ci): >> mask, hwnd, verb, params, dir, nShow, hotkey, hicon = ci >> win32gui.MessageBox(hwnd, "Hello", "Wow", win32con.MB_OK) >> >> My question is how can I get the current names of the "MenuName > >> SubMenuName > SubItemName" when InvokeCommand is called? I apologize >> if this may sound like a dumb question, I'm really new to win32/COM >> programming.. My approach is when I get the names, I can easily call a >> function for them, since the subitems are dynamic and always changing. >> >> > > You can't get the names. What you get is the menu identifier (idCmd in > the sample) of the item that was clicked, as the "verb" -- the 3rd > member of the tuple you get in InvokeCommand. It's up to you to assign > a meaning to that identifier. The Win32 menu handling doesn't track the > menu "tree". The tree is only meaningful for display. It only notifies > you that a menu item was clicked. > > I would also caution you that it is not good practice to create deeply > nested context menus. It makes for a very confusing user experience. > > And if you "really" need to know the names in the menus then you should just design your own using a Python GUI toolkit, like Tkinter or wxPython. Mike From timr at probo.com Tue Nov 25 20:13:36 2008 From: timr at probo.com (Tim Roberts) Date: Tue, 25 Nov 2008 11:13:36 -0800 Subject: [python-win32] Simple context-menu question. In-Reply-To: <492C3E5F.20407@co.marshall.ia.us> References: <492C36E3.6050908@probo.com> <492C3E5F.20407@co.marshall.ia.us> Message-ID: <492C4E60.9080906@probo.com> Mike Driscoll wrote: > Tim Roberts wrote: >> Joel Bryan Juliano wrote: >> >>> >>> My question is how can I get the current names of the "MenuName > >>> SubMenuName > SubItemName" when InvokeCommand is called? >> >> I would also caution you that it is not good practice to create deeply >> nested context menus. It makes for a very confusing user experience. > > And if you "really" need to know the names in the menus then you > should just design your own using a Python GUI toolkit, like Tkinter > or wxPython. Well, he's working on a shell extension plugin here. The message loop belongs to Windows Explorer, and events are delivered through COM server callbacks. I'm not convinced it can be mated to either wx or Tkinter. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Dave.Cross at cdl.co.uk Tue Nov 25 16:29:11 2008 From: Dave.Cross at cdl.co.uk (Dave Cross) Date: Tue, 25 Nov 2008 15:29:11 -0000 Subject: [python-win32] Win32Cred build errors Message-ID: <3C1CBB29A3D34C479B570500C7A73F2906C80803@cdlms2.cheshdatasys.co.uk> Hi all/anybody, Win32credmodule.cpp for pywin32 2.5.212.1 insists on finding a header with #define _WIN32_WINNT 0x501 in it. The WinResrc.h file that comes with Microsoft Platform SDK for Windows Server 2003 R2 is only 0x500 so the build fails. As far as I can see, though, this version of the SDK contains the latest WinCred.h stuff and should work OK. Is this a genuine dependency or a typo? If 501 is required, which SDK(s) support it? Regards, Dave. ******************************************************************************** Please consider the environment - do you really need to print this email? This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright ? CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment. Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD Registered in England and Wales with Company Number 3991057 VAT registration : 727 1188 33 ****************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Tue Nov 25 22:30:15 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 26 Nov 2008 08:30:15 +1100 Subject: [python-win32] Win32Cred build errors In-Reply-To: <3C1CBB29A3D34C479B570500C7A73F2906C80803@cdlms2.cheshdatasys.co.uk> References: <3C1CBB29A3D34C479B570500C7A73F2906C80803@cdlms2.cheshdatasys.co.uk> Message-ID: <038b01c94f45$06395c50$12ac14f0$@com.au> I can't recall why we say we need that version - have you tried changing it to see what breaks? Currently the vista SDK needs to be used as some partf of pywin32 are starting to expose things introduced with that OS. Cheers, Mark From: python-win32-bounces+skippy.hammond=gmail.com at python.org [mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf Of Dave Cross Sent: Wednesday, 26 November 2008 2:29 AM To: python-win32 at python.org Subject: [python-win32] Win32Cred build errors Hi all/anybody, Win32credmodule.cpp for pywin32 2.5.212.1 insists on finding a header with #define _WIN32_WINNT 0x501 in it. The WinResrc.h file that comes with Microsoft Platform SDK for Windows Server 2003 R2 is only 0x500 so the build fails. As far as I can see, though, this version of the SDK contains the latest WinCred.h stuff and should work OK. Is this a genuine dependency or a typo? If 501 is required, which SDK(s) support it? Regards, Dave. **************************************************************************** **** Please consider the environment - do you really need to print this email? This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright C CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment. Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD Registered in England and Wales with Company Number 3991057 VAT registration : 727 1188 33 **************************************************************************** ** -------------- next part -------------- An HTML attachment was scrubbed... URL: From waldemar.osuch at gmail.com Wed Nov 26 02:24:02 2008 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Tue, 25 Nov 2008 18:24:02 -0700 Subject: [python-win32] rdflib install fails In-Reply-To: References: Message-ID: <6fae95540811251724l4d65ef66v8a322513873e67af@mail.gmail.com> On Tue, Nov 25, 2008 at 8:46 AM, Jose Quesada wrote: > Hi all, > > I'm new to python. > I'm trying to install rdflib. It needs to compile some C code, so it relies > on cywin/gcc. > It seems that it doesn't like something in my system. Here is the error: > > invalid version number '2.18.50.20080625' > > I have no idea what software this version number is about. Can you help? > > I have pasted the full command used and error log. > > Thanks a lot, > -Jose > I am not sure what the error means If you are interested here is a version compiled for Python25. http://www.osuch.org/rdflib-2.4.0.win32-py2.5.exe I have MinGW configured on my machine. That is what made the difference. Waldemar From opekar at eccam.com Thu Nov 27 09:37:12 2008 From: opekar at eccam.com (Vaclav Opekar) Date: Thu, 27 Nov 2008 09:37:12 +0100 Subject: [python-win32] vtable interface implementation in python Message-ID: <492E5C38.3040008@eccam.com> Hi all, Since I'm trying to avoid writing C++ glue code for my python application, I was wondering whether it's possible to implement vtable interface in python. From IDL file I've generated a TLB, from TLB I've generated a python stub using makepy. I got .py file with vtable description like IDocHostUIHandler_vtables_dispatch_ = 0 IDocHostUIHandler_vtables_ = [ (( u'ShowContextMenu' , u'dwID' , u'ppt' , u'pcmdtReserved' , u'pdispReserved' , ), 1610678272, (1610678272, (), [ (19, 1, None, None) , (36, 1, None, None) , (13, 1, None, None) , (9, 1, None, None) , ], 1 , 1 , 4 , 0 , 12 , (3, 0, None, None) , 0 , )), ...... Can I do the implementation of this interface in python using above? The implementation the would be then passesed to other COM object. Regards, Vaclav From opekar at eccam.com Thu Nov 27 09:26:48 2008 From: opekar at eccam.com (Vaclav Opekar) Date: Thu, 27 Nov 2008 09:26:48 +0100 Subject: [python-win32] OnBeforeNavigate2 - resolution and a question Message-ID: <492E59C8.2030905@eccam.com> Hello all, some time ago was trying to implement OnBeforeNavigate2 callback in python. (DWebBrowserEvents2 - http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx) BeforeNavigate2 has 7 parameters, 1 marked as [in,out] and the rest 6 as [in] only. The one out parameter (Cancel) controls whether page will be navigated to or not, depending what you return. This definition come straight to following implementation. (which doesnt work) #this version doesnt work def OnBeforeNavigate2(self, pDisp, .... Cancel): print URL if self.pageNotAllowed(URL): return True #do not navigate there return False #Navigate there After some debugging of pywin32 package, I found that not only the 1 param is passed by variant "by_ref" but 6 of them, even if the parameters are not "out" parameters my IE uses them as "by_ref" #this version works fine def OnBeforeNavigate2(self, pDisp, .... Cancel): print URL if self.pageNotAllowed(URL): return None, None, None, None, None, True return None, None, None, None, None, False Question: If I understand correctly this python callback implementation is IE implementation dependent. If some new version of IE will start to call this callback with [lets say]4 "by_ref" params only. Then this will stop work. Is it possible to write python code independent of number "by_ref" parameters passed? Thanks, Vaclav From Dave.Cross at cdl.co.uk Thu Nov 27 11:34:47 2008 From: Dave.Cross at cdl.co.uk (Dave Cross) Date: Thu, 27 Nov 2008 10:34:47 -0000 Subject: [python-win32] Win32Cred build errors In-Reply-To: <038b01c94f45$06395c50$12ac14f0$@com.au> References: <3C1CBB29A3D34C479B570500C7A73F2906C80803@cdlms2.cheshdatasys.co.uk> <038b01c94f45$06395c50$12ac14f0$@com.au> Message-ID: <3C1CBB29A3D34C479B570500C7A73F2906CC8A81@cdlms2.cheshdatasys.co.uk> Thanks Mark, >From the web page for the SDK I have. "This release of the SDK is intended to replace the Windows SDK for Vista." But this only appears to be 0x500 rather than 0x501. Hence my confusion. I get further confused when resetting the #define in win32credmodule.cpp has no effect. What's it there for? I had to debug setup.py to find the culprit and downgrade the windows_h_version required. Now win32cred builds OK, (no idea if it works but we'll ignore that for now) and my next problem is either missing files or missing variables depending on which of the three different, post Vista, SDK's I select. Along the way I've discovered far more than I ever wished to know about how setup.py and MSVC search directories and I have settled on using the MSSDK environment variable to attempt to synchronise them - again I don't know if it works because there doesn't seem to be a 'verbose' mode for setup.py. I appreciate that second guessing how MS names it's SDK's and where they get (randomly) installed is a mug's game so why attempt to duplicate and track it in setup.py? Surely trapping any MSVC errors and reporting them back would suffice? Even if I achieve a build, I'm not convinced that I'll be much better off. I find that one of the key benefits of building a project in the MSVC environment is that I can use 'goto definition' to unravel the structure of other peoples code. I'm deliberately lazy when getting to grips with 'new' stuff; I have enough to keep in my head about my own projects so all I want to know about the new stuff is 'Is it going to help me or hinder me?' and I want to find out with the minimum fuss and effort. I have to say that I'm disappointed with Pywin32 in that respect.so far.Almost everything I have tried to do, right from finding and downloading the sources has been less than obvious. What would help is: 1) certainty about exactly which MS SDK(s) are required including dates and recent URL's. 2) MSVC solutions, if not for all projects, at least for the major ones. 3) An idiots guide to the structure, both physical and logical. I'd like this to work, I really would, the alternative for me is Eclipse! Regards, Dave. ________________________________ From: Mark Hammond [mailto:skippy.hammond at gmail.com] On Behalf Of Mark Hammond Sent: 25 November 2008 21:30 To: Dave Cross; python-win32 at python.org Subject: RE: [python-win32] Win32Cred build errors I can't recall why we say we need that version - have you tried changing it to see what breaks? Currently the vista SDK needs to be used as some partf of pywin32 are starting to expose things introduced with that OS. Cheers, Mark From: python-win32-bounces+skippy.hammond=gmail.com at python.org [mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf Of Dave Cross Sent: Wednesday, 26 November 2008 2:29 AM To: python-win32 at python.org Subject: [python-win32] Win32Cred build errors Hi all/anybody, Win32credmodule.cpp for pywin32 2.5.212.1 insists on finding a header with #define _WIN32_WINNT 0x501 in it. The WinResrc.h file that comes with Microsoft Platform SDK for Windows Server 2003 R2 is only 0x500 so the build fails. As far as I can see, though, this version of the SDK contains the latest WinCred.h stuff and should work OK. Is this a genuine dependency or a typo? If 501 is required, which SDK(s) support it? Regards, Dave. ************************************************************************ ******** Please consider the environment - do you really need to print this email? This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright (c) CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment. Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD Registered in England and Wales with Company Number 3991057 VAT registration : 727 1188 33 ************************************************************************ ****** -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Thu Nov 27 12:40:10 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 27 Nov 2008 22:40:10 +1100 Subject: [python-win32] vtable interface implementation in python In-Reply-To: <492E5C38.3040008@eccam.com> References: <492E5C38.3040008@eccam.com> Message-ID: <047a01c95084$ea810940$bf831bc0$@com.au> > Can I do the implementation of this interface in python using above? > The implementation the would be then passesed to other COM object. That should be fine - check out "*pippo*" in the win32com directory for some examples... Cheers, Mark From mhammond at skippinet.com.au Thu Nov 27 12:40:10 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 27 Nov 2008 22:40:10 +1100 Subject: [python-win32] OnBeforeNavigate2 - resolution and a question In-Reply-To: <492E59C8.2030905@eccam.com> References: <492E59C8.2030905@eccam.com> Message-ID: <047b01c95084$ebfe8180$c3fb8480$@com.au> > Question: > If I understand correctly this python callback implementation is IE > implementation dependent. If some new version of IE will start to call > this callback with [lets say]4 "by_ref" params only. Then this will > stop work. > > Is it possible to write python code independent of number "by_ref" > parameters passed? In that case, a new interface will be defined, so assuming IE continues to support the old interfaces (which it generally does), there is no problem. Cheers, Mark From mhammond at skippinet.com.au Thu Nov 27 23:31:27 2008 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri, 28 Nov 2008 09:31:27 +1100 Subject: [python-win32] Win32Cred build errors In-Reply-To: <3C1CBB29A3D34C479B570500C7A73F2906CC8A81@cdlms2.cheshdatasys.co.uk> References: <3C1CBB29A3D34C479B570500C7A73F2906C80803@cdlms2.cheshdatasys.co.uk> <038b01c94f45$06395c50$12ac14f0$@com.au> <3C1CBB29A3D34C479B570500C7A73F2906CC8A81@cdlms2.cheshdatasys.co.uk> Message-ID: <04b001c950df$e6095470$b21bfd50$@com.au> > From the web page for the SDK I have. "This release of the SDK is intended to > replace the Windows SDK for Vista." > But this only appears to be 0x500 rather than 0x501. > Hence my confusion. There is some confusion regarding these versions. In the Vista SDK, you will find declarations along the lines of: ObjBase.h:#define _WIN32_WINNT 0x0600 ... WinResrc.h:#define _WIN32_WINNT 0x0500 WinSDKVer.h:#define _WIN32_WINNT_MAXVER 0x0600 I hope you will not hold me responsible for what you find in the SDKs, but win32cred should certainly build in any recent version. > I get further confused when resetting the #define in win32credmodule.cpp > has no effect. What's it there for? > I had to?debug setup.py?to find the culprit and downgrade the > windows_h_version required. This is a side effect of when we used Visual Studio project files. Unfortunately, one of the main contributors still uses these project files, so I'm reluctant to kill them entirely - but that would allow us to rationalize all management of this macro into setup.py. A Python based build process has *far* more flexibility. ? > Now win32cred builds OK, (no idea if it works but we'll ignore that for now) and my next problem > is either missing files or missing variables depending on which of the three different, > post Vista, SDK's I select. I think I too have failed with a post-vista SDK, particularly trying to use VS6 against it. ? > I appreciate that second guessing how MS names it's SDK's and where they get > (randomly)?installed is a mug's game?so why attempt to duplicate and track > it in setup.py? Unfortunately, distutils started this "mugs game" by allowing you to build extensions even when your environment is not set for that compiler. Indeed, the same cmdprompt environment can build for all supported compilers without any environment changes. So we also need to add the SDK to your environment. Worse, many of the visual studio versions come with their own SDK, and that SDK pointedly will *not* work for our purpose. If you ever needed to build for multiple Python versions which span multiple compilers, you would appreciate this is a large benefit. > Surely trapping any MSVC errors and reporting them back would suffice? But surely that would then have you complaining about the compiler errors - ie, exactly how this thread started? > Even if I achieve a build, I'm not convinced that I'll be much better off. Agreed - making your own build doesn't leave you any better off than using pre-built binaries. What are you trying to achieve exactly? > I find that one of the key benefits of?building a project in the MSVC environment is that I can use > 'goto definition' to?unravel the structure of other peoples code. I'm not sure how this is relevant. You are advocating I move back to a visual studio build environment? Which version exactly? I currently support 3 different MS compilers, with one of those compilers supporting 64bit builds, but Python itself doesn't "officially" support 32 and 64bit versions installed on the same machine. ? > I'm deliberately lazy?when getting to grips with 'new' stuff; So why are you putting yourself through this pain? :) > Almost everything I have tried to do, right from finding and downloading the > sources?has been less than obvious. I'm not sure this is a reasonable critisism - surely sourceforge makes it fairly obvious how to download either the .zip source distro, or the CVS trunk. What do you recommend I do to improve this? ? > What would help is: > 1) certainty about exactly which MS SDK(s) are required including dates and recent URL's. This is too much of a moving target, especially when trying to get MSVC6 to work with them, given the number of people who actually build from source. I do try to keep the (large!) docstring in setup.py up to date, and for a while even included download links in it - but I found the MS download links went stale quicker than I needed to change SDKS! > 2) MSVC?solutions, if not for all projects, at least for the major ones. I think you will find they already exist - but please keep in mind that the version of VS you choose to use is not the same one that can be used to build all supported versions. But to even more pointed - assuming I personally do not use the VS projects, why on earth should I spend time maintaining them on the off chance someone will come along in the future, complain about a module not building, then complain about not having visual studio project files available for them? What about when the next person comes along and makes the point he is far more productive with a make/ant/cons based build system, so therefore I should supply one of them too? > I'd like this to work, I really would Have you tried a binary? > the alternative for me is Eclipse! Heh - well, I'm very sorry you are having these problems, but if a few issues building a particular complicated Python extension from source would be enough to send you that far over the edge and into a completely different language, it may well be worth reevaluating your requirements and exactly what you are trying to achieve. It might also be worth considering exactly how you would use the functionality of the win32cred module in that environment (and indeed, if you could build such functionality from source yourself), otherwise your comparison isn't fair. Good luck! Cheers, Mark From theller at ctypes.org Fri Nov 28 21:46:00 2008 From: theller at ctypes.org (Thomas Heller) Date: Fri, 28 Nov 2008 21:46:00 +0100 Subject: [python-win32] Does Python need a native Windows GUI toolkit? Message-ID: Does Python need a native, pure Python, Windows GUI toolkit, one that uses win32 api calls directly to use native windows controls? Or would that development be a waste of resources, in these days of of Python.NET, Windows forms, IronPython, (and last, not least, wxPython and all these other toolkits)? Or are desktop applications too rare now? Several years ago I started using wxPython (it is probably a lot more mature now) to write some simple programs and was not really pleased. It looked too much like MFC to me. I know that there are now several wrappers over wxPython (althogh I have not used them) like Pythoncard or newer ones like dabo (from what I hear). There have also been other attempts to make nicer interfaces for wxPython which have vanished nowadays. Somehow I have the impression that the approach to put layer over layer over layer is wrong (wxWindows C++ layer, wxPython SWIG layer, Pythoncard/Dabo/whatever python layer). So, I started writing my own framework, also several years ago. I used ctypes (early versions) to call the win32 api directly, and it was fun and it worked out great. I have my own form editor, I can also construct windows, dialogs, menus, and so on with simple high level code. But also it is possible even at the 'highest level' to directly reach out to the win32 api, or to handle WM_xxx messages directly if the need arises. However, this framework is showing its age because during all this time I developed some new approaches to make the work easier (for example first I wrote the win32 plumbing code manually, now I have tools that automatically generate the code to access constants, define structure definitions, or generate function prototypes from the windows header files. Also the framework too much relies on manual conversions between byte and unicode strings. So, the question is: Are there people that share these ideas? Are they willing to join a coordinated effort to develop a framework like this, using the current and future Python versions, and all the fancy new features of Python? No promises, but I'm curious for the thoughts on this. -- Thanks, Thomas From stef.mientki at gmail.com Fri Nov 28 21:55:28 2008 From: stef.mientki at gmail.com (Stef Mientki) Date: Fri, 28 Nov 2008 21:55:28 +0100 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: References: Message-ID: <49305AC0.3050902@gmail.com> Don't most people nowadays wants, and maybe even needs, OS-independant applications ? cheers (from a happy wxPython user, formely a happy Delphi user ;-) Stef Mientki Thomas Heller wrote: > Does Python need a native, pure Python, Windows GUI toolkit, one that uses > win32 api calls directly to use native windows controls? > > Or would that development be a waste of resources, in these days of > of Python.NET, Windows forms, IronPython, (and last, not least, wxPython > and all these other toolkits)? Or are desktop applications too rare now? > > > Several years ago I started using wxPython (it is probably a lot more > mature now) to write some simple programs and was not really pleased. > It looked too much like MFC to me. I know that there are now several > wrappers over wxPython (althogh I have not used them) like Pythoncard > or newer ones like dabo (from what I hear). There have also been other > attempts to make nicer interfaces for wxPython which have vanished nowadays. > Somehow I have the impression that the approach to put layer over layer over layer > is wrong (wxWindows C++ layer, wxPython SWIG layer, Pythoncard/Dabo/whatever > python layer). > > So, I started writing my own framework, also several years ago. I used > ctypes (early versions) to call the win32 api directly, and it was fun > and it worked out great. > I have my own form editor, I can also construct windows, dialogs, > menus, and so on with simple high level code. But also it is possible > even at the 'highest level' to directly reach out to the win32 api, or > to handle WM_xxx messages directly if the need arises. > > However, this framework is showing its age because during all this time > I developed some new approaches to make the work easier (for example first > I wrote the win32 plumbing code manually, now I have tools that automatically > generate the code to access constants, define structure definitions, or generate > function prototypes from the windows header files. Also the framework too much > relies on manual conversions between byte and unicode strings. > > So, the question is: Are there people that share these ideas? > Are they willing to join a coordinated effort to develop a framework > like this, using the current and future Python versions, and all the fancy > new features of Python? > > No promises, but I'm curious for the thoughts on this. > > From theller at ctypes.org Fri Nov 28 21:59:32 2008 From: theller at ctypes.org (Thomas Heller) Date: Fri, 28 Nov 2008 21:59:32 +0100 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: <49305AC0.3050902@gmail.com> References: <49305AC0.3050902@gmail.com> Message-ID: Stef Mientki schrieb: > Don't most people nowadays wants, and maybe even needs, OS-independant > applications ? Sure. But I assume that still quite a lot of people do NOT care about x-platform compatibility for their applications. Thomas From mc at mclaveau.com Fri Nov 28 23:54:45 2008 From: mc at mclaveau.com (Michel Claveau) Date: Fri, 28 Nov 2008 23:54:45 +0100 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: References: Message-ID: <3BC29EFDE22E42409C009054DCCCAC6F@MCI1330> Hi! Perso, I use a HTML-GUI (with Python => PyWin32 => IE+Jscript library). It is self-important for me, and enough fun... I had already tried: - Autoit + Python: very good, but a little bit bizarre architecture - Kixform (an ActiveX GUI) ; very easy, but not rather complete - WPF (dotNET), via a "bridge" in JScript.Net ; not easy to develop - HTA + PythonScript (Python like ActiveScripting language) ; easy, fun ; but don't run with IE-8 (& install not easy). Other ways which I would have wanted to test (if I had had the time): - AIR - Flash - Silverlight: the (next futur) standalone client. But, if you create another solution, I will look with very attention... @-salutations -- Michel Claveau From simon.dahlbacka at gmail.com Fri Nov 28 23:59:06 2008 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Sat, 29 Nov 2008 00:59:06 +0200 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: References: Message-ID: <57124720811281459w444540b0uc86d062d1ffc6e93@mail.gmail.com> On Fri, Nov 28, 2008 at 10:46 PM, Thomas Heller wrote: > Does Python need a native, pure Python, Windows GUI toolkit, one that uses > win32 api calls directly to use native windows controls? How does it differ from http://venster.sourceforge.net/ ? From stef.mientki at gmail.com Sat Nov 29 00:16:07 2008 From: stef.mientki at gmail.com (Stef Mientki) Date: Sat, 29 Nov 2008 00:16:07 +0100 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: <57124720811281459w444540b0uc86d062d1ffc6e93@mail.gmail.com> References: <57124720811281459w444540b0uc86d062d1ffc6e93@mail.gmail.com> Message-ID: <49307BB7.50201@gmail.com> Simon Dahlbacka wrote: > On Fri, Nov 28, 2008 at 10:46 PM, Thomas Heller wrote: > >> Does Python need a native, pure Python, Windows GUI toolkit, one that uses >> win32 api calls directly to use native windows controls? >> > > How does it differ from http://venster.sourceforge.net/ ? > Ok that's a very good reason for a windows platform, because most mobile devices in my country are Win-Mobile. AFAIK venster is replaced by PocketPyGUI, and Alexandre Delattre was working on a general (not Mobile) version of this. cheers, Stef > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From mail at microcorp.co.za Sat Nov 29 19:29:41 2008 From: mail at microcorp.co.za (Hendrik van Rooyen) Date: Sat, 29 Nov 2008 20:29:41 +0200 Subject: [python-win32] Does Python need a native Windows GUI toolkit? References: Message-ID: <009401c95250$7cb27020$0d00a8c0@hendrik> Thomas Heller wrote: > Does Python need a native, pure Python, Windows GUI toolkit, one that uses > win32 api calls directly to use native windows controls? > > Or would that development be a waste of resources, in these days of > of Python.NET, Windows forms, IronPython, (and last, not least, wxPython > and all these other toolkits)? Or are desktop applications too rare now? > My own work is only peripherally involved with windows stuff. However, in the last few weeks, I got involved in a maintenance job where the original author had used the Boa Constructor IDE. My reaction, as I got into using the thing, has been positive - it enables someone like me, who's GUI experience has been limited to tkinter stuff, to actually use wxPython , which has a vastly greater learning curve. I expected something a little rinky dink, but I was pleasantly surprised - everything that one needs seems to be there, and it all seems solid - the logical bits all work, and even the editor is almost tolerable, although the interactive interpreter could use some enhancing as far as using the history is concerned. So when I read your post, my reaction is: Why would he want to do that? - His time would be better spent polishing Boa up a bit, as it really needs very little to make it a worthy Delphi competitor... 8< -------------------------------------------------------------------- > Somehow I have the impression that the approach to put layer over layer over layer > is wrong (wxWindows C++ layer, wxPython SWIG layer, Pythoncard/Dabo/whatever > python layer). As a broken down assembler programmer, I have a lot of sympathy with this view - the stuff is already all too horribly complicated, and a lot of code does not actually do anything other than call other code that calls other code that calls other code... That said, however, I don't really have a solution, as something like wx-widgets represents what looks like man years of effort, which would be folly to attempt to duplicate, just for the benefit of cutting out a few calls at run time - it is a lot cheaper nowadays to just buy more processing power and memory. > > So, I started writing my own framework, also several years ago. I used > ctypes (early versions) to call the win32 api directly, and it was fun > and it worked out great. > I have my own form editor, I can also construct windows, dialogs, > menus, and so on with simple high level code. But also it is possible > even at the 'highest level' to directly reach out to the win32 api, or > to handle WM_xxx messages directly if the need arises. > So here is the makings of another Delphi, with by now a heck of a lot of man hours in it. It must be kind of hard to hear me say, sight unseen, that you should throw it away and use or enhance Boa. Nobody likes to hear that kind of thing, as all of us run mainly on ego - hell if you do not have an ego the size of a small country, you will never make it as a programmer... > So, the question is: Are there people that share these ideas? > Are they willing to join a coordinated effort to develop a framework > like this, using the current and future Python versions, and all the fancy > new features of Python? > > No promises, but I'm curious for the thoughts on this. If you had asked this Question a month or so ago, I would have been more in favour of it than what I am today - and all because I have in the intervening time, been forced into a nodding acquaintance with Boa. Maybe you should look at Boa and see if you can tinker with it a little- somebody with your level of skill could probably make it a lot slicker than what it already is - I am conjecturing, but it may be possible, if you know the platform is windows, to cut out some of the repetitive calling type stuff referred to above, and go directly to the OS. - Hendrik From greg.ewing at canterbury.ac.nz Sat Nov 29 08:31:50 2008 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sat, 29 Nov 2008 20:31:50 +1300 Subject: [python-win32] Does Python need a native Windows GUI toolkit? In-Reply-To: References: Message-ID: <4930EFE6.5020507@canterbury.ac.nz> Thomas Heller wrote: > Does Python need a native, pure Python, Windows GUI toolkit, one that uses > win32 api calls directly to use native windows controls? I believe so. One of the long-term goals for PyGUI is to give it a native Windows backend. I share your dislike of layers on layers. > Are there people that share these ideas? > Are they willing to join a coordinated effort to develop a framework > like this, Would you be willing to work on a Windows implementation of PyGUI? http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ -- Greg From cappy2112 at gmail.com Sat Nov 29 16:00:27 2008 From: cappy2112 at gmail.com (Tony Cappellini) Date: Sat, 29 Nov 2008 07:00:27 -0800 Subject: [python-win32] Does Python need a native Windows GUI toolkit? Message-ID: <8249c4ac0811290700g40a7297lc9f0a06459cd9f9@mail.gmail.com> First, I feel that Python already has too many GUI toolkits available, and could stand to use some consolidation. I started writing python GUI apps with pyQT,then moved to Pythoncard, and now I use wxPython directly without looking back. I feel that there needs to be much more of a separation between the C++ code and Python than pyQT provides, and I don't feel the "C++" influence when I use wxPython, even though wxWidgets is written in C++ and interfaced with SWIG. I think adding a wrapper just adds more complexity, and there are already several intermediate layers & "form builders" for wx in an attempt to make it easier. Now that Nokia is behind QT it would be interesting to see follow its evolution. I think ones efforts could be better spent working on wx directly, or helping Mark Hammond with Python W32 itself. I've never used MFC, so I can't make the comparison myself, but I've heard Thomas' statement how wx is similar to MFC, from another source. Here are an outdated comparison of some "attempts to make wx easier to use". http://wiki.codeblocks.org/index.php?title=Comparison_of_wxSmith_features. Pythoncard is not listed in the chart above, and that chart is not really a comparison of "intermediate layers". Pythoncard is still popular and could probably stand to be improved. With some time, struggling, and cursing, I have now written a few wx apps from scratch, even using sizers. While I can't do it "second nature" yet, I don't see myself looking at another intermediate layer. wx has come a long way, the documentation is getting much better, and the wxPython list is a great resource for solving problems. Quite a few people have written some new wx components too, but they are not part of the standard distribution. I feel the Python community would benefit much better by not competing with something that has this much momentum (aka developing a native Windows GUI). I actually would rather see new any new GUI-related development efforts going into a community-standardized RAD IDE (aka Delphi-like) environment, as opposed to a seeing a new toolkit/framework come into existence. I have been hoping a company like Microsoft or Google would get behind this effort, more Google than Microsoft. Since I am an advocate for wx, I would really prefer company-backed resources put into a completed Delphi-like IDE for wxPython. I applaud your efforts Thomas whatever the outcome. I know they will benefit the Python community. -------------- next part -------------- An HTML attachment was scrubbed... URL: