From kalpurus at cxbd.com Sun May 2 23:38:41 2004 From: kalpurus at cxbd.com (Azizur Rahman) Date: Sat May 1 04:03:04 2004 Subject: [python-win32] converting a python program into a windows executable (.exe) file Message-ID: <000d01c430da$da196e40$40f7bdcb@aziz> HELLO EVERYONE. I use Python for solving almost all of my programming problems. I work in Windows platform. Unfortunately, Python is not installed on other machines (all windows platform) where I work (Python is only installed on my home computer) and it is not possible to install Python on those machines. So I cannot run my python program on those machines. Is there any way by which I can convert my existing Python code into an .exe (windows executable file) without any modification of the original code (i.e. without any embedding and extending?) THANK YOU ALL a novice -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040503/f79f0072/attachment.html From rasjidw at openminddev.net Sat May 1 06:38:39 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Sat May 1 06:38:53 2004 Subject: [python-win32] converting a python program into a windows executable (.exe) file In-Reply-To: <000d01c430da$da196e40$40f7bdcb@aziz> References: <000d01c430da$da196e40$40f7bdcb@aziz> Message-ID: <200405012038.40085.rasjidw@openminddev.net> On Monday 03 May 2004 13:38, Azizur Rahman wrote: > HELLO EVERYONE. > > I use Python for solving almost all of my programming problems. I work in > Windows platform. Unfortunately, Python is not installed on other machines > (all windows platform) > where I work (Python is only installed on my home computer) and it is not > possible to install Python on those machines. So I cannot run my python > program on those machines. > > Is there any way by which I can convert my existing Python code into an > .exe (windows executable file) without any modification of the original > code (i.e. without any embedding and extending?) Look at py2exe. Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +10 hrs) http://www.openminddev.net From mhammond at skippinet.com.au Sun May 2 06:12:09 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun May 2 06:12:34 2004 Subject: [python-win32] pythoncom.new behavior in build 200/201 In-Reply-To: Message-ID: <026d01c4302d$eeeae6d0$0200a8c0@eden> > Has anyone noticed that pythoncom.new does not behave the > same as it used > to. > Previously one could pass it something like this: > > CLSID = IID('{D5193935-0382-4448-A309-60C38795FB60}') > pythoncom.new( CLSID ) What is IID()? It is possible it is a local function, or not what you think? >>> import pywintypes, pythoncom >>> CLSID = pywintypes.IID('{D5193935-0382-4448-A309-60C38795FB60}') >>> pythoncom.new( CLSID ) Traceback (most recent call last): File "", line 1, in ? com_error: (-2147221164, 'Class not registered', None, None) >>> (Note the exception is because no COM object has that GUID - but the conversion worked and did not raise the TypeError you see. Mark. From osre at freenet.de Sun May 2 08:30:42 2004 From: osre at freenet.de (osre@freenet.de) Date: Sun May 2 08:30:49 2004 Subject: [python-win32] Problems with Python win32Com Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040502/5e39ff7b/attachment.html From mhammond at skippinet.com.au Sun May 2 23:15:10 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun May 2 23:15:47 2004 Subject: [python-win32] Problems with Python win32Com In-Reply-To: Message-ID: <060801c430bc$da7bd530$0200a8c0@eden> Ensure pythoncom is imported before you try and do this - PyRun_SimpleString("import pythoncom\n") may be all you need to do. Once you have done that, use "GetModuleHandle()" rather than LoadLibrary - this will ensure you are using the same module as imported by Python. Mark. -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org]On Behalf Of osre@freenet.de Sent: Sunday, 2 May 2004 10:31 PM To: python-win32@python.org Subject: [python-win32] Problems with Python win32Com Hi, I embedded python-2.3.3 an a scription language to my tool written in VC7. I also installed pywin32-201. Everything works fine, I can load a module and call a Python function from my tool. But the I tryed to use win32com. The Problem: I can not create a PyObject by PyCom_PyObjectFromIUnknown. I always get an access violation. So I builded Python-2.3.3 and pywin32-201 by my self (with some problems) and found out that g_obPyCom_MapIIDToType is NULL. The line: PyObject *createType = PyDict_GetItem(g_obPyCom_MapIIDToType, obiid); in PyCom_PyObjectFromIUnknown pycomhelpers.cpp(92) fails. This means for me that PyCom_RegisterCoreSupport was not called. But I dont know why! I tryed it in two ways: 1. -------------------------------------------------------------------------- -------------------------------- #include #include Py_Initialize(); PyObject* p = PyCom_PyObjectFromIUnknown(GetIDispatch( true ), IID_I_KApp, FALSE); // boom 2. (as I saw in some mailings from Gary Bishop gb@cs.unc.edu) -------------------------------------------------------------------------- ---------------------------------- #include /* get the function we need from the win32com package using explicit linking */ typedef PyObject* (*PYCOM_PYOBJECTFROMIUNKNOWN)(IUnknown *punk, REFIID riid, BOOL bAddRef /*= FALSE*/); PYCOM_PYOBJECTFROMIUNKNOWN PyCom_PyObjectFromIUnknown = NULL; void GetPythoncomDLL() { /* this should use the version of figure out the name */ HINSTANCE hDLL = LoadLibrary("pythoncom24_d"); // in original it was "pythoncom22" if (hDLL != NULL) { PyCom_PyObjectFromIUnknown = (PYCOM_PYOBJECTFROMIUNKNOWN) GetProcAddress(hDLL, "PyCom_PyObjectFromIUnknown"); } if (hDLL == NULL || PyCom_PyObjectFromIUnknown == NULL) { fprintf(stderr, "Explicit link to pythoncom24_d.dll failed\n"); } } Py_Initialize(); GetPythoncomDLL(); PyObject* p = PyCom_PyObjectFromIUnknown(GetIDispatch( true ), IID_I_KApp, FALSE); // boom thanks for every litte help, Reinhard. -- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040503/c906779e/attachment.html From anand at easi.soft.net Mon May 3 05:58:51 2004 From: anand at easi.soft.net (Anand K Rayudu) Date: Mon May 3 10:17:09 2004 Subject: [python-win32] pythonwin32 UI References: <175f01c42d1c$50cb6e20$0200a8c0@eden> Message-ID: <409617DB.9050203@easi.soft.net> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: pywin32mfc.zip Type: application/zip Size: 48889 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040503/ee2e561b/pywin32mfc-0001.zip From firephreek at earthlink.net Mon May 3 13:36:10 2004 From: firephreek at earthlink.net (firephreek) Date: Mon May 3 14:07:08 2004 Subject: [python-win32] Excel win32com Message-ID: <002e01c43135$1fb882b0$6f01010a@Rachel> I'm looking for the method to retrive the cell format for a given cell. I found it, but then I lost it. And using dir() on the classes doesn't help. Anybody have any ideas? And is it really the case that methods exist that are not defined/shown when calling dir()? Also, on a different note, I'm a bit new to all this, so why do I have to run the makepy file before I can use the methods for the win32com app? Or did that make any sense? Sorry, haven't slept recently. STryder From bgailer at alum.rpi.edu Mon May 3 16:09:50 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon May 3 16:09:29 2004 Subject: [python-win32] Using CDO via COM In-Reply-To: <00a101c42f0f$75522870$0432afc8@ricardo> References: <00a101c42f0f$75522870$0432afc8@ricardo> Message-ID: <6.0.0.22.0.20040503140341.02657f28@mail.mric.net> At http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_clb_sending_smtp_mail_by_port_25_using_cdosys_vb.asp there is sample VBA code for using CDOSYS to send mail. Here is the start of the code: **** CODE**** 'Sending SMTP mail via port 25 using CDOSYS 'This VB sample uses CDOSYS to send SMTP mail using the cdoSendUsingPort option and specifying a SMTP host. Private Sub SendMessage(strTo As String, strFrom As String) 'Send using the Port on a SMTP server Dim iMsg As New CDO.Message Dim iConf As New CDO.Configuration Dim Flds As ADODB.Fields Dim strHTML Set Flds = iConf.Fields With Flds .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "smarthost" 'Use SSL to connect to the SMTP server: '.Item(cdoSMTPUseSSL) = True .Item(cdoSMTPConnectionTimeout) = 10 .Update End With [snip] I can use win32com.client'Dispatch to get CDO.Message and CDO.Configuration I don't understand what to do with Dim Flds As ADODB.Fields, and how to get the (I assume constants) cdoSendUsingMethod etc. Any guidance will be appreciated. Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040503/dde85c79/attachment.html From Christian.Wyglendowski at greenville.edu Mon May 3 17:26:26 2004 From: Christian.Wyglendowski at greenville.edu (Christian Wyglendowski) Date: Mon May 3 17:26:36 2004 Subject: [python-win32] Using CDO via COM Message-ID: Bob, I think you can ignore the ADODB.Fields bit. You have a fields collect in your Configuration object: c = win32com.client.Dispatch('CDO.Configuration') c.Fields.Item(cdoSendUsingMethod) = 2 #see link below c.Fields.Item('cdoSMTPServer').Value = 'smarthost' c.Fields.Item('cdoSMTPConnectionTimeout').Value = 10 c.Fields.Update() m = win32com.client.Dispatch('CDO.Message') m.Configuration = c See this link about cdoSendUsingMethod/cdoSendUsingPort: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/ html/_cdosys_cdosendusing_enum.asp I did a test with this config and it sent using the SMTP server running on my workstation. Hope this helps. Christian http://www.dowski.com -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org] On Behalf Of Bob Gailer Sent: Monday, May 03, 2004 3:10 PM To: python-win32@python.org Subject: [python-win32] Using CDO via COM At http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2 k3/_clb_sending_smtp_mail_by_port_25_using_cdosys_vb.asp there is sample VBA code for using CDOSYS to send mail. Here is the start of the code: **** CODE**** 'Sending SMTP mail via port 25 using CDOSYS 'This VB sample uses CDOSYS to send SMTP mail using the cdoSendUsingPort option and specifying a SMTP host. Private Sub SendMessage(strTo As String, strFrom As String) 'Send using the Port on a SMTP server Dim iMsg As New CDO.Message Dim iConf As New CDO.Configuration Dim Flds As ADODB.Fields Dim strHTML Set Flds = iConf.Fields With Flds .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "smarthost" 'Use SSL to connect to the SMTP server: '.Item(cdoSMTPUseSSL) = True .Item(cdoSMTPConnectionTimeout) = 10 .Update End With [snip] I can use win32com.client'Dispatch to get CDO.Message and CDO.Configuration I don't understand what to do with Dim Flds As ADODB.Fields, and how to get the (I assume constants) cdoSendUsingMethod etc. Any guidance will be appreciated. Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From bgailer at alum.rpi.edu Mon May 3 18:23:34 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Mon May 3 18:23:15 2004 Subject: [python-win32] Using CDO via COM In-Reply-To: References: Message-ID: <6.0.0.22.0.20040503162133.03a23838@mail.mric.net> At 03:26 PM 5/3/2004, Christian Wyglendowski wrote: >Bob, > >I think you can ignore the ADODB.Fields bit. You have a fields collect >in your Configuration object: > >c = win32com.client.Dispatch('CDO.Configuration') >c.Fields.Item(cdoSendUsingMethod) = 2 #see link >below >c.Fields.Item('cdoSMTPServer').Value = 'smarthost' >c.Fields.Item('cdoSMTPConnectionTimeout').Value = 10 >c.Fields.Update() > >m = win32com.client.Dispatch('CDO.Message') >m.Configuration = c That did it! Of course c.Fields.Item(cdoSendUsingMethod) = 2 should be c.Fields.Item('cdoSendUsingMethod').Value = 2 >See this link about cdoSendUsingMethod/cdoSendUsingPort: >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/ >html/_cdosys_cdosendusing_enum.asp [snip] Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From magnus at thinkware.se Mon May 3 18:33:24 2004 From: magnus at thinkware.se (Magnus Lycka) Date: Mon May 3 18:33:30 2004 Subject: =?ISO-8859-1?B?UmU6IFtweXRob24td2luMzJdIEV4Y2VsIHdpbjMyY29t?= Message-ID: STryder wrote: > I'm looking for the method to retrive the cell format for a given cell. > I found it, but then I lost it. This is part of the Excel object model. The most convenient way to learn that might be the MS Excel VBA help texts and to use the object browser in the Visual Basic Editor. I can also recommend Steven Roman's "Writing Excel Macros with VBA", from O'Reilly. > Also, on a different note, I'm a bit new to all this, so why do I have > to run the makepy file before I can use the methods for the win32com > app? Or did that make any sense? Sorry, haven't slept recently. Go to sleep Stryder, that usually improves the code. ;) You don't *have* to run makepy. I very rarely do... As I'm mentioning O'Reilly books, I can only advice you to get Mark Hammond's and Andy Robinson's "Python Programming on Win32". (By the way, what happened with a 2nd edition of that?) By using MakePy, you will enable early binding for COM objects. This gives you three advantages: - Faster interfacing with the COM object (the Python win32com code doesn't have to locate your object in runtime). - Constants defined by the type library become available. - There is better support for advanced parameter passing. There are also disadvantages: - It's extra work... - The generated file is rather big. - You need to handle case sensitivity issues. -- Magnus Lycka, Thinkware AB Alvans vag 99, SE-907 50 UMEA, SWEDEN phone: int+46 70 582 80 65, fax: int+46 70 612 80 65 http://www.thinkware.se/ mailto:magnus@thinkware.se From somesh at qviqsoft.com Tue May 4 08:55:38 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Tue May 4 08:54:12 2004 Subject: [python-win32] chm generation ? Message-ID: <000a01c431d7$1f8c3af0$436a640a@qsoft25> how to generate windows .chm help file with or without Python ? is ther eany other way ? Somesh Bartakke Q-Soft Pvt Ltd, Pune (India) -- Love means to love that which is unloveable. Otherwise it is no virtue at all. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040504/1c24deff/attachment.html From tim.golden at viacom-outdoor.co.uk Tue May 4 09:11:42 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue May 4 09:13:32 2004 Subject: [python-win32] chm generation ? Message-ID: SB> how to generate windows .chm help file with or without Python ? SB> is ther eany other way ? Have a look at this: http://www.rutherfurd.net/software/rst2chm/ TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tony at tcapp.com Tue May 4 22:10:24 2004 From: tony at tcapp.com (Tony Cappellini) Date: Tue May 4 22:10:27 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: Message-ID: <20040504190049.A98798-100000@yamato.yamato.com> Is there any way to pass args to the functions in shell.pyd, from Python? For example, shell.SHBrowseForFOlder takes 6 arguments, the first of which is a window handle. So what is Python passing as a window handle? Is there anyway to get access to what is being passed in as defualts? I would like to pass in a known value for the second argument, but need to know what the Keyword argument is for the second arg. (pidlRoot doesn't work) help() doesn't give any info on the arguments shell.SHBrowseForFolder (PyIDL, string displayName, iImage) = SHBrowseForFolder(hwndOwner, pidlRoot , title , flags , callback , callbackParam ) Displays a dialog box that enables the user to select a shell folder. Parameters hwndOwner=0 : int pidlRoot=None : PyIDL title=None : Unicode /string flags=0 : int callback : object Not yet supported - must be None callbackParam=0 : int Return Value The result is ALWAYS a tuple of 3 items. If the user cancels the dialog, all items are None. If the dialog is closed normally, the result is a tuple of (PIDL, DisplayName, iImageList) From mhammond at skippinet.com.au Wed May 5 03:05:10 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 5 03:05:28 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: <20040504190049.A98798-100000@yamato.yamato.com> Message-ID: <07f801c4326f$4ea2fe80$0200a8c0@eden> > Is there any way to pass args to the functions in shell.pyd, > from Python? Yes - just pass them like any other function. > For example, shell.SHBrowseForFOlder takes 6 arguments, the first of > which is a window handle. > > So what is Python passing as a window handle? If you look at the param list: > hwndOwner=0 : int > pidlRoot=None : PyIDL > title=None : Unicode /string > flags=0 : int > callback : object > Not yet supported - must be None > callbackParam=0 : int You will not they all have "default" values specified (except 'callback', and it should). ie, if the function was written in Python, it would look like: def SHBrowseForFolder(hwndOwner=0, pidlRoot=None, title=None, flags=0, callback=None, cbparam=0): ... If you want to specify a hwnd, just pass it. Note that 'keyword' params aren't supported, so you can't say: SHBrowseForFolder(title="Foo") You must say: SHBrowseForFolder(0, None, "Foo") Mark From tim.golden at viacom-outdoor.co.uk Wed May 5 08:49:48 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed May 5 08:51:33 2004 Subject: [python-win32] Changing Display Size Message-ID: In case no-one's come across this yet: http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/1684800 is a routine to change size / resolution as you go. Seems to work fine. Thanks very much to Shane Holloway for going through the (I guess, not inconsiderable) pain of twiddling the bits of the DEVMODE structure and saving us from doing the same. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tony at tcapp.com Wed May 5 12:18:37 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed May 5 12:18:57 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: <07f801c4326f$4ea2fe80$0200a8c0@eden> Message-ID: <20040505091624.H14148-100000@yamato.yamato.com> > > Is there any way to pass args to the functions in shell.pyd, > > from Python? > > Yes - just pass them like any other function. > > > For example, shell.SHBrowseForFolder takes 6 arguments, the first of > > which is a window handle. > > > > So what is Python passing as a window handle? > > If you look at the param list: > > hwndOwner=0 : int > > pidlRoot=None : PyIDL > > title=None : Unicode /string > > flags=0 : int > > callback : object > > Not yet supported - must be None > > callbackParam=0 : int Since shell is a pyd file, I could not see the real parameter list, only the description from the Pywin help file. thanks From bgailer at alum.rpi.edu Wed May 5 13:03:47 2004 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Wed May 5 13:03:42 2004 Subject: [python-win32] Changing Display Size In-Reply-To: References: Message-ID: <6.0.0.22.0.20040505105859.03b41d18@mail.mric.net> At 06:49 AM 5/5/2004, Tim Golden wrote: >In case no-one's come across this yet: > >http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/1684800 > >is a routine to change size / resolution as you go. Seems to work fine. This works...almost. I normally dock my Windows Taskbar on the right. When I use the above to go to a lower x value (e.g. 1920 to 1600) the Taskbar goes "out of range", whereas the same change thru Display Properties->Settings keeps the taskbar in range. I'm guessing there needs to be another call to reposition the taskbar. >Thanks very much to Shane Holloway for going through the >(I guess, not inconsiderable) pain of twiddling the bits >of the DEVMODE structure and saving us from doing the same. > >TJG > > >________________________________________________________________________ >This e-mail has been scanned for all viruses by Star Internet. The >service is powered by MessageLabs. For more information on a proactive >anti-virus service working around the clock, around the globe, visit: >http://www.star.net.uk >________________________________________________________________________ > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 Bob Gailer bgailer@alum.rpi.edu 303 442 2625 home 720 938 2625 cell From tony at tcapp.com Wed May 5 13:36:52 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed May 5 13:36:57 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: <07f801c4326f$4ea2fe80$0200a8c0@eden> Message-ID: <20040505103032.Y15435-100000@yamato.yamato.com> Mark, > Yes - just pass them like any other function. I would like to pass this dialog the Path to a directory, but the pidlRoot parameter is a PyIDL Object. I don't see any functions in the shell that convert a normal path to a PyIDL object format, so I just tried passing a string as in "C:\\Python23". This blew up python nad dropped me back in the WIn2K/Dos box command line. I have a Visual Basic example of how to pass a starting directory to SHBrowseForFolder, but I can't seem to duplicate it through the python shell extensions. From mhammond at skippinet.com.au Wed May 5 18:59:01 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 5 18:59:19 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: <20040505091624.H14148-100000@yamato.yamato.com> Message-ID: <0c3501c432f4$8f1789b0$0200a8c0@eden> > Since shell is a pyd file, I could not see the real parameter > list, only > the description from the Pywin help file. This helpfile lists the real parameters! What made you think the parameter descriptions for that function did not apply to that function? To your other mail: > > Yes - just pass them like any other function. > I would like to pass this dialog the Path to a directory, but the > pidlRoot > parameter is a PyIDL Object. > > I don't see any functions in the shell that convert a normal path to a > PyIDL object format, so I just tried passing a string as in > "C:\\Python23". > > This blew up python nad dropped me back in the WIn2K/Dos box > command line. Can you give more details here? I can't make Python blow up like this, and it it can, it is a serious bug. I see: >>> shell.SHBrowseForFolder(0 ,"foo") Traceback (most recent call last): File "", line 1, in ? TypeError: Only sequences (but not strings) are valid ITEMIDLIST objects (got str). Which is correct. > I have a Visual Basic example of how to pass a starting directory to > SHBrowseForFolder, but I can't seem to duplicate it through the python > shell extensions. Can you show us the example? desktop=shell.SHGetDesktopFolder() chEaten, pidl, flags = desktop.ParseDisplayName(0, None, "C:\\temp") Is one way to get the PIDL for a known filename. Mark. From tony at tcapp.com Wed May 5 19:37:22 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed May 5 19:37:48 2004 Subject: [python-win32] passing args to shell functions in shell.pyd In-Reply-To: <0c3501c432f4$8f1789b0$0200a8c0@eden> Message-ID: <20040505162056.C22308-100000@yamato.yamato.com> > > This helpfile lists the real parameters! What made you think the parameter > descriptions for that function did not apply to that function? > Because I had tried using the KW args, before your previous email, and they didn't work. Now I understand why. > To your other mail: > > > Yes - just pass them like any other function. > > I would like to pass this dialog the Path to a directory, but the > > pidlRoot > > parameter is a PyIDL Object. > > > > I don't see any functions in the shell that convert a normal path to a > > PyIDL object format, so I just tried passing a string as in > > "C:\\Python23". > > > > This blew up python nad dropped me back in the WIn2K/Dos box > > command line. > > Can you give more details here? I can't make Python blow up like this, and > it it can, it is a serious bug. I can't duplicate it now (argggggh) (most likely, I had a parameter in the wrong order) But- this is what I have been doing most of the day, trying to find a way to pass a starting directory to BrowseForFolder import winshell sh=winshell.shell sh.SHBrowseForFolder(0,"C:\\Python23","Select a folder") If I can duplicate it again, I will document it as much as possible. Whatever I did, it crashed hard. > > I see: > > >>> shell.SHBrowseForFolder(0 ,"foo") > Traceback (most recent call last): > File "", line 1, in ? > TypeError: Only sequences (but not strings) are valid ITEMIDLIST objects > (got str). > > Which is correct. > > > I have a Visual Basic example of how to pass a starting directory to > > SHBrowseForFolder, but I can't seem to duplicate it through the python > > shell extensions. > > Can you show us the example? Ehh- sure. Should I post the full VB example to the list, or would you prefer a private email attachment, or a link to an http site? > > desktop=shell.SHGetDesktopFolder() > chEaten, pidl, flags = desktop.ParseDisplayName(0, None, "C:\\temp") > > Is one way to get the PIDL for a known filename. This is helpfull > From tony at tcapp.com Wed May 5 21:34:57 2004 From: tony at tcapp.com (Tony Cappellini) Date: Wed May 5 21:35:00 2004 Subject: [python-win32] contents of PYTHONSTARTUP file not visible in PythonWin In-Reply-To: Message-ID: <20040505182820.X25024-100000@yamato.yamato.com> I've written some functions that I want to use when I am using the Interactive IDE (python.exe) The file containing these functions gets imported via the PYTHONSTARTUP env var. When I type dir from the IDE, I see the functions, and they execute just fine. SO I then tried the same from inside of PythonWin. Surprizingly, when I typed dir(), the functions where not displayed. However, when I looked at os.environ['PYTHONSTARTUP'], the correct path to the startup file that I created, was displayed. Why is this file not executed when I run PythonWin ? From anand at easi.soft.net Thu May 6 01:10:17 2004 From: anand at easi.soft.net (Anand K Rayudu) Date: Thu May 6 01:04:03 2004 Subject: [python-win32] pythonwin32 UI References: <175f01c42d1c$50cb6e20$0200a8c0@eden> Message-ID: <4099C8B9.9080304@easi.soft.net> Hi All, I want to pass python function to my C++ program through COM interface. How can i do this. I want to pass call back function to C++ program so that my C++ program can call it, when necessary. I hope through python COM layer I can pass it. I tried it but I am not able to get correct pointer to my COM interface via VARIANT. Can some one please help. Thanks & Best Regards, Anand From tim.golden at viacom-outdoor.co.uk Thu May 6 04:32:31 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu May 6 04:34:36 2004 Subject: [python-win32] Changing Display Size Message-ID: >At 06:49 AM 5/5/2004, Tim Golden wrote: >>In case no-one's come across this yet: >> >>http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/1684800 >> >>is a routine to change size / resolution as you go. Seems to >work fine. > >This works...almost. I normally dock my Windows Taskbar on the >right. When >I use the above to go to a lower x value (e.g. 1920 to 1600) >the Taskbar >goes "out of range", whereas the same change thru Display >Properties->Settings keeps the taskbar in range. I'm guessing >there needs >to be another call to reposition the taskbar. Bit more tricky. The technique seems to be something like this: import win32gui taskbar_window = win32gui.FindWindow ("Shell_TrayWnd", "") # Do whatever with Taskbar window, eg MoveWindow, HideWindow, etc. Unfortunately, in the 2 minutes I've got available to try this out, I can get it to move around like it does when you're pulling it. Let us know if you get something to work this way. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From Tikva at israsrv.net.il Thu May 6 06:12:58 2004 From: Tikva at israsrv.net.il (Tikva Bonneh) Date: Thu May 6 06:12:23 2004 Subject: [python-win32] Py_RunSimpleString() - read the buffer from file. Message-ID: <00ab01c43352$b83b37c0$0101c80a@bonneh> I am running my python script from a VC++ application. I tried to read the script from my .py file to a into buffer and execute the buffer with Py_RunSimpleString. It didn't work. This is the way I did it: void gg() { int argc; char *argv[100]; long lSize; char * buffer, * buff1; char par[1000]; FILE * pFile; strcpy(par, "c:\\Python23e\\test.py"); FILE * pFile = fopen ( par, "r" ); if (pFile==NULL) exit (1); // obtain file size. fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); // allocate memory to contain the whole file. buffer = (char*) malloc (lSize); if (buffer == NULL) exit (2); // copy the file into the buffer. fread (buffer,1,lSize,pFile); // initialize the interpreter Py_Initialize(); PySys_SetArgv(argc,argv); PyRun_SimpleString(buffer); // shut down the interpreter Py_Finalize(); // terminate fclose (pFile); free (buffer); ; } I ended up inlining my python code into the c++ code, this way PyRun_SimpleString("k=0;\n"); PyRun_SimpleString("i=0;\n"); Which is not so convinient. How should I run a python script from a VC++ program? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040506/67b8d809/attachment.html From Paul.Moore at atosorigin.com Thu May 6 06:23:16 2004 From: Paul.Moore at atosorigin.com (Moore, Paul) Date: Thu May 6 06:23:16 2004 Subject: [python-win32] Py_RunSimpleString() - read the buffer from file. Message-ID: <16E1010E4581B049ABC51D4975CEDB88052CB0C9@UKDCX001.uk.int.atosorigin.com> From: Tikva Bonneh > I am running my python script from a VC++ application. > I tried to read the script from my .py file to a into > buffer and execute the buffer with Py_RunSimpleString. > It didn't work. This is the way I did it: [...] // allocate memory to contain the whole file. buffer = (char*) malloc (lSize); if (buffer == NULL) exit (2); // copy the file into the buffer. fread (buffer,1,lSize,pFile); [...] Looking at this, it doesn't look like you null-terminated the string. Could that be all your problem is? (Don't forget to add 1 to the length of the buffer you malloc as well!) Paul __________________________________________________________________________ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. __________________________________________________________________________ From ccollier at viawest.net Thu May 6 20:20:04 2004 From: ccollier at viawest.net (ccollier@viawest.net) Date: Thu May 6 20:20:10 2004 Subject: [python-win32] wmi.py + pythonservice.exe Message-ID: background: using - win2k, python2.3.3, pywin32 201.1, wmi 0.5 (from Tim Golden) Typically, I use python in a *nix envoronment, but in this case I'm of course working on a windows machine and slightly out of my element. I've successfully implemented some pieces of code using Tim Golden's wmi module and they work well. I've also implemented some very basic service code and successfully registered pythonservice.exe, installed the service, and stopped and started it. (all using win32 items and examples) When I take working service code, add an "import wmi" statement, and update the service, I then suddenly get failures when trying to start the service. The event log holds almost no information. I simply get this: A system error has occured. System error 1067 has occured. The process terminated unexpectedly. Interestingly, when I use pythonservice.exe to run the service in debug mode it runs well. question: Has anyone else successfully used the wmi.py and pythonservice.exe combination, or have any leads I might research? Thanks! cody From wolf at circle-cross.org Thu May 6 20:42:51 2004 From: wolf at circle-cross.org (Wolf Logan) Date: Thu May 6 20:42:56 2004 Subject: [python-win32] wmi.py + pythonservice.exe References: Message-ID: <005a01c433cc$3a824f60$742f6945@circlecross.home> system error 1067 is, as it says, unexpected process termination. as you're aware, services are not supposed to exit unless they've been sent the "stop" signal, so any exit from your code while starting or running will log this error. I'm going to guess that the python script is exiting with an exception for some reason. you could try wrapping the code in an exception handler, and then logging the exception somewhere before exiting. it's possible that the WMI stuff needs some resource privileges that the service environment isn't providing. the default setting for services is very restricted, for security. if your service is set to log on as the "local system", try setting the "interact with desktop" flag, which allows some extra privileges. otherwise, try running the service to log on as a regular user, preferably one which can successfully run the code from the desktop (for example, your own account). ----- Original Message ----- From: Sent: Thursday, May 06, 2004 5:20 PM > When I take working service code, add an "import wmi" statement, and > update the service, I then suddenly get failures when trying to start the > service. The event log holds almost no information. I simply get this: > > A system error has occured. > System error 1067 has occured. > The process terminated unexpectedly. > > Interestingly, when I use pythonservice.exe to run the service in debug > mode it runs well. > > question: > Has anyone else successfully used the wmi.py and pythonservice.exe > combination, or have any leads I might research? From mhammond at skippinet.com.au Thu May 6 23:55:18 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu May 6 23:55:39 2004 Subject: [python-win32] wmi.py + pythonservice.exe In-Reply-To: <005a01c433cc$3a824f60$742f6945@circlecross.home> Message-ID: <07cc01c433e7$1d51f970$0200a8c0@eden> > system error 1067 is, as it says, unexpected process > termination. as you're > aware, services are not supposed to exit unless they've been > sent the "stop" > signal, so any exit from your code while starting or running > will log this > error. Theoretically, this should not be able to happen for Python services. Unhandled exceptions should still terminate "gracefully", logging the error and notifying the SCM that it finished. A fatal Python error could cause this though, and the most common cause of this is a thread-state mixup - but then I would expect the same code to fail regardless of the context it was being executed in. All my ideas to diagnose this require MSVC. Mark From tim.golden at viacom-outdoor.co.uk Fri May 7 02:30:41 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri May 7 02:32:31 2004 Subject: [python-win32] wmi.py + pythonservice.exe Message-ID: > using - win2k, python2.3.3, pywin32 201.1, wmi 0.5 (from Tim Golden) > > I've successfully implemented some pieces of code using Tim > Golden's wmi module and they work well. Glad to hear it! >When I take working service code, add an "import wmi" statement, and >update the service, I then suddenly get failures when trying >to start the service. The event log holds almost no information. No magic bullet here, I'm afraid. I've not tried this myself, tho' if I have time this morning I'll give it a go. You're up against at least two things: + Security issues around services, which -- by default -- run as the most basic user possible, without network access (I think). + The WMI security model is a real pain to manipulate, not least because you have to contend with its own security, general COM / DCOM security, and even more general NT Security, all of which are interlinked, but subtly different (or at least that's the impression I have from no small amount of research). And, of course, it may be that even sorting this out won't solve your problem! I suggest that you run the service under the same user which you're logged in as. In case you haven't done this before, it means going to Control Panel -> Admin Tools -> Services (or however you normally get there), right-clicking for Properties, selecting the LogOn tab, and specifying an exact account. Then try starting the service again. As you can see from the top of the WMI file, the only thing the module does on import (apart from defining a few constants and, obviously, the classes and functions) is to call win32com.client.gencache.EnsureDispatch. This is to ensure that various constants etc are readily available. There aren't many, (in fact, three), so you might try adding these lines somewhere towards the top of the module at line 129: wbemErrInvalidQuery = -2147217385 wbemErrTimedout = -2147209215 to replace lines 129-131: #obj = win32com.client.GetObject ("winmgmts:") #win32com.client.gencache.EnsureDispatch (obj._oleobj_) #del obj You could then replace "win32com.client.constants." with "" throughout (there are only three instances) and see if that helps. (In case it wasn't obvious, all I'm doing there is to remove the need to do any win32com stuff on module import, in case that's a problem.) Let us know if that helps or hinders. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From cedric.delfosse at linbox.com Fri May 7 09:24:06 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Fri May 7 09:24:11 2004 Subject: [python-win32] Error in FindPerformanceAttributesByName Message-ID: <1083936246.23077.38.camel@replic.freealter.fr> Hello, I use python 2.2.2 with win32all-148 on Windows NT. I know these are outdated version, but I must do with it. The problematic code is: def get_process_pids(name): """ Return the process ids corresponding to the given 'name' """ # Flush process info internal cache win32pdh.EnumObjects(None, None, 0, 1) return(win32pdhutil.FindPerformanceAttributesByName(name)) I have these exceptions with FindPerformanceAttributesByName, when I call it lots of time (that's what I think, I can't reproduce the problem): File "conversions.py", line 68, in get_process_pids File "C:\Python22\lib\site-packages\win32\lib\win32pdhutil.py", line 49, in FindPerformanceAttributesByName items, instances = win32pdh.EnumObjectItems(None,None,object, -1) api_error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') and after: File "conversions.py", line 67, in get_process_pids api_error: (170, 'EnumObjects for buffer size', 'The requested resource is in use.') Do you think that an upgrade of python-win32 could resolve the problem ? Best regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From cedric.delfosse at linbox.com Fri May 7 12:07:52 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Fri May 7 12:07:57 2004 Subject: [python-win32] Error in FindPerformanceAttributesByName In-Reply-To: <1083936246.23077.38.camel@replic.freealter.fr> References: <1083936246.23077.38.camel@replic.freealter.fr> Message-ID: <1083946072.23073.142.camel@replic.freealter.fr> Le ven 07/05/2004 ? 15:24, Cedric Delfosse a ?crit : > Hello, > > I use python 2.2.2 with win32all-148 on Windows NT. I know these are > outdated version, but I must do with it. I tried an upgrade to pywin32-201. The first problem I had is: pids = win32pdhutil.FindPerformanceAttributesByName('python') File "C:\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line 71, in FindPerformanceAttributesByName if object is None: object = find_pdh_counter_localized_name("Process", machine) File "C:\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line 41, in find_pdh_counter_localized_name return win32pdh.LookupPerfNameByIndex(machine_name, counter_english_map[english_name.lower()]) RuntimeError: The pdh.dll entry point functions could not be loaded. To resolve this, I downloaded pdh.dll available here http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284996 and put it into C:\python22. Now, into a Python shell: >>> import win32pdhutil >>> win32pdhutil.ShowAllProcesses() Traceback (most recent call last): File "", line 1, in ? win32pdhutil.ShowAllProcesses() File "C:\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line 94, in ShowAllProcesses items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD) error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available') I'm sure this was working with my previous version of pywin32 (win32all-148). Is there something else I should do so that it works ? Best regards, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From ccollier at viawest.net Fri May 7 12:21:39 2004 From: ccollier at viawest.net (ccollier@viawest.net) Date: Fri May 7 12:21:44 2004 Subject: [python-win32] wmi.py + pythonservice.exe In-Reply-To: Message-ID: Thank you all for the quick input and insights. Tim, I'll give your suggestions a shot for routing around the com imports issue when I have a chance. In the mean time, I found an interesting work around. If I rename wmi.py to anything else and then reference it accordingly, the problem dissapears. (ex. pywmi.py, import pywmi) Due to deadlines, I'll probably have to come back and learn why this is the case later, but I'm sure it will provide some good insight and a learning experience regarding python internal workings. cody On Fri, 7 May 2004, Tim Golden wrote: > > using - win2k, python2.3.3, pywin32 201.1, wmi 0.5 (from Tim Golden) > > > > I've successfully implemented some pieces of code using Tim > > Golden's wmi module and they work well. > > Glad to hear it! > > >When I take working service code, add an "import wmi" statement, and > >update the service, I then suddenly get failures when trying > >to start the service. The event log holds almost no information. --snip-- From tim.golden at viacom-outdoor.co.uk Fri May 7 12:24:26 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri May 7 12:26:14 2004 Subject: [python-win32] wmi.py + pythonservice.exe Message-ID: >Thank you all for the quick input and insights. Tim, I'll give your >suggestions a shot for routing around the com imports issue >when I have a >chance. > >In the mean time, I found an interesting work around. If I >rename wmi.py >to anything else and then reference it accordingly, the problem >dissapears. (ex. pywmi.py, import pywmi) Due to deadlines, >I'll probably >have to come back and learn why this is the case later, but >I'm sure it >will provide some good insight and a learning experience >regarding python >internal workings. > >cody Wow. Don't pretend to understand that one bit, but thanks for the information. I did try to put an "import wmi" into my usual test service earlier, but ran into annoying problems before ever getting the "import wmi" into the script and ran out of time, so inconclusive. Should really try again so I can advise when other people try. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tony at tcapp.com Fri May 7 20:15:24 2004 From: tony at tcapp.com (Tony Cappellini) Date: Fri May 7 20:15:33 2004 Subject: [python-win32] Launching COM apps from Python In-Reply-To: Message-ID: <20040507170144.R79627-100000@yamato.yamato.com> I'm trying to launch an in-house COM-server from Python. I do have the IDL file that the TLB was created from but .... I haven't been to launch the program successfully yet. I've registered the app as a com server, run makepy and imported the resulting py file. I've tried following the examples in Programming Python on W32 as well. So I looked in the Win32com/test directory, at the test scripts for the Office Apps, trying to follow suit. I've tried this approach mytest = win32com.client.dynamic.Dispatch("mytest.Application") Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 79, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Invalid class string', None, None) as well as mytest = win32com.client.dynamic.Dispatch("mytest") Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 79, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221005, 'Invalid class string', None, None) I've substituted the name "mytest" with the case-sensitive name from the IDL file. This COM stuff just drives me crazy. Would anyone mind pointing me in the right direction? thanks From mhammond at skippinet.com.au Fri May 7 21:40:37 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri May 7 21:40:58 2004 Subject: [python-win32] Launching COM apps from Python In-Reply-To: <20040507170144.R79627-100000@yamato.yamato.com> Message-ID: <05e901c4349d$77555f50$0200a8c0@eden> You are trying to use a ProgID that does not exist. A "ProgID" is really just a mapping to its CLSID. It sounds like your object is not registering itself correctly. Look in the registry - all COM objects have their name directly under HKEY_CLASSES_ROOT. Under that name, you will find a CLSID. This CLSID will then have a key under HKEY_CLASSES_ROOT\CLSID. Look at the registry to confirm that the names you tried do not exist as COM objects. Otherwise, try using the CLSID of the object directly, instead of the ProgID - just pass the IID string directly to Dispatch() Mark. > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au@python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On > Behalf Of Tony Cappellini > Sent: Saturday, 8 May 2004 10:15 AM > To: python-win32@python.org > Subject: [python-win32] Launching COM apps from Python > > > > > I'm trying to launch an in-house COM-server from Python. > I do have the IDL file that the TLB was created from but .... > > I haven't been to launch the program successfully yet. > I've registered the app as a com server, run makepy and imported the > resulting py file. > > I've tried following the examples in Programming Python on > W32 as well. > > So I looked in the Win32com/test directory, at the test > scripts for the > Office Apps, trying to follow suit. > > I've tried this approach > mytest = win32com.client.dynamic.Dispatch("mytest.Application") > > Traceback (most recent call last): > File "", line 1, in ? > File > "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line > 95, in Dispatch > dispatch, userName = > dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > File > "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line > 91, in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File > "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line > 79, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > pythoncom.IID_IDispatch) > com_error: (-2147221005, 'Invalid class string', None, None) > > > as well as > mytest = win32com.client.dynamic.Dispatch("mytest") > > Traceback (most recent call last): > File "", line 1, in ? > File > "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line > 95, in Dispatch > dispatch, userName = > dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > File > "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line > 91, in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) > File > "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line > 79, in _GetGoodDispatch > IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, > pythoncom.IID_IDispatch) > com_error: (-2147221005, 'Invalid class string', None, None) > > > I've substituted the name "mytest" with the case-sensitive > name from the > IDL file. > > This COM stuff just drives me crazy. > > Would anyone mind pointing me in the right direction? > > thanks > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Fri May 7 21:45:22 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri May 7 21:45:39 2004 Subject: [python-win32] wmi.py + pythonservice.exe In-Reply-To: Message-ID: <05f301c4349e$20df2ab0$0200a8c0@eden> > >In the mean time, I found an interesting work around. If I > >rename wmi.py > >to anything else and then reference it accordingly, the problem > >dissapears. (ex. pywmi.py, import pywmi) Due to deadlines, > >I'll probably > >have to come back and learn why this is the case later, but > >I'm sure it > >will provide some good insight and a learning experience > >regarding python > >internal workings. It is possible that a "wmi.dll" is being found first on sys.path, and is what is getting loaded. It may also be that the sys.path{} was setup this way only when running under the service context (eg, due to the user, etc) I'm still love to know how it caused a silent fatal error - unless the "wmi.dll/.pyd" found was indeed an old Python extension module built for a different Python version. (If it was just a "regular" windows DLL, it should cause an ImportError, which should not be silent.) Mark. From mhammond at skippinet.com.au Fri May 7 22:02:17 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Fri May 7 22:02:35 2004 Subject: [python-win32] Error in FindPerformanceAttributesByName In-Reply-To: <1083946072.23073.142.camel@replic.freealter.fr> Message-ID: <05fe01c434a0$7d944fe0$0200a8c0@eden> > To resolve this, I downloaded pdh.dll available here > http://support.microsoft.com/default.aspx?scid=kb;en-us;Q28499 > 6 and put > it into C:\python22. That KB article references Windows NT4 - is that what you are running? The installer probably should try and ensure the latest is installed - I opened a bug at sourceforge to remind myself. > >>> import win32pdhutil > >>> win32pdhutil.ShowAllProcesses() > Traceback (most recent call last): > File "", line 1, in ? > win32pdhutil.ShowAllProcesses() > File "C:\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line > 94, in ShowAllProcesses > items, instances = win32pdh.EnumObjectItems(None,None,object, > win32pdh.PERF_DETAIL_WIZARD) > error: (-1073738824, 'EnumObjectItems for buffer size', 'No error > message is available') That error translates to PDH_CSTATUS_NO_OBJECT, which MS document as: "The specified machine was found, but no matching performance object was found on that machine. If this status is returned when the counter is being added, the specified counter is not included in the query. If this status is returned by an active counter, the data for that counter is invalid. Each time the data is requested, PDH tries to obtain this counter data." That doesn't really make a whole lot of sense in this case - but I've no further ideas I'm afraid (and it does work for me!) Mark From cedric.delfosse at linbox.com Mon May 10 04:36:18 2004 From: cedric.delfosse at linbox.com (Cedric Delfosse) Date: Mon May 10 04:36:44 2004 Subject: [python-win32] Error in FindPerformanceAttributesByName In-Reply-To: <05fe01c434a0$7d944fe0$0200a8c0@eden> References: <05fe01c434a0$7d944fe0$0200a8c0@eden> Message-ID: <1084178178.26409.42.camel@replic.freealter.fr> Le sam 08/05/2004 ? 04:02, Mark Hammond a ?crit : > > To resolve this, I downloaded pdh.dll available here > > http://support.microsoft.com/default.aspx?scid=kb;en-us;Q28499 > > 6 and put > > it into C:\python22. > > That KB article references Windows NT4 - is that what you are running? The > installer probably should try and ensure the latest is installed - I opened > a bug at sourceforge to remind myself. Yes, Windows NT 4.00.1381, French version. > > >>> import win32pdhutil > > >>> win32pdhutil.ShowAllProcesses() > > Traceback (most recent call last): > > File "", line 1, in ? > > win32pdhutil.ShowAllProcesses() > > File "C:\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line > > 94, in ShowAllProcesses > > items, instances = win32pdh.EnumObjectItems(None,None,object, > > win32pdh.PERF_DETAIL_WIZARD) > > error: (-1073738824, 'EnumObjectItems for buffer size', 'No error > > message is available') > > That error translates to PDH_CSTATUS_NO_OBJECT, which MS document as: > "The specified machine was found, but no matching performance object was > found on that machine. If this status is returned when the counter is being > added, the specified counter is not included in the query. If this status is > returned by an active counter, the data for that counter is invalid. Each > time the data is requested, PDH tries to obtain this counter data." > > That doesn't really make a whole lot of sense in this case - but I've no > further ideas I'm afraid (and it does work for me!) I installed python 2.3.3 and pywin32-201, and now it works fine (and no need to add any pdh.dll). Looks like it's time for my customer to upgrade :) Thanks a lot for your help, -- C?dric Delfosse Linbox / Free&ALter Soft 152, rue de Grigy - Technopole Metz 57070 Metz - FRANCE t?l: +33 (0)3 87 50 87 90 http://linbox.com From tim.golden at viacom-outdoor.co.uk Mon May 10 10:49:04 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon May 10 10:50:56 2004 Subject: [python-win32] wmi.py + pythonservice.exe Message-ID: Well, as Mark Hammond suggested in another post (which I can't now find to respond to), there is in my Win2K installation a [wmi.dll] stashed away in [c:\winnt\system32]. If you cd to that directory, start a Python session on try doing "import wmi" it crashes mightily. Don't know why. Presumably services run in the context of that directory, so running the script from elsewhere won't manifest the problem while as soon as it becomes a service -- BANG! Looks like I might want to consider calling the module pywmi or something instead, if only to avoid this problem. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From Mike.Tallhamer at USONCOLOGY.COM Mon May 10 12:50:05 2004 From: Mike.Tallhamer at USONCOLOGY.COM (Mike.Tallhamer@USONCOLOGY.COM) Date: Mon May 10 12:52:31 2004 Subject: [python-win32] python and pdf question Message-ID: <1D09B341F14C6E429F374C2FC17E7CBFD00946@utx001sx011.usoncology.com> I am not new to python but I am new to python on windows and have a current project where I would like to create a pdf form where I can retrieve data from the user for processing in a python program. Does any one know if I create a pdf form is it possible to retrieve field data from the pdf form using python (possibly using a COM interface?) and then update the form fields from the python program after the data has been processed? Is there any books on this or any links to documentation on this type of thing because I can't seem to find it anywhere and I am unfamiliar with COM on widows and how to use it effectively as of yet but I am working on it. I would appreciate any type of help you could provide even a point in the general direction on any of this. Thanks so much for any help you folks can provide. Michael Tallhamer Medical Physicist Department of Radiation Oncology Rocky Mountain Cancer Centers Denver, Co ----------------------------------------- The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended for the addressee(s) only. Only the addressee(s) may read, disseminate, retain or otherwise use this message. If received in error, please immediately inform the sender and then delete this message without disclosing its contents to anyone. From jens.jorgensen at tallan.com Mon May 10 13:23:42 2004 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Mon May 10 13:24:03 2004 Subject: [python-win32] python and pdf question In-Reply-To: <1D09B341F14C6E429F374C2FC17E7CBFD00946@utx001sx011.usoncology.com> References: <1D09B341F14C6E429F374C2FC17E7CBFD00946@utx001sx011.usoncology.com> Message-ID: <409FBA9E.1020000@tallan.com> I don't know. But, the way to pursue this would probably be to get documentation for the full version of Adobe Acrobat. A word of caution here though: are you sure that the free version of Acrobat will let you save a PDF Form with populated values? I'm not sure but I don't think it will. I think the only thing the free reader will let you do with a form is print it. If you were thinking of using this as some large scale data collection it may not be a good idea to expect people to purchase and install a $299 software package. If you're doing large-scale data collection my first choice would be a web page. If you need people to be able to work on it off-line then things get trickier. A Word form would be ok, but let's people edit and screw it up. Another thing to look into would be building a little Flash app. It'd be smally to deploy, multi-platform, and should be easy to write from what I hear. Mike.Tallhamer@USONCOLOGY.COM wrote: >I am not new to python but I am new to python on windows and have a current >project where I would like to create a pdf form where I can retrieve data >from the user for processing in a python program. Does any one know if I >create a pdf form is it possible to retrieve field data from the pdf form >using python (possibly using a COM interface?) and then update the form >fields from the python program after the data has been processed? Is there >any books on this or any links to documentation on this type of thing >because I can't seem to find it anywhere and I am unfamiliar with COM on >widows and how to use it effectively as of yet but I am working on it. I >would appreciate any type of help you could provide even a point in the >general direction on any of this. > >Thanks so much for any help you folks can provide. > >Michael Tallhamer >Medical Physicist >Department of Radiation Oncology >Rocky Mountain Cancer Centers >Denver, Co > >----------------------------------------- >The contents of this electronic mail message and any attachments are confidential, possibly privileged and intended for the addressee(s) only. Only the addressee(s) may read, disseminate, retain or otherwise use this message. If received in error, please immediately inform the sender and then delete this message without disclosing its contents to anyone. > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20040510/b19ba9d2/smime.bin From niki at vintech.bg Tue May 11 04:26:09 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue May 11 04:26:48 2004 Subject: [python-win32] python and pdf question In-Reply-To: <1D09B341F14C6E429F374C2FC17E7CBFD00946@utx001sx011.usoncology.com> References: <1D09B341F14C6E429F374C2FC17E7CBFD00946@utx001sx011.usoncology.com> Message-ID: <40A08E21.3000507@vintech.bg> Mike.Tallhamer@USONCOLOGY.COM wrote: > I am not new to python but I am new to python on windows and have a current > project where I would like to create a pdf form where I can retrieve data > from the user for processing in a python program. Does any one know if I > create a pdf form is it possible to retrieve field data from the pdf form > using python (possibly using a COM interface?) and then update the form > fields from the python program after the data has been processed? Is there > any books on this or any links to documentation on this type of thing > because I can't seem to find it anywhere and I am unfamiliar with COM on > widows and how to use it effectively as of yet but I am working on it. I > would appreciate any type of help you could provide even a point in the > general direction on any of this. > > Thanks so much for any help you folks can provide. Look at http://reportlab.org HTH Niki Spahiev From theller at python.net Tue May 11 06:20:22 2004 From: theller at python.net (Thomas Heller) Date: Tue May 11 06:20:35 2004 Subject: [python-win32] Re: wmi.py + pythonservice.exe References: Message-ID: <1xlre049.fsf@python.net> Tim Golden writes: > Well, as Mark Hammond suggested in another post > (which I can't now find to respond to), there is > in my Win2K installation a [wmi.dll] stashed > away in [c:\winnt\system32]. If you cd to that > directory, start a Python session on try doing > "import wmi" it crashes mightily. Don't know > why. It crashes when trying to access the import table of the wmi.dll. File Python/dynload_win.c, line 125, in the GetPythonImport function. On WinXP Pro, it seems wmi.dll doesn't contain an import table. Or something like that. Thomas From mhammond at skippinet.com.au Tue May 11 07:04:08 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue May 11 07:04:30 2004 Subject: [python-win32] Re: wmi.py + pythonservice.exe In-Reply-To: <1xlre049.fsf@python.net> Message-ID: <0b2701c43747$b01b4780$0200a8c0@eden> > It crashes when trying to access the import table of the wmi.dll. > File Python/dynload_win.c, line 125, in the GetPythonImport function. > > On WinXP Pro, it seems wmi.dll doesn't contain an import table. > Or something like that. It's like a tag-team match :) www.python.org/sf/951851 Thomas - a quick review of the patch, if you don't mind, and I'll check it in before 2.3.4 goes out! Thanks, Mark From lbates at syscononline.com Tue May 11 12:32:46 2004 From: lbates at syscononline.com (Larry Bates) Date: Tue May 11 12:32:56 2004 Subject: [python-win32] python and pdf question In-Reply-To: Message-ID: <01d101c43775$97b88490$5d00a8c0@LABWXP> Mike, I've done something like what you describe using ReportLab and ReportLab's PageCatcher module. Background .PDF form is imported into ReportLab and placed on canvas. Then I draw my data fields on the background form and save as .PDF. This doesn't actually use the .PDF "forms" but accomplishes the same end result. Larry Bates Syscon, Inc. I am not new to python but I am new to python on windows and have a current project where I would like to create a pdf form where I can retrieve data from the user for processing in a python program. Does any one know if I create a pdf form is it possible to retrieve field data from the pdf form using python (possibly using a COM interface?) and then update the form fields from the python program after the data has been processed? Is there any books on this or any links to documentation on this type of thing because I can't seem to find it anywhere and I am unfamiliar with COM on widows and how to use it effectively as of yet but I am working on it. I would appreciate any type of help you could provide even a point in the general direction on any of this. Thanks so much for any help you folks can provide. Michael Tallhamer Medical Physicist Department of Radiation Oncology Rocky Mountain Cancer Centers Denver, Co From jpbarrette at savoirfairelinux.net Wed May 12 14:24:05 2004 From: jpbarrette at savoirfairelinux.net (Jean-Philippe Barrette-LaPierre) Date: Wed May 12 14:26:42 2004 Subject: [python-win32] COM server with py2exe Message-ID: <40A26BC5.1040003@savoirfairelinux.net> I need to implement a COM server for quickbooks. This is for receiving events from Quickbooks. I'm registering my COM server as a local server. The problem is that Quickbook takes the LocalServer32 value and check its certificate signature. Its not required to have a certificate signature, but since python is registering the LocalServer32 as: C:\Python23\python.exe "C:\Python23\Lib\site-packages\win32com\server\LocalServer.py" (and the clsid) for example, it fails because it cannot find a file named "C:\Python23\python.exe "C:\Python23\Lib\site-packages\win32com\server\LocalServer.py" (and the clsid)". To get rid of this of this behavior I'm using the py2exe package to have an executable. The problem is that, even with py2exe, there's an extra argument. The LocalServer32 variable is : C:\MyApp\MyPythonApp.exe /Automate. I searched throught the win32com sources files and found the code responsible of this: ------ win32com/server/register.py ------------- if clsctx & pythoncom.CLSCTX_LOCAL_SERVER: if pythoncom.frozen: # If we are frozen, we write "{exe} /Automate", just # like "normal" .EXEs do exeName = win32api.GetShortPathName(sys.executable) command = '%s /Automate' % (exeName,) else: # Running from .py sources - we need to write # 'python.exe win32com\server\localserver.py {clsid}" exeName = _find_localserver_exe(1) exeName = win32api.GetShortPathName(exeName) pyfile = _find_localserver_module() command = '%s "%s" %s' % (exeName, pyfile, str(clsid)) _set_string(keyNameRoot + '\\LocalServer32', command) ------------------------------------------------ why do you need to add /Automate? Can I get rid of it? From jpbarrette at savoirfairelinux.net Wed May 12 15:55:47 2004 From: jpbarrette at savoirfairelinux.net (Jean-Philippe Barrette-LaPierre) Date: Wed May 12 15:55:59 2004 Subject: [python-win32] shelve py2exe error Message-ID: <40A28143.1090002@savoirfairelinux.net> Hi, I have ran into a problem with py2exe 0.5.0 and *shelve* in *python* 2.3.3. The script works fine standalone, but not with py2exe. Does anyone have a solution of workaround for this? Thanks. From mhammond at skippinet.com.au Thu May 13 07:10:54 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu May 13 07:11:17 2004 Subject: [python-win32] COM server with py2exe In-Reply-To: <40A26BC5.1040003@savoirfairelinux.net> Message-ID: <025a01c438da$f6d0c6c0$0200a8c0@eden> > To get rid of this of this behavior I'm using the py2exe > package to have > an executable. The problem is that, even with py2exe, there's > an extra > argument. The LocalServer32 variable is : > > C:\MyApp\MyPythonApp.exe /Automate. It is quite common for C++ apps to require this arg - many MS samples certainly do. AFAIK, it is really only used to prevent "accidentally" starting the server - eg, when you just double-click on it, to see what it does! I admit to having done that myself (obviously only when trusting the content!) I believe that with py2exe, you will find that without it, you will see a messagebox. If you don't, then it probably will work :) > why do you need to add /Automate? Can I get rid of it? I'm not sure I would support dropping that just for this problem. I probably would support the concept of a custom 'bootstrap' for a localserver, but it may require a bit of work to get both pywin32 and py2exe both supporting it. Mark From rasjidw at openminddev.net Thu May 13 08:16:11 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Thu May 13 08:16:28 2004 Subject: [python-win32] shelve py2exe error In-Reply-To: <40A28143.1090002@savoirfairelinux.net> References: <40A28143.1090002@savoirfairelinux.net> Message-ID: <200405132216.12048.rasjidw@openminddev.net> On Thursday 13 May 2004 05:55, Jean-Philippe Barrette-LaPierre wrote: > Hi, I have ran into a problem with py2exe 0.5.0 and *shelve* in *python* > 2.3.3. The script works fine standalone, but not with py2exe. > > Does anyone have a solution of workaround for this? Thanks. Care to share any errors? Also, does the py2exe process give any warnings at the end? Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +10 hrs) http://www.openminddev.net From theller at python.net Thu May 13 10:21:50 2004 From: theller at python.net (Thomas Heller) Date: Thu May 13 10:22:02 2004 Subject: [python-win32] Re: COM server with py2exe References: <40A26BC5.1040003@savoirfairelinux.net> <025a01c438da$f6d0c6c0$0200a8c0@eden> Message-ID: >> To get rid of this of this behavior I'm using the py2exe package to >> have an executable. The problem is that, even with py2exe, there's an >> extra argument. The LocalServer32 variable is : >> >> C:\MyApp\MyPythonApp.exe /Automate. > > It is quite common for C++ apps to require this arg - many MS samples > certainly do. AFAIK, it is really only used to prevent "accidentally" > starting the server - eg, when you just double-click on it, to see what it > does! I admit to having done that myself (obviously only when trusting the > content!) I think the intent of the /Automate argument is to enable the executable to find out whether it has been started by the user or by COM. OTOH, from what I know it is unneeded to do it this way - when an exe server is started from COM, it *automatically* gets the '-Embedding' on the command line. > > I believe that with py2exe, you will find that without it, you will see a > messagebox. If you don't, then it probably will work :) > >> why do you need to add /Automate? Can I get rid of it? > > I'm not sure I would support dropping that just for this problem. I > probably would support the concept of a custom 'bootstrap' for a > localserver, but it may require a bit of work to get both pywin32 and py2exe > both supporting it. Thomas From theller at python.net Thu May 13 10:32:28 2004 From: theller at python.net (Thomas Heller) Date: Thu May 13 10:32:42 2004 Subject: [python-win32] Re: shelve py2exe error References: <40A28143.1090002@savoirfairelinux.net> Message-ID: Jean-Philippe Barrette-LaPierre writes: > Hi, I have ran into a problem with py2exe 0.5.0 and *shelve* in *python* > 2.3.3. The script works fine standalone, but not with py2exe. > > Does anyone have a solution of workaround for this? Thanks. Well, trying to py2exe this simple script import shelve shelve.open("myfile") and then running the executable prints this: Traceback (most recent call last): File "myshelve.py", line 3, in ? shelve.open("filename") File "shelve.pyc", line 231, in open File "shelve.pyc", line 211, in __init__ File "anydbm.pyc", line 62, in ? ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm', 'dumbdbm'] So it seems quite clear that you have to include one of the dbm modules. Running the setup again with this command line seems to work ok: python setup.py -i dbhash Thomas From rasjidw at openminddev.net Fri May 14 06:12:03 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Fri May 14 06:12:19 2004 Subject: [python-win32] Re: shelve py2exe error In-Reply-To: References: <40A28143.1090002@savoirfairelinux.net> Message-ID: <200405142012.03863.rasjidw@openminddev.net> On Friday 14 May 2004 00:32, Thomas Heller wrote: > Jean-Philippe Barrette-LaPierre writes: > > Hi, I have ran into a problem with py2exe 0.5.0 and *shelve* in *python* > > 2.3.3. The script works fine standalone, but not with py2exe. > > > > Does anyone have a solution of workaround for this? Thanks. > > Well, trying to py2exe this simple script > > import shelve > shelve.open("myfile") > > and then running the executable prints this: > > Traceback (most recent call last): > File "myshelve.py", line 3, in ? > shelve.open("filename") > File "shelve.pyc", line 231, in open > File "shelve.pyc", line 211, in __init__ > File "anydbm.pyc", line 62, in ? > ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm', 'dumbdbm'] > > So it seems quite clear that you have to include one of the dbm modules. > Running the setup again with this command line seems to work ok: > > python setup.py -i dbhash You can modify the setup.py file to automatically do the include, but I can't recall the exact syntax (the code is at work, I'm now at home). Look in some of the py2exe samples. Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +10 hrs) http://www.openminddev.net From michael at sentai.com Fri May 14 10:05:53 2004 From: michael at sentai.com (Michael Beaulieu) Date: Fri May 14 09:54:14 2004 Subject: [python-win32] Error trying to create a com instance Message-ID: <40A4D241.2040702@sentai.com> I'm running python 22 win32all build 148 From experimenting with ocx's previously I have managed to create an object using this pattern ''' camtasia = .... EnsureModule( ..... ) recorder = camtasia.CamtasiaRecorder rec = recorder() iface_rec = camtasia.ICamtasiaRecorder(rec) ''' I try to run the following code and I'm not clear on what's happening - something seems out of sync >>> speller = win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-8385-524153480001}', 0, 2, 1) >>> speller.VSSpell >>> sp= speller.VSSpell() Traceback (most recent call last): File "", line 1, in ? File "win32com\gen_py\97F4CED3-9103-11CE-8385-524153480001x0x2x1.py", line 726, in __init__ TypeError: 'str' object is not callable The generated module contains the class source below and if I replace the default_class and default_source values with the classnames in place of the ID's I no longer get the error, but I haven't tested the actual OCX yet, so I don't know if something else is wrong. What do I have to do to ensure the proper creation of the module? thanks, Mike ########### from the generated module ############################ class CoClassBaseClass: def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) self.__dict__["_dispobj_"] = self.default_interface(oobj) # this is line 726 def __repr__(self): return "" % (__doc__, self.__class__.__name__) def __getattr__(self, attr): d=self.__dict__["_dispobj_"] if d is not None: return getattr(d, attr) raise AttributeError, attr def __setattr__(self, attr, value): if self.__dict__.has_key(attr): self.__dict__[attr] = value; return try: d=self.__dict__["_dispobj_"] if d is not None: d.__setattr__(attr, value) return except AttributeError: pass self.__dict__[attr] = value class VSSpell(CoClassBaseClass): # A CoClass # VCI VisualSpeller Spellchecker CLSID = pythoncom.MakeIID("{97F4CED0-9103-11CE-8385-524153480001}") coclass_sources = [ '{97F4CED2-9103-11CE-8385-524153480001}', ] default_source = '{97F4CED2-9103-11CE-8385-524153480001}' coclass_interfaces = [ '{97F4CED1-9103-11CE-8385-524153480001}', ] default_interface = '{97F4CED1-9103-11CE-8385-524153480001}' ############# end of clip ############# From anand at easi.soft.net Sat May 15 04:24:16 2004 From: anand at easi.soft.net (Anand K Rayudu) Date: Sat May 15 04:18:15 2004 Subject: [python-win32] Fatal Python error:PyThreadState_Get: No current Thread References: <175f01c42d1c$50cb6e20$0200a8c0@eden> <4099C8B9.9080304@easi.soft.net> Message-ID: <40A5D3B0.5050002@easi.soft.net> Hi All, Python encountered FATAL error, while doing the following. Can some one please suggest what could be the problem. # source.py file from win32com.client import Displatch o=Dispatch("GuiCntlrs.Dialogs") # This is my COM object module, which allows me to post the # pre defined dialog boxes. o.CreateMyDialog() o.SetCallBack("source.py","Execute") # Here I am passing current module name & the call back function name # my ideas is to execute the call back 'Execute' when ever user clicks on any # button o.PutEventLoop() # This code is just event loop Def Execute(reason): Print 'Executing Call back' // The following my COM object code to get the python callback. SetCallBack(BSTR module_name, BSTR callbk_name){ PyObject *mod = PyImport_AddModule(module_name); // The Fatal error is generated while doing this // Actually this calls PyImport_GetModuleDict(); // This is the function which is failing. if(!mod) return S_OK; m_pPyCallbk=PyObject_GetAttrString(mod,callbk_name); return S_OK; } Can some one please suggest how to solve this. or is there a better way to pass python function to COM objects. Thanks for any clue or suggestions. Regards, Anand From mhammond at skippinet.com.au Sat May 15 07:21:50 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat May 15 07:22:09 2004 Subject: [python-win32] Fatal Python error:PyThreadState_Get: No currentThread In-Reply-To: <40A5D3B0.5050002@easi.soft.net> Message-ID: <032201c43a6e$d1fa4570$0200a8c0@eden> > // The following my COM object code to get the python callback. > > SetCallBack(BSTR module_name, BSTR callbk_name){ You need to add: PyGILState_STATE state = PyGILState_Ensure(); > PyObject *mod = PyImport_AddModule(module_name); // The Fatal > error is generated while doing this > > > // Actually this calls PyImport_GetModuleDict(); > > > // This is the function which is failing. > if(!mod) return S_OK; > > m_pPyCallbk=PyObject_GetAttrString(mod,callbk_name); and at *every* single exit point (including the one above - 'goto error;' is what I tend to use) PyGILState_Release(state); > return S_OK; > > } > Can some one please suggest how to solve this. > or is there a better way to pass python function to COM objects. I'm not sure why you are using COM to pass Python stuff around - if you are already assuming Python, then just use the Python API directly without the COM overhead - ie, in your example, "SetCallBack" could just be a method on an object in a regular Python extension. You may have a good reason - in which case, it seems fine! Mark From Chad.CTR.Baber at faa.gov Mon May 17 01:00:55 2004 From: Chad.CTR.Baber at faa.gov (Chad.CTR.Baber@faa.gov) Date: Mon May 17 01:01:20 2004 Subject: [python-win32] Chad CTR Baber/AWA/CNTR/FAA is out of the office. Message-ID: I will be out of the office starting 05/14/2004 and will not return until 06/09/2004. I will respond to your message when I return. From Jim.Vickroy at noaa.gov Mon May 17 10:41:29 2004 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon May 17 10:41:33 2004 Subject: [python-win32] module mssvcrt file locking misunderstanding Message-ID: Hello all, I do not understand the behavior of msvcrt.locking(...); maybe, I do not understand locking in general . Here is a sample session illustrating my confusion: >>> filename = 'file_locks-test' >>> transactor = open(filename, mode='w+b') >>> transactor.seek(0) >>> transactor.write('spam & eggs') >>> import msvcrt >>> transactor.seek(0) >>> msvcrt.locking(transactor.fileno(), msvcrt.LK_LOCK, os.path.getsize(filename)) >>> transactor.read() 'spam & eggs' >>> reader = open(filename, mode='wb') ## 1 ## >>> msvcrt.locking(reader.fileno(), msvcrt.LK_LOCK, os.path.getsize(filename)) ## 2 ## >>> reader.read() ## 3 ## What occurs: IOError: [Errno 9] Bad file descriptor -- at ## 3 ## What I expected: an IOError at statement ## 1 ## or ## 2 ## Why is *reader* granted a lock when *transactor* already has one? My setup: python 2.3.3 win32 build 200 XP Professional with all latest service packs Thanks for your time, -- jv From asu at ritm.msk.ru Tue May 18 01:29:14 2004 From: asu at ritm.msk.ru (=?KOI8-R?Q?=EF=D4=C4=C5=CC_=E1=F3=F5_=C9_=EE=FC=EF?=) Date: Tue May 18 01:27:12 2004 Subject: [python-win32] test Message-ID: <40A99F2A.2040506@ritm.msk.ru> test From asu at ritm.msk.ru Tue May 18 01:39:35 2004 From: asu at ritm.msk.ru (=?UTF-8?B?0J7RgtC00LXQuyDQkNCh0KMg0Lgg0J3QrdCe?=) Date: Tue May 18 01:37:34 2004 Subject: [python-win32] test Message-ID: <40A9A197.9020201@ritm.msk.ru> test From asu at ritm.msk.ru Tue May 18 02:12:15 2004 From: asu at ritm.msk.ru (=?UTF-8?B?0J7RgtC00LXQuyDQkNCh0KMg0Lgg0J3QrdCe?=) Date: Tue May 18 02:10:15 2004 Subject: [python-win32] Python and COM Message-ID: <40A9A93F.2030908@ritm.msk.ru> Hello. I write the program on Python 2.3.3 + win32all (system Windows 2000 Pro). (I have convinced the chief to use Python instead of Visual Basic.) I use technology Microsoft COM. I can not address to a method - there is a mistake (lines 67-69 test.py). See the attached file files.zip I can not understand in any way how to correct the program that there was no mistake. Help, please. More in detail about a problem: I address m_prod = Lib.Products(m_prodID) and I receive type IProduct. Type IProduct2 is necessary for me. I tried different variants (for example m_prod=win32com.client.CastTo(ARKCore, 'IProduct2')). At attempt to address to a method there is a mistake. Anton -------------- next part -------------- A non-text attachment was scrubbed... Name: files.zip Type: application/zip Size: 7528 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040518/57427b8d/files.zip -------------- next part -------------- Scanned by evaluation version of Dr.Web antivirus Daemon http://drweb.ru/unix/ From somesh at qviqsoft.com Tue May 18 08:37:24 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Tue May 18 08:36:01 2004 Subject: [python-win32] Memory Leak & Python Message-ID: <004901c43cd4$e461e250$436a640a@qsoft25> i want to work with some Memory related issues where i want to use python 1. as part of program 2. as testing tool for memory leaks etc how i should use it ? is there ne one who is using for same purpose, and is there Memory leakage problem within Python softwaer itself ? how should i start testing ? Somesh Bartakke Q-Soft Pvt Ltd, Pune (India) -- The tragedy of life is not that it ends so soon, but that we wait so long to begin it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040518/06acf506/attachment.html From michael.beaulieu at sentai.com Tue May 18 10:06:33 2004 From: michael.beaulieu at sentai.com (Michael Beaulieu) Date: Tue May 18 10:19:36 2004 Subject: [python-win32] Error in the generated module for my ocx Message-ID: <40AA1869.4050104@sentai.com> I'm running python 22 win32all build 148 From experimenting with ocx's previously I have managed to create an object using this pattern ''' camtasia = .... EnsureModule( ..... ) recorder = camtasia.CamtasiaRecorder rec = recorder() iface_rec = camtasia.ICamtasiaRecorder(rec) ''' I try to run the following code and I'm not clear on what's happening - something seems out of sync >>> speller = win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-8385-524153480001}', 0, 2, 1) >>> speller.VSSpell >>> sp= speller.VSSpell() Traceback (most recent call last): File "", line 1, in ? File "win32com\gen_py\97F4CED3-9103-11CE-8385-524153480001x0x2x1.py", line 726, in __init__ TypeError: 'str' object is not callable The generated module contains the class source below and if I replace the default_class and default_source values with the classnames in place of the ID's I no longer get the error, but I haven't tested the actual OCX yet, so I don't know if something else is wrong. What do I have to do to ensure the proper creation of the module, because I'd like to have this work in an exe I'm creating and so far id doesn't work thanks, Mike ########### from the generated module ############################ class CoClassBaseClass: def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) self.__dict__["_dispobj_"] = self.default_interface(oobj) # this is line 726 def __repr__(self): return "" % (__doc__, self.__class__.__name__) def __getattr__(self, attr): d=self.__dict__["_dispobj_"] if d is not None: return getattr(d, attr) raise AttributeError, attr def __setattr__(self, attr, value): if self.__dict__.has_key(attr): self.__dict__[attr] = value; return try: d=self.__dict__["_dispobj_"] if d is not None: d.__setattr__(attr, value) return except AttributeError: pass self.__dict__[attr] = value class VSSpell(CoClassBaseClass): # A CoClass # VCI VisualSpeller Spellchecker CLSID = pythoncom.MakeIID("{97F4CED0-9103-11CE-8385-524153480001}") coclass_sources = [ '{97F4CED2-9103-11CE-8385-524153480001}', ] default_source = '{97F4CED2-9103-11CE-8385-524153480001}' coclass_interfaces = [ '{97F4CED1-9103-11CE-8385-524153480001}', ] default_interface = '{97F4CED1-9103-11CE-8385-524153480001}' ############# end of clip ############# _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From asu at ritm.msk.ru Tue May 18 01:50:46 2004 From: asu at ritm.msk.ru (=?UTF-8?B?0J7RgtC00LXQuyDQkNCh0KMg0Lgg0J3QrdCe?=) Date: Tue May 18 10:20:12 2004 Subject: [python-win32] Python and COM Message-ID: <40A9A436.2080504@ritm.msk.ru> Hello. I write the program on Python 2.3.3 + win32all (system Windows 2000 Pro). (I have convinced the chief to use Python instead of Visual Basic.) I use technology Microsoft COM. I can not address to a method - there is a mistake (lines 67-69 test.py). See the attached file files.zip I can not understand in any way how to correct the program that there was no mistake. Help, please. More in detail about a problem: I address m_prod = Lib.Products(m_prodID) and I receive type IProduct. Type IProduct2 is necessary for me. I tried different variants (for example m_prod=win32com.client.CastTo(ARKCore, 'IProduct2')). At attempt to address to a method there is a mistake. Anton -------------- next part -------------- A non-text attachment was scrubbed... Name: files.zip Type: application/zip Size: 23581 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040518/fbe04aa6/files-0001.zip -------------- next part -------------- Scanned by evaluation version of Dr.Web antivirus Daemon http://drweb.ru/unix/ From cgadgil_list at cxoindia.dnsalias.com Tue May 18 23:53:48 2004 From: cgadgil_list at cxoindia.dnsalias.com (Chetan Gadgil) Date: Tue May 18 23:53:35 2004 Subject: [python-win32] Memory Leak & Python In-Reply-To: <004901c43cd4$e461e250$436a640a@qsoft25> Message-ID: <00bf01c43d54$e40eaa10$5b0aa8c0@cxodt03> Somesh You could use the WMI APIs either through the COM integration or through one of the .NET integrations available for python. I am assuming that you want to do this on win32. If not, for platforms such as Solaris/Linux etc. you could either grab the outputs of tools such as prstat/top or use the corresponding C API calls. And no, Python does not leave any intentional memory leaks by itself. It depends on you whether you leak memory or not. Of course the answer to this question also varies from time to time, as at any given point in time, Python may or may not happen to have memory leaks in its implementation. These are usually fixed in subsequent releases, if detected. Chetan -- ""I think it is safe to say that no one understands quantum mechanics." - Richard P. Feynman -----Original Message----- From: python-win32-bounces@python.org [mailto:python-win32-bounces@python.org] On Behalf Of Somesh Bartakke Sent: Tuesday, May 18, 2004 6:07 PM To: python-win32@python.org Subject: [python-win32] Memory Leak & Python i want to work with some Memory related issues where i want to use python 1. as part of program 2. as testing tool for memory leaks etc how i should use it ? is there ne one who is using for same purpose, and is there Memory leakage problem within Python softwaer itself ? how should i start testing ? Somesh Bartakke Q-Soft Pvt Ltd, Pune (India) -- The tragedy of life is not that it ends so soon, but that we wait so long to begin it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040519/18a5223a/attachment.html From somesh at qviqsoft.com Wed May 19 00:35:34 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Wed May 19 00:34:15 2004 Subject: [python-win32] Memory Leak & Python References: <00bf01c43d54$e40eaa10$5b0aa8c0@cxodt03> Message-ID: <002901c43d5a$c0b058b0$436a640a@qsoft25> thanX chetan, yeh, i want to use the script for win32 platform only. You could use the WMI APIs either through the COM integration or through one of the .NET integrations available for python. do you have any examples ? or is there any tool/help available on net ? I think it is also safe to say that no one understands wot is understood by him ! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040519/db0cc573/attachment.html From cgadgil_list at cxoindia.dnsalias.com Wed May 19 01:16:49 2004 From: cgadgil_list at cxoindia.dnsalias.com (Chetan Gadgil) Date: Wed May 19 01:16:42 2004 Subject: [python-win32] Memory Leak & Python In-Reply-To: <002901c43d5a$c0b058b0$436a640a@qsoft25> Message-ID: <00da01c43d60$82306160$5b0aa8c0@cxodt03> http://tgolden.sc.sabren.com/python/wmi.html -- ""I think it is safe to say that no one understands quantum mechanics." - Richard P. Feynman -----Original Message----- From: Somesh Bartakke [mailto:somesh@qviqsoft.com] Sent: Wednesday, May 19, 2004 10:06 AM To: Chetan Gadgil Cc: python-win32@python.org Subject: Re: [python-win32] Memory Leak & Python thanX chetan, yeh, i want to use the script for win32 platform only. You could use the WMI APIs either through the COM integration or through one of the .NET integrations available for python. do you have any examples ? or is there any tool/help available on net ? I think it is also safe to say that no one understands wot is understood by him ! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040519/1b787b6b/attachment-0001.html From master at hilug.org Wed May 19 03:36:59 2004 From: master at hilug.org (Y.H. Rhiu) Date: Wed May 19 03:36:51 2004 Subject: [python-win32] Converting VBScript using WMI to Python: data type problem Message-ID: <00c901c43d74$14628c80$dc3fe7cb@greatstream> Hi, I'd like to write a python script that create IIS site and virtual directories, using WMI. But I have a problem with converting sample VBScript code to Python code: ' Source: http://www.microsoft.com/resources/documentation/windowsserv/2003/datacenter/proddocs/en-us/prog_wmi_tut_03_03.asp?frame=true set locatorObj = CreateObject("WbemScripting.SWbemLocator") set providerObj = locatorObj.ConnectServer("MyMachine", "root/MicrosoftIISv2") set serviceObj = providerObj.Get("IIsWebService='W3SVC'") Bindings = Array(0) Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_() Bindings(0).IP = "" Bindings(0).Port = "8383" Bindings(0).Hostname = "" Dim strSiteObjPath strSiteObjPath = serviceObj.CreateNewSite("MyNewSite", Bindings, "C:\Inetpub\Wwwroot") from win32com.client import * locatorObj = Dispatch("WbemScripting.SWbemLocator") providerObj = locatorObj.ConnectServer(".", "root/MicrosoftIISv2") serviceObj = providerObj.Get("IIsWebService='W3SVC'") Bindings = providerObj.Get("ServerBinding").SpawnInstance_() Bindings.Properties_('Hostname').Value = 'mydomain.com' Bindings.Properties_('IP').Value = '' Bindings.Properties_('Port').Value = '80' InParam = serviceObj.Methods_('CreateNewSite').InParameters.SpawnInstance_() InParam.Properties_('PathOfRootVirtualDir').Value = 'c:\\inetpub\\wwwroot' InParam.Properties_('ServerComment').Value = 'my web site' InParam.Properties_('ServerBindings').Value = Bindings # ERROR occurs here strSiteObjPath = serviceObj.ExecMethod_('CreateNewSite',InParam) I think the problem is a conflict of data type on 15th line in above code. Can I have a solution of workaround for this? Any guidance will be appreciated. __ Y.H. Rhiu From tim.golden at viacom-outdoor.co.uk Wed May 19 06:24:14 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed May 19 06:26:13 2004 Subject: [python-win32] Converting VBScript using WMI to Python: data type problem Message-ID: | Hi, I'd like to write a python script that create IIS site and virtual | directories, using WMI. | But I have a problem with converting sample VBScript code to | Python code: [... snip VBScript ...] | | from win32com.client import * | | locatorObj = Dispatch("WbemScripting.SWbemLocator") | providerObj = locatorObj.ConnectServer(".", "root/MicrosoftIISv2") | serviceObj = providerObj.Get("IIsWebService='W3SVC'") | Bindings = providerObj.Get("ServerBinding").SpawnInstance_() | | Bindings.Properties_('Hostname').Value = 'mydomain.com' | Bindings.Properties_('IP').Value = '' | Bindings.Properties_('Port').Value = '80' | | InParam = | serviceObj.Methods_('CreateNewSite').InParameters.SpawnInstance_() | InParam.Properties_('PathOfRootVirtualDir').Value = | 'c:\\inetpub\\wwwroot' | InParam.Properties_('ServerComment').Value = 'my web site' | InParam.Properties_('ServerBindings').Value = Bindings # | ERROR occurs here | | strSiteObjPath = serviceObj.ExecMethod_('CreateNewSite',InParam) | First, I sympathise with you: WMI can be such a pain to work with. The module I've written takes some of the grief away by hiding the plumbing: http://tgolden.sc.sabren.com/python/wmi.html If you use that, then your code translates as below. BUT... I also get an error trying to pass in the binding, to do with SAFEARRAYs. If I get a few more moments (and further access to a friendly Win2k3 machine) I'll try to investigate further. import wmi connection = wmi.connect_server (server=".", namespace="root/MicrosoftIISv2") c = wmi.WMI (wmi=connection) # # Could as well be achieved by doing: # web_server = c.IISWebService (Name="W3SVC")[0] # for web_server in c.IIsWebService (Name="W3SVC"): break binding = c.new ("ServerBinding") binding.IP = "" binding.Port = "8383" binding.Hostname = "" web_server.CreateNewSite ( PathOfRootVirtualDir=r"c:\inetpub\wwwroot", ServerComment="My Web Site", ServerBindings= [binding] ) TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tim.golden at viacom-outdoor.co.uk Wed May 19 06:38:37 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed May 19 06:40:37 2004 Subject: [python-win32] Converting VBScript using WMI to Python: data type problem Message-ID: Y.H. Rhiu | | Hi, I'd like to write a python script that create IIS site | and virtual | | directories, using WMI. | | But I have a problem with converting sample VBScript code to | | Python code: OK, I've got it. What you need is this: import wmi connection = wmi.connect_server (server=".", namespace="root/MicrosoftIISv2") c = wmi.WMI (wmi=connection) # # Could as well be achieved by doing: # web_server = c.IISWebService (Name="W3SVC")[0] # for web_server in c.IIsWebService (Name="W3SVC"): break binding = c.new ("ServerBinding") binding.IP = "" binding.Port = "8383" binding.Hostname = "" web_server.CreateNewSite ( PathOfRootVirtualDir=r"c:\inetpub\wwwroot", ServerComment="My Web Site", ServerBindings= [binding.ole_object] ) The significant thing is that for the ServerBindings parameter to the CreateNewSite method at the end, you need (a) to pass in a sequence (albeit of one entry) and (b) to have the objects in that array be the ole_object normally delegated to by the wmi_object. It's a bit messy, and I'd probably like to do something a bit more automatic for the future. But it works. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From mhammond at skippinet.com.au Wed May 19 10:31:40 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 19 10:32:02 2004 Subject: [python-win32] Error in the generated module for my ocx In-Reply-To: <40AA1869.4050104@sentai.com> Message-ID: <081101c43dae$01b772a0$0200a8c0@eden> Find the "prog id" of your object, and create it using win32com.client.Dispatch(), rather than trying to create it directly from the generated module. Mark > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Michael Beaulieu > Sent: Wednesday, 19 May 2004 12:07 AM > To: python-win32@python.org > Subject: [python-win32] Error in the generated module for my ocx > > > I'm running python 22 > win32all build 148 > > From experimenting with ocx's previously I have managed to create an > object using this pattern > ''' > camtasia = .... EnsureModule( ..... ) > recorder = camtasia.CamtasiaRecorder > rec = recorder() > iface_rec = camtasia.ICamtasiaRecorder(rec) > ''' > > I try to run the following code and I'm not clear on what's > happening - > something seems out of sync > > >>> speller = > win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-838 > 5-524153480001}', > 0, 2, 1) > >>> speller.VSSpell > win32com.gen_py.97F4CED3-9103-11CE-8385-524153480001x0x2x1.VSSpell at > 0x01254928> > >>> sp= speller.VSSpell() > Traceback (most recent call last): > File "", line 1, in ? > File > "win32com\gen_py\97F4CED3-9103-11CE-8385-524153480001x0x2x1.py", > line 726, in __init__ > TypeError: 'str' object is not callable > > The generated module contains the class source below and if I replace > the default_class and default_source values with the > classnames in place > of the ID's I no longer get the error, but I haven't tested > the actual > OCX yet, so I don't know if something else is wrong. > > What do I have to do to ensure the proper creation of the module, > because I'd like to have this work in an exe I'm creating and > so far id > doesn't work > > thanks, > Mike > > ########### from the generated module ############################ > > class CoClassBaseClass: > def __init__(self, oobj=None): > if oobj is None: oobj = pythoncom.new(self.CLSID) > self.__dict__["_dispobj_"] = self.default_interface(oobj) # > this is line 726 > def __repr__(self): > return "" % (__doc__, > self.__class__.__name__) > > def __getattr__(self, attr): > d=self.__dict__["_dispobj_"] > if d is not None: return getattr(d, attr) > raise AttributeError, attr > def __setattr__(self, attr, value): > if self.__dict__.has_key(attr): self.__dict__[attr] = > value; return > try: > d=self.__dict__["_dispobj_"] > if d is not None: > d.__setattr__(attr, value) > return > except AttributeError: > pass > self.__dict__[attr] = value > > class VSSpell(CoClassBaseClass): # A CoClass > # VCI VisualSpeller Spellchecker > CLSID = pythoncom.MakeIID("{97F4CED0-9103-11CE-8385-524153480001}") > coclass_sources = [ > '{97F4CED2-9103-11CE-8385-524153480001}', > ] > default_source = '{97F4CED2-9103-11CE-8385-524153480001}' > coclass_interfaces = [ > '{97F4CED1-9103-11CE-8385-524153480001}', > ] > default_interface = '{97F4CED1-9103-11CE-8385-524153480001}' > > > > ############# end of clip ############# > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Wed May 19 10:32:31 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 19 10:32:47 2004 Subject: [python-win32] Python and COM In-Reply-To: <40A9A93F.2030908@ritm.msk.ru> Message-ID: <081401c43dae$1ea266e0$0200a8c0@eden> If IProduct is not derived from IDispatch, than at the moment you can not call it from win32com. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of ????? ??? ? ??? > Sent: Tuesday, 18 May 2004 4:12 PM > To: python-win32@python.org > Subject: [python-win32] Python and COM > > > > Hello. > I write the program on Python 2.3.3 + win32all (system > Windows 2000 Pro). > (I have convinced the chief to use Python instead of Visual Basic.) > I use technology Microsoft COM. > > I can not address to a method - there is a mistake (lines > 67-69 test.py). > See the attached file files.zip > I can not understand in any way how to correct the program that there > was no mistake. > Help, please. > > More in detail about a problem: > > I address m_prod = Lib.Products(m_prodID) and I receive type IProduct. > Type IProduct2 is necessary for me. > I tried different variants (for example > m_prod=win32com.client.CastTo(ARKCore, 'IProduct2')). > At attempt to address to a method there is a mistake. > > > Anton > > > From michael.beaulieu at sentai.com Wed May 19 15:50:28 2004 From: michael.beaulieu at sentai.com (Michael Beaulieu) Date: Wed May 19 17:45:20 2004 Subject: [python-win32] Error in the generated module for my ocx References: <081101c43dae$01b772a0$0200a8c0@eden> Message-ID: <40ABBA84.4030109@sentai.com> if I run : sp = win32com.client.Dispatch("VSPELLER.VSpellCtrl.1") # got the name from the registry print dir(sp) I get the following: ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__cmp__', '__doc__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_' , '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_'] I'm not sure what to do with these!! What interface am I actually using? There are not methods I can call and I don't even have the _prop_map_get_ and _prop_map_put_ dictionaries that I'm guessing is part of the automagic of python integration. when I had this running previously ( by hacking the generated module ) I could do this : sp.OpenStandard = "american.vtd" now I get: Traceback (most recent call last): File "PageForm.py", line 4787, in OnSpellClick sp.OpenStandard= "american.vtd" File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 504, in__setattr__ raise AttributeError, "Property '%s.%s' can not be set." % (self._username_, attr) AttributeError: Property 'VSPELLER.VSpellCtrl.1.OpenStandard' can not be set. what is it? print sp.OpenStandard gives: > call it : sp.OpenStandard("american.vtd") which gives: Traceback (most recent call last): File "PageForm.py", line 4788, in OnSpellClick sp.OpenStandard("american.vtd") File "", line 2, in OpenStandard ValueError: invalid literal for int(): american.vtd ok use the contant for the american dict dict thedict = spellermodule.constants.VSLANG_AMERICAN sp.OpenStandard( thedict ) and this gives: Traceback (most recent call last): File "PageForm.py", line 4789, in OnSpellClick sp.OpenStandard(speller.constants.VSLANG_AMERICAN) File "", line 2, in OpenStandard pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None) Any explanation would help this beginner immensely thanks, mike Mark Hammond wrote: >Find the "prog id" of your object, and create it using >win32com.client.Dispatch(), rather than trying to create it directly from >the generated module. > >Mark > > > >>-----Original Message----- >>From: python-win32-bounces@python.org >>[mailto:python-win32-bounces@python.org]On Behalf Of Michael Beaulieu >>Sent: Wednesday, 19 May 2004 12:07 AM >>To: python-win32@python.org >>Subject: [python-win32] Error in the generated module for my ocx >> >> >>I'm running python 22 >>win32all build 148 >> >> From experimenting with ocx's previously I have managed to create an >>object using this pattern >>''' >>camtasia = .... EnsureModule( ..... ) >>recorder = camtasia.CamtasiaRecorder >>rec = recorder() >>iface_rec = camtasia.ICamtasiaRecorder(rec) >>''' >> >>I try to run the following code and I'm not clear on what's >>happening - >>something seems out of sync >> >> >>> speller = >>win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-838 >>5-524153480001}', >>0, 2, 1) >> >>> speller.VSSpell >>>win32com.gen_py.97F4CED3-9103-11CE-8385-524153480001x0x2x1.VSSpell at >>0x01254928> >> >>> sp= speller.VSSpell() >>Traceback (most recent call last): >> File "", line 1, in ? >> File >>"win32com\gen_py\97F4CED3-9103-11CE-8385-524153480001x0x2x1.py", >>line 726, in __init__ >>TypeError: 'str' object is not callable >> >>The generated module contains the class source below and if I replace >>the default_class and default_source values with the >>classnames in place >>of the ID's I no longer get the error, but I haven't tested >>the actual >>OCX yet, so I don't know if something else is wrong. >> >>What do I have to do to ensure the proper creation of the module, >>because I'd like to have this work in an exe I'm creating and >>so far id >>doesn't work >> >>thanks, >>Mike >> >>########### from the generated module ############################ >> >>class CoClassBaseClass: >> def __init__(self, oobj=None): >> if oobj is None: oobj = pythoncom.new(self.CLSID) >> self.__dict__["_dispobj_"] = self.default_interface(oobj) # >>this is line 726 >> def __repr__(self): >> return "" % (__doc__, >>self.__class__.__name__) >> >> def __getattr__(self, attr): >> d=self.__dict__["_dispobj_"] >> if d is not None: return getattr(d, attr) >> raise AttributeError, attr >> def __setattr__(self, attr, value): >> if self.__dict__.has_key(attr): self.__dict__[attr] = >>value; return >> try: >> d=self.__dict__["_dispobj_"] >> if d is not None: >> d.__setattr__(attr, value) >> return >> except AttributeError: >> pass >> self.__dict__[attr] = value >> >>class VSSpell(CoClassBaseClass): # A CoClass >> # VCI VisualSpeller Spellchecker >> CLSID = pythoncom.MakeIID("{97F4CED0-9103-11CE-8385-524153480001}") >> coclass_sources = [ >> '{97F4CED2-9103-11CE-8385-524153480001}', >> ] >> default_source = '{97F4CED2-9103-11CE-8385-524153480001}' >> coclass_interfaces = [ >> '{97F4CED1-9103-11CE-8385-524153480001}', >> ] >> default_interface = '{97F4CED1-9103-11CE-8385-524153480001}' >> >> >> >>############# end of clip ############# >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 >> >> > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > From michael.beaulieu at sentai.com Wed May 19 17:41:21 2004 From: michael.beaulieu at sentai.com (Michael Beaulieu) Date: Wed May 19 18:00:43 2004 Subject: [python-win32] Error in the generated module for my ocx References: <081101c43dae$01b772a0$0200a8c0@eden> Message-ID: <40ABD481.9070009@sentai.com> if I run : sp = win32com.client.Dispatch("VSPELLER.VSpellCtrl.1") # got the name from the registry print dir(sp) I get the following: ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__cmp__', '__doc__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_' , '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_'] I'm not sure what to do with these!! What interface am I actually using? There are not methods I can call and I don't even have the _prop_map_get_ and _prop_map_put_ dictionaries that I'm guessing is part of the automagic of python integration. when I had this running previously ( by hacking the generated module ) I could do this : sp.OpenStandard = "american.vtd" now I get: Traceback (most recent call last): File "PageForm.py", line 4787, in OnSpellClick sp.OpenStandard= "american.vtd" File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 504, in__setattr__ raise AttributeError, "Property '%s.%s' can not be set." % (self._username_, attr) AttributeError: Property 'VSPELLER.VSpellCtrl.1.OpenStandard' can not be set. what is it? print sp.OpenStandard gives: > call it : sp.OpenStandard("american.vtd") which gives: Traceback (most recent call last): File "PageForm.py", line 4788, in OnSpellClick sp.OpenStandard("american.vtd") File "", line 2, in OpenStandard ValueError: invalid literal for int(): american.vtd ok use the contant for the american dict dict thedict = spellermodule.constants.VSLANG_AMERICAN sp.OpenStandard( thedict ) and this gives: Traceback (most recent call last): File "PageForm.py", line 4789, in OnSpellClick sp.OpenStandard(speller.constants.VSLANG_AMERICAN) File "", line 2, in OpenStandard pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None) Any explanation would help this beginner immensely thanks, mike Mark Hammond wrote: > Find the "prog id" of your object, and create it using > win32com.client.Dispatch(), rather than trying to create it directly from > the generated module. > > Mark > > > >> -----Original Message----- >> From: python-win32-bounces@python.org >> [mailto:python-win32-bounces@python.org]On Behalf Of Michael Beaulieu >> Sent: Wednesday, 19 May 2004 12:07 AM >> To: python-win32@python.org >> Subject: [python-win32] Error in the generated module for my ocx >> >> >> I'm running python 22 >> win32all build 148 >> >> From experimenting with ocx's previously I have managed to create an >> object using this pattern >> ''' >> camtasia = .... EnsureModule( ..... ) >> recorder = camtasia.CamtasiaRecorder >> rec = recorder() >> iface_rec = camtasia.ICamtasiaRecorder(rec) >> ''' >> >> I try to run the following code and I'm not clear on what's >> happening - >> something seems out of sync >> >> >>> speller = >> win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-838 >> 5-524153480001}', >> 0, 2, 1) >> >>> speller.VSSpell >> > win32com.gen_py.97F4CED3-9103-11CE-8385-524153480001x0x2x1.VSSpell at >> 0x01254928> >> >>> sp= speller.VSSpell() >> Traceback (most recent call last): >> File "", line 1, in ? >> File >> "win32com\gen_py\97F4CED3-9103-11CE-8385-524153480001x0x2x1.py", >> line 726, in __init__ >> TypeError: 'str' object is not callable >> >> The generated module contains the class source below and if I replace >> the default_class and default_source values with the >> classnames in place >> of the ID's I no longer get the error, but I haven't tested >> the actual >> OCX yet, so I don't know if something else is wrong. >> >> What do I have to do to ensure the proper creation of the module, >> because I'd like to have this work in an exe I'm creating and >> so far id >> doesn't work >> >> thanks, >> Mike >> >> ########### from the generated module ############################ >> >> class CoClassBaseClass: >> def __init__(self, oobj=None): >> if oobj is None: oobj = pythoncom.new(self.CLSID) >> self.__dict__["_dispobj_"] = self.default_interface(oobj) # >> this is line 726 >> def __repr__(self): >> return "" % (__doc__, >> self.__class__.__name__) >> >> def __getattr__(self, attr): >> d=self.__dict__["_dispobj_"] >> if d is not None: return getattr(d, attr) >> raise AttributeError, attr >> def __setattr__(self, attr, value): >> if self.__dict__.has_key(attr): self.__dict__[attr] = >> value; return >> try: >> d=self.__dict__["_dispobj_"] >> if d is not None: >> d.__setattr__(attr, value) >> return >> except AttributeError: >> pass >> self.__dict__[attr] = value >> >> class VSSpell(CoClassBaseClass): # A CoClass >> # VCI VisualSpeller Spellchecker >> CLSID = pythoncom.MakeIID("{97F4CED0-9103-11CE-8385-524153480001}") >> coclass_sources = [ >> '{97F4CED2-9103-11CE-8385-524153480001}', >> ] >> default_source = '{97F4CED2-9103-11CE-8385-524153480001}' >> coclass_interfaces = [ >> '{97F4CED1-9103-11CE-8385-524153480001}', >> ] >> default_interface = '{97F4CED1-9103-11CE-8385-524153480001}' >> >> >> >> ############# end of clip ############# >> >> >> _______________________________________________ >> Python-win32 mailing list >> Python-win32@python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> >> _______________________________________________ >> Python-win32 mailing list >> Python-win32@python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From michael.beaulieu at sentai.com Wed May 19 17:48:46 2004 From: michael.beaulieu at sentai.com (Michael Beaulieu) Date: Wed May 19 18:00:45 2004 Subject: [python-win32] Error creating activex control References: <081101c43dae$01b772a0$0200a8c0@eden> Message-ID: <40ABD63E.3010400@sentai.com> I have some activex controls I'm trying to use from python. I have installed the runtime libraries and I can see them in the pythonwin COM browser but when I try to create one I get the following error. File "C:\PrgOther\Python23\lib\site-packages\win32com\client\__init__.py", line 485, in __init__ if oobj is None: oobj = pythoncom.new(self.CLSID) pywintypes.com_error: (-2147221230, 'Class is not licensed for use', None, None) I have a licence for it, what do I do with the licence so it doesn't fail? Thanks, Mike From mhammond at skippinet.com.au Wed May 19 20:53:02 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 19 20:53:19 2004 Subject: [python-win32] Error creating activex control In-Reply-To: <40ABD63E.3010400@sentai.com> Message-ID: <0d1301c43e04$ce7ee330$0200a8c0@eden> I'm afraid it looks like you can't - we don't expose IClassFactory2. I thought we did have a way, but can't find it now :( Please add a bug at sourceforge - we should be able to do that! Mark. > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au@python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On > Behalf Of Michael Beaulieu > Sent: Thursday, 20 May 2004 7:49 AM > Cc: python-win32@python.org > Subject: [python-win32] Error creating activex control > > > I have some activex controls I'm trying to use from python. > I have installed the runtime libraries and I can see them in the > pythonwin COM browser but when I try to create one I get the > following > error. > > File > "C:\PrgOther\Python23\lib\site-packages\win32com\client\__init__.py", > line 485, in __init__ > if oobj is None: oobj = pythoncom.new(self.CLSID) > pywintypes.com_error: (-2147221230, 'Class is not licensed for use', > None, None) > > I have a licence for it, what do I do with the licence so it > doesn't fail? > > Thanks, > Mike > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Wed May 19 20:57:32 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed May 19 20:57:47 2004 Subject: [python-win32] Error in the generated module for my ocx In-Reply-To: <40ABD481.9070009@sentai.com> Message-ID: <0d1c01c43e05$6f0e4020$0200a8c0@eden> > if I run : > sp = win32com.client.Dispatch("VSPELLER.VSpellCtrl.1") # got > the name > from the registry > print dir(sp) > I get the following: > > ['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', > '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__cmp__', > '__doc__', '__getattr__', '__getitem__', '__init__', '__int__', > '__len__', '__module__', '__nonzero__', '__repr__', '__setattr__', > '__setitem__', '__str__', '_builtMethods_', '_enum_', > '_find_dispatch_type_', '_get_good_object_', > '_get_good_single_object_', > '_lazydata_' > , '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', > '_print_details_', '_proc_', '_unicode_to_string_', '_username_', > '_wrap_dispatch_'] > > > I'm not sure what to do with these!! These are all internal implementation details of "dynamic dispatch". It sounds like your object is not correctly reporting its type information. Try doing: # get the module speller = win32com.client.gencache.EnsureModule('{97F4CED3-9103-11CE-8385-524153480001 }', 0, 2, 1) # get the object ob = win32com.client.Dispatch("VSPELLER.VSpellCtrl.1") # and force it in. ob = speller.VSSpell(ob) > What interface am I actually > using? There are not methods I can call and I don't even have the > _prop_map_get_ and _prop_map_put_ dictionaries that I'm guessing is > part of the automagic of python integration. It is. As Python discovers methods (ie, as you successfully use/try to use them), these get filled on. For some (older) COM objects, these are pre-filled. Mark From andywil at nortelnetworks.com Thu May 20 05:21:34 2004 From: andywil at nortelnetworks.com (Andy Wilson) Date: Thu May 20 05:22:01 2004 Subject: [python-win32] ftp retrlines problem Message-ID: <588B15E2E2B1D41180B800508BF934F20D8FCB0F@bmdhd6.europe.nortel.com> Ho Folks, I am having a few head scratching issues with ftplib, I would appreciate any advice: My code is:- ftp_dest = "wctfsxxx.europe.nortel.com" ftp_user = "ccps" ftp_pass = string.rstrip (lines[0]) # password stored in a file ftp = FTP (ftp_dest) ftp.login (ftp_user, ftp_pass) ftp.cwd (external_dir) ftp.retrlines('LIST' ) At this point I get "Sequence index out of range: list index out of range" The same code works in the Python intrepreter, so I know I am connected. Any ideas? Regards, Andy Wilson CCPS Technical Prime ________________________________________________________ Nortel Networks, Belfast Lab, Doagh Rd, Newtownabbey, Co Antrim, BT36 6XA, United Kingdom Phone... +44 (1628) 617065 ESN 861-7065 Mobile... +44 (7710) 875958 ESN 748-5958 Yahoo ID : glawsterok _________________________ andywil@nortelnetworks.com ___ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040520/13a0546b/attachment.html From jpbarrette at savoirfairelinux.net Thu May 20 11:42:41 2004 From: jpbarrette at savoirfairelinux.net (Jean-Philippe Barrette-LaPierre) Date: Thu May 20 11:44:00 2004 Subject: [python-win32] Quickbooks and COM Message-ID: <40ACD1F1.5090509@savoirfairelinux.net> I'm using the Quickbooks SDK. This SDK allow us to receive events from the application. Events are sent by COM. I need to implement a IQBEventCallback. It's from QBSDKEVENT type lib. with the function win32com.client.gencache.MakeModuleForTypelib I get this. ----------------------------------------------------------- # -*- coding: mbcs -*- # Created by makepy.py version 0.4.91 # By python version 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] # From type library '{941BD791-06C1-4D4D-8F6A-8F685810DD5E}' # On Thu May 20 10:41:21 2004 """QBSDKEvent 1.0 Type Library""" makepy_version = '0.4.91' python_version = 0x20303f0 import win32com.client.CLSIDToClass, pythoncom import win32com.client.util from pywintypes import IID from win32com.client import Dispatch # The following 3 lines may need tweaking for the particular server # Candidates are pythoncom.Missing and pythoncom.Empty defaultNamedOptArg=pythoncom.Empty defaultNamedNotOptArg=pythoncom.Empty defaultUnnamedArg=pythoncom.Empty CLSID = IID('{941BD791-06C1-4D4D-8F6A-8F685810DD5E}') MajorVersion = 1 MinorVersion = 0 LibraryFlags = 8 LCID = 0x0 IQBEventCallback_vtables_dispatch_ = 0 IQBEventCallback_vtables_ = [ (('inform', 'eventXML'), 1610678272, (1610678272, (), [(8, 1, None, None)], 1, 1, 4, 0, 12, (3, 0, None, None), 0)), ] RecordMap = { } CLSIDToClassMap = { } CLSIDToPackageMap = {} win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap ) VTablesToPackageMap = {} VTablesToClassMap = { '{A3A4E33E-E747-48CF-947B-93FDE67FF72F}' : 'IQBEventCallback', } NamesToIIDMap = { 'IQBEventCallback' : '{A3A4E33E-E747-48CF-947B-93FDE67FF72F}', } ------------------------------------------------------------------- now the question is: "What do I need to do to implement this interface?". P.S.: I'm not familiar with COMs. From actuary77 at comcast.net Thu May 20 11:45:46 2004 From: actuary77 at comcast.net (David Koch) Date: Thu May 20 11:47:24 2004 Subject: [python-win32] How to set up scripting engine Message-ID: <40ACD2AA.3090402@comcast.net> How do you set up the scripting engine? pywin32-201, python 2.3.3, windows 2k The default in to not allow active scripting because of security issues. How can I modify pyscript.py, framework.py, etc. to permit active scripting in html pages, wsh, etc in 'any' environment where security is NOT an issue? Thanks for the help. david Koch From rwupole at msn.com Sun May 23 19:43:30 2004 From: rwupole at msn.com (Roger Upole) Date: Sun May 23 19:27:07 2004 Subject: [python-win32] Anybody using win32security.SetSecurityInfo ? Message-ID: <000a01c4411f$c2882370$7a17c943@rupole> I'm going to make a change to the parms for this function that's not backward compatible. Specifically, the SECURITY_INFORMATION value will now have to be passed in also. Also, the error checking is backwards right now, so that when the Api call succeeds, it throws a Python error, and when it fails None is returned. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040523/455df2f7/attachment.html From acidrex at earthlink.net Mon May 24 17:43:42 2004 From: acidrex at earthlink.net (acidblue) Date: Mon May 24 17:43:48 2004 Subject: [python-win32] Adding dates/usr input Message-ID: <002701c441d8$32446120$0a4ffea9@amdbox> Trying to add dates togetther, with user input. print datetime.date.today()=datetime.timedelta(days=90) that works fine for today's date , but I want user's to enter their own date. What would the syntax be? Udate=raw("Date:") print datetime.date.Udate()+datetime.timedelta(days=90)??? Obviouslly this dosen't work, any suggetions? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040524/7674175d/attachment.html From niki at vintech.bg Tue May 25 09:06:17 2004 From: niki at vintech.bg (Niki Spahiev) Date: Tue May 25 09:07:29 2004 Subject: [python-win32] Error in the generated module for my ocx In-Reply-To: <0d1c01c43e05$6f0e4020$0200a8c0@eden> References: <0d1c01c43e05$6f0e4020$0200a8c0@eden> Message-ID: <40B344C9.8020307@vintech.bg> Mark Hammond wrote: > > > These are all internal implementation details of "dynamic dispatch". > > It sounds like your object is not correctly reporting its type information. I have similar problem with an app i try to automate. Version 6 stopped to work as expected (version 5 was ok) and needs explicit interface casts: x = tlb_generated_module.SomeInterface(x) What is correct way for reporting type information, especially default interface? regards, Niki Spahiev From b.hall at irl.cri.nz Thu May 27 02:07:35 2004 From: b.hall at irl.cri.nz (Blair Hall) Date: Thu May 27 02:08:09 2004 Subject: [python-win32] PythonWin in the shortcut menu Message-ID: <5.2.0.9.1.20040527180309.02615ae0@127.0.0.1> I've just installed the recent versions of Python and Pythonwin on a new Windows XP machine. In the past (with older versions), when right-clicking on a '.py' file in the Explorer, there was a shortcut menu option to 'edit' and another to 'edit with IDLE'. After my recent installation, I only get the latter 'edit with IDLE'. Is there some way for me to add the former 'edit' shortcut, which opened the file using Pythonwin? From mbg at apama.com Fri May 28 06:24:47 2004 From: mbg at apama.com (Moray B. Grieve) Date: Fri May 28 06:24:59 2004 Subject: [python-win32] Basic win32pdh calls on windows 2003 server Message-ID: <7CD4BE0203A91845A17CE0E8BD9A1289BD17E5@ukcamms002.msapama.apama.com> I'm having some problems running basic win32pdh commands on windows 2003 servers. Making a simple call to win32pdh.EnumObjects(None, None, 0, 1) produces the following; pywintypes.error: (-2147481648, 'EnumObjects for buffer size', 'No error message is available') This call runs fine on WinNT, 2000, 2000 server, XP etc. Does anyone know why this may be happening? I have seen this with Python 2.3.4 and win32all 1.6.3, as well as older versions of both. Thanks in advance for any help on this. Moray From benn at cenix-bioscience.com Fri May 28 08:49:24 2004 From: benn at cenix-bioscience.com (Neil Benn) Date: Fri May 28 08:49:29 2004 Subject: [python-win32] Install error Message-ID: <40B73554.7080109@cenix-bioscience.com> Hello, I'm attempting to install the win32 on PCs running Python 2.3.3 (2000 and XP). The installer ends with a windows error (Illegal operation), win32all still works after this but I thought someone may wish to know. It's happened on three separate PCs for me. Cheers, Neil -- Neil Benn Senior Automation Engineer Cenix BioScience BioInnovations Zentrum Tatzberg 46 D-01307 Dresden Germany Tel : +49 (0)351 4173 154 e-mail : benn@cenix-bioscience.com Cenix Website : http://www.cenix-bioscience.com From greglandrum at mindspring.com Fri May 28 17:49:11 2004 From: greglandrum at mindspring.com (greg Landrum) Date: Fri May 28 17:49:19 2004 Subject: [python-win32] Problems with automation in newer versions of win32all Message-ID: <5.1.0.14.2.20040528142400.045433e0@mail.earthlink.net> Upon upgrading to Python 2.3 and installing the most recent version of win32all (build 163), some frequently used COM client code ceased to function. The exception I'm seeing is: File "chemdraw.py", line 89, in CDXConvert theObjs.SetData(inFormat,inData) File "c:\Python23\Lib\site-packages\win32com\gen_py\5F646AAB-3B56-48D2-904C-A68D7989C251x0x7x0.py", line 416, in SetData return self._oleobj_.InvokeTypes(21, LCID, 4, (24, 0), ((12, 17), (12, 17),(12, 17), (12, 17), (12, 1)),dataType, resolution, Width, Height, arg4) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352571), 5) The definition of SetData() (from the auto-generated file) looks like this: # The method SetData is actually a property, but must be used as a method to correctly pass the arguments def SetData(self, dataType=defaultNamedNotOptArg, resolution=defaultNamedNotOptArg, Width=defaultNamedNotOptArg, Height=defaultNamedNotOptArg, arg4=defaultUnnamedArg): """Returns the data of the objects.""" return self._oleobj_.InvokeTypes(21, LCID, 4, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 1)),dataType, resolution, Width, Height, arg4) SetData() is being called with proper arguments (2 strings) I first encountered this problem about a year ago using Python 2.2 and discovered that it started at build 150 of win32all (my earlier message about this same problem can be found at URL: http://aspn.activestate.com/ASPN/Mail/Message/Python-win32/1686417 ). My "solution" then was to just stick with using build 148. Unfortunately, now that I've switched to Python 2.3, this is no longer an option. This is a serious problem for us, I would be very grateful for any solutions or work-arounds. Thanks -greg From cwilcox at etcconnect.com Fri May 28 17:58:38 2004 From: cwilcox at etcconnect.com (Christian Wilcox) Date: Fri May 28 17:58:44 2004 Subject: [python-win32] Problems with automation in newer versions ofwin32all Message-ID: <1AFF07010C7F1345A5406FD325580D2A1A0BC8@MIDL-MAILV.etclink.net> >Upon upgrading to Python 2.3 and installing the most recent version of win32all(build 163), some frequently used COM client code ceased to function. I believe build 201 is the most recent release of pywin32 (the new name of the win32 extensions). You might want verify that's what you are using... Best regards, Christian Wilcox From greglandrum at mindspring.com Fri May 28 18:20:05 2004 From: greglandrum at mindspring.com (greg Landrum) Date: Fri May 28 18:20:11 2004 Subject: [python-win32] Problems with automation in newer versions ofwin32all In-Reply-To: <1AFF07010C7F1345A5406FD325580D2A1A0BC8@MIDL-MAILV.etclink. net> Message-ID: <5.1.0.14.2.20040528151818.04543be0@mail.mindspring.com> At 02:58 PM 5/28/2004, Christian Wilcox wrote: > >Upon upgrading to Python 2.3 and installing the most recent version of >win32all(build 163), some frequently used COM client code ceased to >function. > >I believe build 201 is the most recent release of pywin32 (the new name >of the win32 extensions). You might want verify that's what you are >using... I was stupidly still using 163 (the most recent version on starship), but I just upgraded to 201.1 from sourceforge and encountered the same problem. Thanks for pointing out the version problem though. -greg From somesh at qviqsoft.com Sat May 29 02:48:50 2004 From: somesh at qviqsoft.com (Somesh Bartakke) Date: Sat May 29 02:47:30 2004 Subject: [python-win32] dll, ctypes and functions Message-ID: <007301c44549$053958b0$436a640a@qsoft25> hello, i want to use my dll file in my python program. am using python 2.3 + ctypes for that. bu tmy function exported from dll is not getting called. dll is OK bcause its working from another VC program wel. Wot may be wrong ? or how to use dll with win32all / pywin32 package ? Somesh Bartakke Q-Soft Pvt Ltd, Pune (India) -- The tragedy of life is not that it ends so soon, but that we wait so long to begin it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040529/4833e7ca/attachment.html From mhammond at skippinet.com.au Sun May 30 05:17:00 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun May 30 05:17:23 2004 Subject: [python-win32] Problems with automation in newer versions ofwin32all In-Reply-To: <5.1.0.14.2.20040528142400.045433e0@mail.earthlink.net> Message-ID: <10d301c44626$dde83220$0200a8c0@eden> My guess is that the default params are causing some problems. Try explicitly passing each param, passing either pythoncom.Missing, or pythoncom.Empty, for the params you would otherwise exclude. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of greg Landrum > Sent: Saturday, 29 May 2004 7:49 AM > To: python-win32@python.org > Subject: [python-win32] Problems with automation in newer versions > ofwin32all > > > > Upon upgrading to Python 2.3 and installing the most recent > version of win32all (build 163), some frequently used COM > client code ceased to function. > > The exception I'm seeing is: > File "chemdraw.py", line 89, in CDXConvert > theObjs.SetData(inFormat,inData) > File > "c:\Python23\Lib\site-packages\win32com\gen_py\5F646AAB-3B56-4 > 8D2-904C-A68D7989C251x0x7x0.py", line 416, in SetData > return self._oleobj_.InvokeTypes(21, LCID, 4, (24, 0), > ((12, 17), (12, 17),(12, 17), (12, 17), (12, 1)),dataType, > resolution, Width, Height, arg4) > pywintypes.com_error: (-2147352567, 'Exception occurred.', > (0, None, None, None, 0, -2147352571), 5) > > The definition of SetData() (from the auto-generated file) > looks like this: > # The method SetData is actually a property, but must > be used as a method to correctly pass the arguments > def SetData(self, dataType=defaultNamedNotOptArg, > resolution=defaultNamedNotOptArg, > Width=defaultNamedNotOptArg, Height=defaultNamedNotOptArg, > arg4=defaultUnnamedArg): > """Returns the data of the objects.""" > return self._oleobj_.InvokeTypes(21, LCID, 4, > (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, > 1)),dataType, resolution, Width, Height, arg4) > > SetData() is being called with proper arguments (2 strings) > > I first encountered this problem about a year ago using > Python 2.2 and discovered that it started at build 150 of > win32all (my earlier message about this same problem can be > found at URL: > http://aspn.activestate.com/ASPN/Mail/Message/Python-win32/168 6417 ). My "solution" then was to just stick with using build 148. Unfortunately, now that I've switched to Python 2.3, this is no longer an option. This is a serious problem for us, I would be very grateful for any solutions or work-arounds. Thanks -greg _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Sun May 30 05:17:38 2004 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sun May 30 05:17:57 2004 Subject: [python-win32] Basic win32pdh calls on windows 2003 server In-Reply-To: <7CD4BE0203A91845A17CE0E8BD9A1289BD17E5@ukcamms002.msapama.apama.com> Message-ID: <10d401c44626$f4a40cf0$0200a8c0@eden> This is fixed in build 201, from sourceforge.net/projects/pywin32 Mark > -----Original Message----- > From: python-win32-bounces+mhammond=keypoint.com.au@python.org > [mailto:python-win32-bounces+mhammond=keypoint.com.au@python.org]On > Behalf Of Moray B. Grieve > Sent: Friday, 28 May 2004 8:25 PM > To: python-win32@python.org > Subject: [python-win32] Basic win32pdh calls on windows 2003 server > > > I'm having some problems running basic win32pdh commands on > windows 2003 > servers. Making a simple call to win32pdh.EnumObjects(None, > None, 0, 1) > produces the following; > > pywintypes.error: (-2147481648, 'EnumObjects for buffer > size', 'No error > message is available') > > This call runs fine on WinNT, 2000, 2000 server, XP etc. Does anyone > know why this may be happening? I have seen this with Python 2.3.4 and > win32all 1.6.3, as well as older versions of both. > > Thanks in advance for any help on this. > > Moray > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 2172 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040530/d50d86d0/winmail.bin From mlist at asesoft.ro Mon May 31 06:15:38 2004 From: mlist at asesoft.ro (MailingList) Date: Mon May 31 06:23:27 2004 Subject: [python-win32] (no subject) Message-ID: <07ea01c446f8$38826580$7560a8c0@asesoft.intl> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040531/23066506/attachment.html