From kw_win at wtwinsoftware.com Thu Sep 1 14:39:48 2011 From: kw_win at wtwinsoftware.com (Kevin Walzer) Date: Thu, 1 Sep 2011 08:39:48 -0400 Subject: [python-win32] AppData directory on Windows? Message-ID: Hi, I?m getting feedback from a Windows user that says my Tkinter app won?t write data to an app temporary directory. Here?s my code: sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') And here?s the error message: Traceback (most recent call last): File "QuickWho.py", line 7, in File "quickwho_main.pyc", line 28, in IOError: [Errno 2] No such file or directory: 'C:\\Users\\Softpedia\\Application Data\\QuickWho\\QuickWho_errors.txt' Do I have the correct path to a user?s app data directory? I tested this without issue on Windows 7. I?m not supporting versions of Windows prior to 7, but I thought this would work on any version > Windows XP. Please advise. Thank you, Kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu Sep 1 14:49:02 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 01 Sep 2011 13:49:02 +0100 Subject: [python-win32] AppData directory on Windows? In-Reply-To: References: Message-ID: <4E5F7F3E.7080302@timgolden.me.uk> On 01/09/2011 13:39, Kevin Walzer wrote: > Hi, > I?m getting feedback from a Windows user that says my Tkinter app won?t > write data to an app temporary directory. Here?s my code: > sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application > Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') This is a little brittle. I imagine it will at least break from non-English versions of Windows. It will also break for versions of Python prior to 2.5? when expanduser was expanded to include Windows. The simplest approach is to use the APPDATA env var which goes back a few versions (certainly to XP, probably Win 2000). Alternatively, you can use the Windows Shell API to query the same thing -- this should go back even further if you've got someone using something truly prehistoric. TJG From drobinow at gmail.com Thu Sep 1 15:28:54 2011 From: drobinow at gmail.com (David Robinow) Date: Thu, 1 Sep 2011 09:28:54 -0400 Subject: [python-win32] AppData directory on Windows? In-Reply-To: <4E5F7F3E.7080302@timgolden.me.uk> References: <4E5F7F3E.7080302@timgolden.me.uk> Message-ID: On Thu, Sep 1, 2011 at 8:49 AM, Tim Golden wrote: > On 01/09/2011 13:39, Kevin Walzer wrote: >> >> Hi, >> I?m getting feedback from a Windows user that says my Tkinter app won?t >> write data to an app temporary directory. Here?s my code: >> sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application >> Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') > > This is a little brittle. I imagine it will at least break > from non-English versions of Windows. It will also break > for versions of Python prior to 2.5? when expanduser was > expanded to include Windows. It also breaks if the user has set the HOME environment variable (not uncommon for Cygwin users) > > The simplest approach is to use the APPDATA env var which > goes back a few versions (certainly to XP, probably Win 2000). i.e., os.environ['APPDATA'] Also, 'open' will not create the 'QuickWho' directory for you. You may need: os.mkdir(os.path.join(os.environ['APPDATA'], 'QuickWho')) > > Alternatively, you can use the Windows Shell API to query the > same thing -- this should go back even further if you've got > someone using something truly prehistoric. From werner.bruhin at free.fr Thu Sep 1 16:04:53 2011 From: werner.bruhin at free.fr (Werner F. Bruhin) Date: Thu, 01 Sep 2011 16:04:53 +0200 Subject: [python-win32] AppData directory on Windows? In-Reply-To: <4E5F7F3E.7080302@timgolden.me.uk> References: <4E5F7F3E.7080302@timgolden.me.uk> Message-ID: On 09/01/2011 02:49 PM, Tim Golden wrote: > On 01/09/2011 13:39, Kevin Walzer wrote: >> Hi, >> I?m getting feedback from a Windows user that says my Tkinter app won?t >> write data to an app temporary directory. Here?s my code: >> sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application >> Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') > > This is a little brittle. I imagine it will at least break > from non-English versions of Windows. It will also break > for versions of Python prior to 2.5? when expanduser was > expanded to include Windows. > > The simplest approach is to use the APPDATA env var which > goes back a few versions (certainly to XP, probably Win 2000). > > Alternatively, you can use the Windows Shell API to query the > same thing -- this should go back even further if you've got > someone using something truly prehistoric. > Not that this helps Kevin, in wxPython there is "wx.StandardPaths" which does a pretty good job of getting the right path. Was hoping that I could point you to the source, but it looks that this is mostly implemented in wxWidget and therefore is in C++ and not in Python. Would be nice to have something like this in pure Python - anyone who "speaks" C++ and has some free time on his/her hand:). Werner From mail at timgolden.me.uk Thu Sep 1 16:09:19 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 01 Sep 2011 15:09:19 +0100 Subject: [python-win32] AppData directory on Windows? In-Reply-To: References: <4E5F7F3E.7080302@timgolden.me.uk> Message-ID: <4E5F920F.4090904@timgolden.me.uk> On 01/09/2011 15:04, Werner F. Bruhin wrote: > On 09/01/2011 02:49 PM, Tim Golden wrote: >> On 01/09/2011 13:39, Kevin Walzer wrote: >>> Hi, >>> I?m getting feedback from a Windows user that says my Tkinter app won?t >>> write data to an app temporary directory. Here?s my code: >>> sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application >>> Data', 'QuickWho', 'QuickWho_errors.txt'), 'w') >> >> This is a little brittle. I imagine it will at least break >> from non-English versions of Windows. It will also break >> for versions of Python prior to 2.5? when expanduser was >> expanded to include Windows. >> >> The simplest approach is to use the APPDATA env var which >> goes back a few versions (certainly to XP, probably Win 2000). >> >> Alternatively, you can use the Windows Shell API to query the >> same thing -- this should go back even further if you've got >> someone using something truly prehistoric. >> > Not that this helps Kevin, in wxPython there is "wx.StandardPaths" which > does a pretty good job of getting the right path. > > Was hoping that I could point you to the source, but it looks that this > is mostly implemented in wxWidget and therefore is in C++ and not in > Python. > > Would be nice to have something like this in pure Python - anyone who > "speaks" C++ and has some free time on his/her hand:). This might help...? http://timgolden.me.uk/python/winshell.html TJG From kw_win at wtwinsoftware.com Thu Sep 1 16:45:01 2011 From: kw_win at wtwinsoftware.com (Kevin Walzer) Date: Thu, 1 Sep 2011 10:45:01 -0400 Subject: [python-win32] AppData directory on Windows? In-Reply-To: <4E5F920F.4090904@timgolden.me.uk> References: <4E5F7F3E.7080302@timgolden.me.uk> <4E5F920F.4090904@timgolden.me.uk> Message-ID: -----Original Message----- This might help...? http://timgolden.me.uk/python/winshell.html ----- The os.environ['appdata'] bit worked fine for me, thanks for suggesting it. That winshell package looks quite nice--I will check it out. --Kevin From btimby at gmail.com Thu Sep 1 19:29:03 2011 From: btimby at gmail.com (Ben Timby) Date: Thu, 1 Sep 2011 13:29:03 -0400 Subject: [python-win32] checking file permission on network share In-Reply-To: <4E5E2B57.2040708@gns-systems.de> References: <4E5E2B57.2040708@gns-systems.de> Message-ID: On Wed, Aug 31, 2011 at 8:38 AM, Steffen Fr?mer wrote: > Hello, > > i try to check, if a file on network-share is read only. I tried different > ways. Not the prettiest, but if you want to know if the SHARE is read only, you can do a functional test. import os, tempfile def check_write(filename): try: fd, fn = tempfile.mkstemp(dir=os.path.dirname(filename)) os.close(fd) os.remove(fn) except: return False else: return True Does Windows Explorer show files on the share as read only when you view their properties? It all depends on whether Samba advertises the share's read only state via file attributes, looks like it does not. From mail at timgolden.me.uk Fri Sep 2 11:58:12 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 02 Sep 2011 10:58:12 +0100 Subject: [python-win32] checking file permission on network share In-Reply-To: <4E5E2B57.2040708@gns-systems.de> References: <4E5E2B57.2040708@gns-systems.de> Message-ID: <4E60A8B4.406@timgolden.me.uk> On 31/08/2011 13:38, Steffen Fr?mer wrote: > i try to check, if a file on network-share is read only. I tried > different ways. What you're checking is the readonly attribute (which has been there since DOS version x.0). If that is what you intended to check, then I don't think I can offer anything: you're doing exactly what I've have done myself. The only qualifier is that read-only on a directory has no real meaning on Windows: the OS uses it as a marker that the directory is system-special (eg My Documents). But if you're checking a file then what you're doing seems valid. However, if you're trying to determine whether a file is available for writing by the current user regardless of the setting of the readonly attribute, then your code won't help. You've got two options: * Attempt to get a write lock on the file (without actually writing anything, obviously) and if that fails with Access Denied then you're not allowed to write. (It also fails if the read-only attribute is set). import win32file import win32con import ntsecuritycon filename = r"c:\windows\system32\drivers\etc\hosts", win32file.CreateFile ( ntsecuritycon.FILE_GENERIC_WRITE, 0, ## exclusive write None, win32con.OPEN_ALWAYS, 0, None ) * Use the less-than-straightforward AccessCheck API which isn't exposed by core Python nor by the pywin32 extensions. (Frankly, I should just contribute a patch to pywin32 since it gets asked for often enough). TJG From mail at timgolden.me.uk Fri Sep 2 12:00:31 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 02 Sep 2011 11:00:31 +0100 Subject: [python-win32] checking file permission on network share In-Reply-To: <4E60A8B4.406@timgolden.me.uk> References: <4E5E2B57.2040708@gns-systems.de> <4E60A8B4.406@timgolden.me.uk> Message-ID: <4E60A93F.6020803@timgolden.me.uk> On 02/09/2011 10:58, Tim Golden wrote: > filename = r"c:\windows\system32\drivers\etc\hosts", > win32file.CreateFile ( > ntsecuritycon.FILE_GENERIC_WRITE, 0, ## exclusive write > None, win32con.OPEN_ALWAYS, 0, None > ) Just noticed that my code is unnecessarily trying to get an exclusive lock. You probably want SHARE-everything mode otherwise you risk locking other users out of that file however transiently. TJG From rodperson at rodperson.com Fri Sep 2 14:33:21 2011 From: rodperson at rodperson.com (Rod Person) Date: Fri, 2 Sep 2011 08:33:21 -0400 Subject: [python-win32] WMI Win32_LoggedOnUser help Message-ID: <20110902083321.e5a8d2dc.rodperson@rodperson.com> Hi, I've been experimenting with the wmi module and so far everything is working great, but I'm having an issue with the Win32_LoggedOnUser class. I can seem to access it's properties. When I run the code in debug I can see the information I want is being stored in the object but all attempts to access it throw an error. Example: c = wmi.WMI (computer='CCBH-01') ls = c.Win32_LogonSession() for l in ls: print l.LogonId u = c.Win32_LoggedOnUser() Now in my debugger ls hold a list of objects, type of each object is None, but the value is _wmi_object containing a Win32_LogonSession object which allows the for loop and print to work. In the debugger display it looks like this: Name Type Value ls list [0] None <_wmi_object: \\CCBH-01\root\cimv2: Win32_LogonSession.LogonId="999"> {repeated for all member of the list} Now in the case of u, it looks like this in the debugger: Name Type Value u list [0] None <_wmi_object: \\CCBH-01\root\cimv2: Win32_LoggedOnUser.Antecedent="\ \\\.\ \root\ \cimv2: Win32_Account.Domain=\"CCBH-01\", Name= \"SYSTEM \"",Dependent="\\ \ \. \ \root \ \cimv2:Win32_LogonSession.LogonId= \"999 \""> In my thinking I should have been able to access the Antecedent property which would have return a Win32_Account object and then been able to access the Name property of that, such as; account = u[0].Antecedent print account.Name The above throws this error on the first line: x_wmi: If I try and access the LogonId property I get an AttributeError. I have a work around of casting the values as a str() then parsing the string to get the values I need, but I'd really prefer to access the objects retrieved directly. I hope this makes since. Thanks! Rod -- "Every time I think of pushing you down the stairs, I lick my lips" - "Bones In the Water" Battle Of Mice From mail at timgolden.me.uk Fri Sep 2 15:56:10 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 02 Sep 2011 14:56:10 +0100 Subject: [python-win32] WMI Win32_LoggedOnUser help In-Reply-To: <20110902083321.e5a8d2dc.rodperson@rodperson.com> References: <20110902083321.e5a8d2dc.rodperson@rodperson.com> Message-ID: <4E60E07A.4070300@timgolden.me.uk> On 02/09/2011 13:33, Rod Person wrote: > Hi, > > I've been experimenting with the wmi module and so far everything is > working great, but I'm having an issue with the Win32_LoggedOnUser > class. I can seem to access it's properties. When I run the code in > debug I can see the information I want is being stored in the object > but all attempts to access it throw an error. I'm not entirely sure if this is what you're after, but I *think* it is: import wmi c = wmi.WMI () for session in c.Win32_LogonSession (): print "Session", session.LogonId for associated_user in session.references ("Win32_LoggedOnUser"): print associated_user.Antecedent TJG From rodperson at rodperson.com Fri Sep 2 16:05:44 2011 From: rodperson at rodperson.com (Rod Person) Date: Fri, 2 Sep 2011 10:05:44 -0400 Subject: [python-win32] WMI Win32_LoggedOnUser help In-Reply-To: <4E60E07A.4070300@timgolden.me.uk> References: <20110902083321.e5a8d2dc.rodperson@rodperson.com> <4E60E07A.4070300@timgolden.me.uk> Message-ID: <20110902100544.a7676f5a.rodperson@rodperson.com> On Fri, 02 Sep 2011 14:56:10 +0100 Tim Golden wrote: > I'm not entirely sure if this is what you're after, but I > *think* it is: > > > import wmi > > c = wmi.WMI () > for session in c.Win32_LogonSession (): > print "Session", session.LogonId > for associated_user in session.references ("Win32_LoggedOnUser"): > print associated_user.Antecedent > That is exactly it. Thank You! -- "Every time I think of pushing you down the stairs, I lick my lips" - "Bones In the Water" Battle Of Mice From M.Schulte-Oversohl at pragmatis.de Fri Sep 2 17:50:28 2011 From: M.Schulte-Oversohl at pragmatis.de (Manfred Schulte-Oversohl) Date: Fri, 2 Sep 2011 17:50:28 +0200 Subject: [python-win32] Pythonwin MDI Child Size In-Reply-To: References: Message-ID: This is a way I solved it, maybe someone is interested. class ScrollView(pywin.mfc.docview.ScrollView): def OnInitialUpdate(self): #... frame = win32ui.GetMainFrame() rect = frame.GetClientRect() self.SetScrollSizes(win32con.MM_TEXT, (rect[2] - 18, rect[3] -55)) self.GetParentFrame().RecalcLayout() self.ResizeParentToFit(0) #... Cheers Manfred -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chester_Lab at fltg.net Sun Sep 4 00:03:06 2011 From: Chester_Lab at fltg.net (FT) Date: Sat, 3 Sep 2011 18:03:06 -0400 Subject: [python-win32] Hot to call methods and properties from VBS? Message-ID: <003101cc6a85$468e0950$6401a8c0@brucehseog9r4k> Hi, I am a blind programmer and want to know how you set up the com or automation to call python modules, functions, methods and properties? I searched the web and could not find anything except an example to place script within a scroipt. But I don't want that, I want to call a python object to be able to run that module inside VB script inside the screen reader script program language which uses VBS. Any examples and tutorials would be helpful. Just need to know how to get the com object or automation to be able to call any python module and run it at will. Sincerely Bruce -------------- next part -------------- An HTML attachment was scrubbed... URL: From Chester_Lab at fltg.net Sun Sep 4 15:35:45 2011 From: Chester_Lab at fltg.net (FT) Date: Sun, 4 Sep 2011 09:35:45 -0400 Subject: [python-win32] How to call Python methods and properties from VBS? Message-ID: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> Hi Again, To be more specific I have compiled the Python inside a distributed package and need to know how to call from within that compiled package any method. In other words do I have to register the Python inside my .vbs script before calling any methods? I am saying this so another user does not need to install Python, just call using com inside the distributed Python compiled version. If so, how do I get the Python setup or in a form to call? I will be doing all the calls from .VBS and how would the CreateObject from there be done to setup to call the compiled Python interpreter? Bruce First Post: Hi, I am a blind programmer and want to know how you set up the com or automation to call python modules, functions, methods and properties? I searched the web and could not find anything except an example to place script within a script. But I don't want that, I want to call a python object to be able to run that module inside VB script inside the screen reader script program language which uses VBS. Any examples and tutorials would be helpful. Just need to know how to get the com object or automation to be able to call any python module and run it at will. Sincerely Bruce -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at kateandchris.net Sun Sep 4 20:27:34 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Sun, 4 Sep 2011 14:27:34 -0400 Subject: [python-win32] Hot to call methods and properties from VBS? In-Reply-To: <003101cc6a85$468e0950$6401a8c0@brucehseog9r4k> References: <003101cc6a85$468e0950$6401a8c0@brucehseog9r4k> Message-ID: An online resource is: http://oreilly.com/catalog/pythonwin32/chapter/ch12.html#51294 That contains all the basics of how to define an object and register it to be available via COM (i.e. to be able to use the object from VBScript). There is also documentation that comes with Pywin32. The documentation gets added to the Start Menu folder of the Python version you installed for and is called "Python for Windows Documentation". So it would be something like Start > All Programs > Python 2.7 > Python for Windows Documentation. There is an article included in that help called "Quick Start to Server side COM and Python". There is also the "win32com Documentation Index" which links to the various Python and com related pages in that documentation file. -Chris 2011/9/3 FT : > > Hi, > ??? I am a blind programmer and want to know how you set up the com or > automation to call python modules, functions, methods and properties? > > ??? I searched the web and could not find anything except an example to > place script within a scroipt. But I don't want that, I want to call a > python object to be able to run that module inside VB script inside the > screen reader script program language which uses VBS. > > ??? Any examples and tutorials would be helpful. Just need to know how to > get the com object or automation to be able to call any python module and > run it at will. > > ??? ??? Sincerely > ??????? Bruce > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- Christopher Lambacher chris at kateandchris.net From skippy.hammond at gmail.com Mon Sep 5 02:25:26 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 05 Sep 2011 10:25:26 +1000 Subject: [python-win32] Fwd: Re: win32com + Excel + Django + Apache = problem In-Reply-To: References: Message-ID: <4E6416F6.7060608@gmail.com> Just incase this helps anyone... Mark -------------- next part -------------- An embedded message was scrubbed... From: Ittai Chorev Subject: Re: [python-win32] win32com + Excel + Django + Apache = problem Date: Sun, 4 Sep 2011 18:10:19 +0300 Size: 3573 URL: -------------- next part -------------- An embedded message was scrubbed... From: Ittai Chorev Subject: Re: [python-win32] win32com + Excel + Django + Apache = problem Date: Sun, 4 Sep 2011 18:19:13 +0300 Size: 4479 URL: From skippy.hammond at gmail.com Tue Sep 6 00:51:38 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 06 Sep 2011 08:51:38 +1000 Subject: [python-win32] How to call Python methods and properties from VBS? In-Reply-To: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> Message-ID: <4E65527A.90605@gmail.com> On 4/09/2011 11:35 PM, FT wrote: > Hi Again, > To be more specific I have compiled the Python inside a distributed > package and need to know how to call from within that compiled package > any method. In other words do I have to register the Python inside my > .vbs script before calling any methods? > I am saying this so another user does not need to install Python, just > call using com inside the distributed Python compiled version. > If so, how do I get the Python setup or in a form to call? I will be > doing all the calls from .VBS and how would the CreateObject from there > be done to setup to call the compiled Python interpreter? You should develop and test using normal Python, then once you want to distribute it to others, look into py2exe to "compile" it and an installer program such as nsis or inno so the user can simply install it. Hope this helps, Mark From mhammond at skippinet.com.au Tue Sep 6 06:24:03 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 06 Sep 2011 14:24:03 +1000 Subject: [python-win32] How to call Python methods and properties from VBS? In-Reply-To: <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> <4E65527A.90605@gmail.com> <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> Message-ID: <4E65A063.9050109@skippinet.com.au> Please keep replies on the python-win32 list - others may also be able to help you too. You might like to check out the sample in samples\pywin32\com_server in the py2exe distribution - that demonstrates a simple COM object and has a VBScript sample which calls it. Hope this helps, Mark On 6/09/2011 1:38 PM, FT wrote: > > Hi Mark, > > I wanted to have the python and other modules from a py2exe accessible > from vb script. So I would need to have the best documentation on how to set > up the python com library to be able to call it from vb script. This is not > using a web server, but inside a screen reader script language. The one I am > using is Windoweyes Scripting language which has all or most windows methods > and the external xml file for screen displays. > > I am a blind programmer and use the screen reader with a built in vb > script programming language. So, knowing Python I want to be able to call > those module methods at will. I have made executables but they reside in a > sub directory of Windoweyes and are limited to only what the .exe file does > and not flexible beyond that point. > > I was given snap shots of examples but they are very spotty and actual > say they show a vb script example, but none was displayed. > > I am assuming that you have to make a class for all the modules you want > to be able to call, but not really sure on that. I have spent all evening > trying to find examples and such and came up with almost nothing but an old > activestate 2.4 brief description which said little on what to do. > > So, this is where I am at the moment and have found little to explain > fully what to do. It showed a way to set up the py2exe but the so called > example call from vb script was not there but it said it was. The typical > hello script example. > > So, what I need is a very good tutorial on how to step by step make the > class and compile it to a distributle so it can be registered and called as > a com or automation call from vb script. Using what I would assume to be the > CreatObject command in vbs to make an instance of that object/module/method. > > I am blind, so no pictures, I need just plain text to do it. > > Sincerely > Bruce > > Sent: Monday, September 05, 2011 6:51 PM > Subject: Re: [python-win32] How to call Python methods and properties from > VBS? > > > On 4/09/2011 11:35 PM, FT wrote: >> Hi Again, >> To be more specific I have compiled the Python inside a distributed >> package and need to know how to call from within that compiled package >> any method. In other words do I have to register the Python inside my >> .vbs script before calling any methods? >> I am saying this so another user does not need to install Python, just >> call using com inside the distributed Python compiled version. >> If so, how do I get the Python setup or in a form to call? I will be >> doing all the calls from .VBS and how would the CreateObject from there >> be done to setup to call the compiled Python interpreter? > > You should develop and test using normal Python, then once you want to > distribute it to others, look into py2exe to "compile" it and an > installer program such as nsis or inno so the user can simply install it. > > Hope this helps, > > Mark > From chris at kateandchris.net Tue Sep 6 21:17:45 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Tue, 6 Sep 2011 15:17:45 -0400 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP Message-ID: Hi, Whenever I load an extension using the ActiveX Script for Python in a Classic ASP page, I get an error saying the DLL can't be loaded. I have solved this problem thus far by patching the distutils source for my local Python instance and rebuilding the extension (see http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). Thus far I have suffered no ill effects for doing this, but suspect that what actually needs to happen is that the DLL for the python com server needs to have the MSVCRT part of the manifest instead. I had a quick look at the setup.py for pywin32 build 216 and found the monkey patching of link that includes the _want_assemply_with_crt flag for perfmondata.dll and PyISAPI_loader.dll. Should that list also include the COM Server DLL? Is there a better way to solve this than rebuilding all my compiled extensions to include the full manifest or am I stuck with rebuilding all the time? Thanks, Chris -- Christopher Lambacher chris at kateandchris.net From chris at kateandchris.net Tue Sep 6 21:22:41 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Tue, 6 Sep 2011 15:22:41 -0400 Subject: [python-win32] How to call Python methods and properties from VBS? In-Reply-To: <4E65A063.9050109@skippinet.com.au> References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> <4E65527A.90605@gmail.com> <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> <4E65A063.9050109@skippinet.com.au> Message-ID: *sigh* I responded to him and didn't notice that he only responded to me and the list bounce address. Here is *my* response to Bruce which went to him off list: Hi Bruce, You have to write some Python objects that have special properties that describe the COM interface to expose. That is the "class PythonUtilities: ..." part of the example I linked to. Then there is some magic involved in the "if __name__== '__main__': ..." section of the example. That does the registration and you don't need to point windows to a particular DLL like you would with C based COM server but you need to have Python and pywin32 installed. I have included the if portion below because it is a bit mangled in the web page: # Add code so that when this script is run by # Python.exe, it self-registers. if __name__=='__main__': print "Registering COM server..." import win32com.server.register win32com.server.register.UseCommandLine(PythonUtilities) If you want to not require Python and pywin32 be installed you have to do a little bit more work. Python code does not compile to a DLL, but there are tools that you can use to package things up into their own self contained distributable package. Two options that should work are Py2Exe and PyInstaller. Instructions for configuring Py2Exe to work with a pywin32 com server: http://www.py2exe.org/index.cgi/Py2exeAndWin32com Instructions for configuring PyInstaller: http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html?format=raw#windows-com-server-support My recommendation is to worry about getting your code to work first and then worry about distribution to boxes that don't already have Python and PyWin32. -Chris On Sun, Sep 4, 2011 at 2:57 PM, FT wrote: > Hi Chris, > > I had read that before you responded and could not get a clear picture > there. > > In other words, I have a compiled python library or python.DLL and other > dll's and pyd files. > Which one, or how to get access to them is what I could not find in that > chapter 12 description. > > I wanted to have a compiled Python distribute folder and be able to call > on methods that reside there either in the python.dll or any of the .pyd > files. > > Bruce > On Tue, Sep 6, 2011 at 12:24 AM, Mark Hammond wrote: > Please keep replies on the python-win32 list - others may also be able to > help you too. > > You might like to check out the sample in samples\pywin32\com_server in the > py2exe distribution - that demonstrates a simple COM object and has a > VBScript sample which calls it. > > Hope this helps, > > Mark > > On 6/09/2011 1:38 PM, FT wrote: >> >> Hi Mark, >> >> ? ? I wanted to have the python and other modules from a py2exe accessible >> from vb script. So I would need to have the best documentation on how to >> set >> up the python com library to be able to call it from vb script. This is >> not >> using a web server, but inside a screen reader script language. The one I >> am >> using is Windoweyes Scripting language which has all or most windows >> methods >> and the external xml file for screen displays. >> >> ? ? I am a blind programmer and use the screen reader with a built in vb >> script programming language. So, knowing Python I want to be able to call >> those module methods at will. I have made executables but they reside in a >> sub directory of Windoweyes and are limited to only what the .exe file >> does >> and not flexible beyond that point. >> >> ? ? I was given snap shots of examples but they are very spotty and actual >> say they show a vb script example, but none was displayed. >> >> ? ? I am assuming that you have to make a class for all the modules you >> want >> to be able to call, but not really sure on that. I have spent all evening >> trying to find examples and such and came up with almost nothing but an >> old >> activestate 2.4 brief description which said little on what to do. >> >> ? ? So, this is where I am at the moment and have found little to explain >> fully what to do. It showed a way to set up the py2exe but the so called >> example call from vb script was not there but it said it was. The typical >> hello script example. >> >> ? ? So, what I need is a very good tutorial on how to step by step make >> the >> class and compile it to a distributle so it can be registered and called >> as >> a com or automation call from vb script. Using what I would assume to be >> the >> CreatObject command in vbs to make an instance of that >> object/module/method. >> >> ? ? I am blind, so no pictures, I need just plain text to do it. >> >> ? ? ? ? Sincerely >> ? ? ? ? Bruce >> >> Sent: Monday, September 05, 2011 6:51 PM >> Subject: Re: [python-win32] How to call Python methods and properties from >> VBS? >> >> >> On 4/09/2011 11:35 PM, FT wrote: >>> >>> Hi Again, >>> To be more specific I have compiled the Python inside a distributed >>> package and need to know how to call from within that compiled package >>> any method. In other words do I have to register the Python inside my >>> .vbs script before calling any methods? >>> I am saying this so another user does not need to install Python, just >>> call using com inside the distributed Python compiled version. >>> If so, how do I get the Python setup or in a form to call? I will be >>> doing all the calls from .VBS and how would the CreateObject from there >>> be done to setup to call the compiled Python interpreter? >> >> You should develop and test using normal Python, then once you want to >> distribute it to others, look into py2exe to "compile" it and an >> installer program such as nsis or inno so the user can simply install it. >> >> Hope this helps, >> >> Mark >> > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- Christopher Lambacher chris at kateandchris.net From skippy.hammond at gmail.com Wed Sep 7 04:28:25 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 07 Sep 2011 12:28:25 +1000 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: References: Message-ID: <4E66D6C9.4000409@gmail.com> On 7/09/2011 5:17 AM, Chris Lambacher wrote: > Hi, > > Whenever I load an extension using the ActiveX Script for Python in a > Classic ASP page, I get an error saying the DLL can't be loaded. I > have solved this problem thus far by patching the distutils source for > my local Python instance and rebuilding the extension (see > http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). > Thus far I have suffered no ill effects for doing this, but suspect > that what actually needs to happen is that the DLL for the python com > server needs to have the MSVCRT part of the manifest instead. > > I had a quick look at the setup.py for pywin32 build 216 and found the > monkey patching of link that includes the _want_assemply_with_crt flag > for perfmondata.dll and PyISAPI_loader.dll. Should that list also > include the COM Server DLL? Is there a better way to solve this than > rebuilding all my compiled extensions to include the full manifest or > am I stuck with rebuilding all the time? "In theory" (gotta love that), COM objects should now be hosted by pythoncomloader.dll. This DLL should be built with the CRT manifest included, and the DLL itself has some hacks which should mean the extension modules then loaded don't need the manifest reference - these hacks are the same as made by Python itself (ie, any module which imports correctly under normal Python should also import correctly in a COM object hosted by pythoncomloader.dll. See _build_pycom_loader in the pywin32 setup.py. Is it possible the registration process for asp is still using pythoncomxx.dll as the COM entry-point instead of pythoncomloaderxx.dll? In other words, when you say: > what actually needs to happen is that the DLL for the python com > server needs to have the MSVCRT part of the manifest instead. I believe it already should. Which isn't to say you aren't having a problem - it is just I don't quite understand it :) Mark. From chris at kateandchris.net Wed Sep 7 04:56:46 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Tue, 6 Sep 2011 22:56:46 -0400 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: <4E66D6C9.4000409@gmail.com> References: <4E66D6C9.4000409@gmail.com> Message-ID: Hi Mark, It looks like it is trying to use pythoncomloader26.dll. Maybe it is to due with the Wow64 stuff? I've pasted the Registry values below in case you can get any insight into it. If you have any suggestions about how to go about debugging it. I am happy to put a little effort in here on my end, but this stuff is a little bit beyond my experience. Thanks, Chris Here are what I think are the registry values for the ActiveX Script registration: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}] @="Python ActiveX Scripting Engine" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Debugging] @="0" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented Categories] [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented Categories\{B3EF80D0-68E2-11D0-A689-00C04FD658FF}] [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented Categories\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}] [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented Categories\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}] [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32] "ThreadingModel"="both" @="pythoncomloader26.dll" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\LocalServer32] @="C:\\Python26\\pythonw.exe \"C:\\Python26\\lib\\site-packages\\win32com\\server\\localserver.py\" {DF630910-1C1D-11d0-AE36-8C0F5E000000}" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\ProgID] @="Python.AXScript.2" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\PythonCOM] @="win32com.axscript.client.pyscript.PyScript" [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\VersionIndependentProgID] @="Python" On Tue, Sep 6, 2011 at 10:28 PM, Mark Hammond wrote: > On 7/09/2011 5:17 AM, Chris Lambacher wrote: >> >> Hi, >> >> Whenever I load an extension using the ActiveX Script for Python in a >> Classic ASP page, I get an error saying the DLL can't be loaded. I >> have solved this problem thus far by patching the distutils source for >> my local Python instance and rebuilding the extension (see >> http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). >> Thus far I have suffered no ill effects for doing this, but suspect >> that what actually needs to happen is that the DLL for the python com >> server needs to have the MSVCRT part of the manifest instead. >> >> I had a quick look at the setup.py for pywin32 build 216 and found the >> monkey patching of link that includes the _want_assemply_with_crt flag >> for perfmondata.dll and PyISAPI_loader.dll. Should that list also >> include the COM Server DLL? Is there a better way to solve this than >> rebuilding all my compiled extensions to include the full manifest or >> am I stuck with rebuilding all the time? > > "In theory" (gotta love that), COM objects should now be hosted by > pythoncomloader.dll. ?This DLL should be built with the CRT manifest > included, and the DLL itself has some hacks which should mean the extension > modules then loaded don't need the manifest reference - these hacks are the > same as made by Python itself (ie, any module which imports correctly under > normal Python should also import correctly in a COM object hosted by > pythoncomloader.dll. ?See _build_pycom_loader in the pywin32 setup.py. > > Is it possible the registration process for asp is still using > pythoncomxx.dll as the COM entry-point instead of pythoncomloaderxx.dll? > > In other words, when you say: > >> what actually needs to happen is that the DLL for the python com >> server needs to have the MSVCRT part of the manifest instead. > > I believe it already should. ?Which isn't to say you aren't having a problem > - it is just I don't quite understand it :) > > Mark. > -- Christopher Lambacher chris at kateandchris.net From chris at kateandchris.net Wed Sep 7 05:04:52 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Tue, 6 Sep 2011 23:04:52 -0400 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: References: <4E66D6C9.4000409@gmail.com> Message-ID: I can also confirm that pythoncomloader26.dll has a manifest that includes the MSVCRT as Microsoft.VC90.CRT. -Chris On Tue, Sep 6, 2011 at 10:56 PM, Chris Lambacher wrote: > Hi Mark, > > It looks like it is trying to use pythoncomloader26.dll. Maybe it is > to due with the Wow64 stuff? I've pasted the Registry values below in > case you can get any insight into it. If you have any suggestions > about how to go about debugging it. I am happy to put a little effort > in here on my end, but this stuff is a little bit beyond my > experience. > > Thanks, > Chris > > Here are what I think are the registry values for the ActiveX Script > registration: > > Windows Registry Editor Version 5.00 > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}] > @="Python ActiveX Scripting Engine" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Debugging] > @="0" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{B3EF80D0-68E2-11D0-A689-00C04FD658FF}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32] > "ThreadingModel"="both" > @="pythoncomloader26.dll" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\LocalServer32] > @="C:\\Python26\\pythonw.exe > \"C:\\Python26\\lib\\site-packages\\win32com\\server\\localserver.py\" > {DF630910-1C1D-11d0-AE36-8C0F5E000000}" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\ProgID] > @="Python.AXScript.2" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\PythonCOM] > @="win32com.axscript.client.pyscript.PyScript" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\VersionIndependentProgID] > @="Python" > > > > On Tue, Sep 6, 2011 at 10:28 PM, Mark Hammond wrote: >> On 7/09/2011 5:17 AM, Chris Lambacher wrote: >>> >>> Hi, >>> >>> Whenever I load an extension using the ActiveX Script for Python in a >>> Classic ASP page, I get an error saying the DLL can't be loaded. I >>> have solved this problem thus far by patching the distutils source for >>> my local Python instance and rebuilding the extension (see >>> http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). >>> Thus far I have suffered no ill effects for doing this, but suspect >>> that what actually needs to happen is that the DLL for the python com >>> server needs to have the MSVCRT part of the manifest instead. >>> >>> I had a quick look at the setup.py for pywin32 build 216 and found the >>> monkey patching of link that includes the _want_assemply_with_crt flag >>> for perfmondata.dll and PyISAPI_loader.dll. Should that list also >>> include the COM Server DLL? Is there a better way to solve this than >>> rebuilding all my compiled extensions to include the full manifest or >>> am I stuck with rebuilding all the time? >> >> "In theory" (gotta love that), COM objects should now be hosted by >> pythoncomloader.dll. ?This DLL should be built with the CRT manifest >> included, and the DLL itself has some hacks which should mean the extension >> modules then loaded don't need the manifest reference - these hacks are the >> same as made by Python itself (ie, any module which imports correctly under >> normal Python should also import correctly in a COM object hosted by >> pythoncomloader.dll. ?See _build_pycom_loader in the pywin32 setup.py. >> >> Is it possible the registration process for asp is still using >> pythoncomxx.dll as the COM entry-point instead of pythoncomloaderxx.dll? >> >> In other words, when you say: >> >>> what actually needs to happen is that the DLL for the python com >>> server needs to have the MSVCRT part of the manifest instead. >> >> I believe it already should. ?Which isn't to say you aren't having a problem >> - it is just I don't quite understand it :) >> >> Mark. >> > > > > -- > Christopher Lambacher > chris at kateandchris.net > -- Christopher Lambacher chris at kateandchris.net From mhammond at skippinet.com.au Wed Sep 7 05:09:59 2011 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 07 Sep 2011 13:09:59 +1000 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: References: <4E66D6C9.4000409@gmail.com> Message-ID: <4E66E087.6090503@skippinet.com.au> On 7/09/2011 12:56 PM, Chris Lambacher wrote: > Hi Mark, > > It looks like it is trying to use pythoncomloader26.dll. Maybe it is > to due with the Wow64 stuff? I've pasted the Registry values below in > case you can get any insight into it. If you have any suggestions > about how to go about debugging it. I am happy to put a little effort > in here on my end, but this stuff is a little bit beyond my > experience. That looks right to me. The Wow64 stuff could well be an issue - it appears you have the 32bit version of Python installed (and therefore its COM objects got registered in Wow6432Node) which means these objects will only work with a 32bit version of ASP - but I'm not sure how ASP gets packaged these days on a 64bit OS. However, as you mentioned your problem goes away simply rebuilding the pywin32 extensions with different flags, it doesn't sound like a simple 32bit/64bit problem - can you find the exact changes you had to make to the build process to get things working? Mark > > Thanks, > Chris > > Here are what I think are the registry values for the ActiveX Script > registration: > > Windows Registry Editor Version 5.00 > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}] > @="Python ActiveX Scripting Engine" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Debugging] > @="0" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{B3EF80D0-68E2-11D0-A689-00C04FD658FF}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented > Categories\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}] > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32] > "ThreadingModel"="both" > @="pythoncomloader26.dll" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\LocalServer32] > @="C:\\Python26\\pythonw.exe > \"C:\\Python26\\lib\\site-packages\\win32com\\server\\localserver.py\" > {DF630910-1C1D-11d0-AE36-8C0F5E000000}" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\ProgID] > @="Python.AXScript.2" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\PythonCOM] > @="win32com.axscript.client.pyscript.PyScript" > > [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\VersionIndependentProgID] > @="Python" > > > > On Tue, Sep 6, 2011 at 10:28 PM, Mark Hammond wrote: >> On 7/09/2011 5:17 AM, Chris Lambacher wrote: >>> >>> Hi, >>> >>> Whenever I load an extension using the ActiveX Script for Python in a >>> Classic ASP page, I get an error saying the DLL can't be loaded. I >>> have solved this problem thus far by patching the distutils source for >>> my local Python instance and rebuilding the extension (see >>> http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). >>> Thus far I have suffered no ill effects for doing this, but suspect >>> that what actually needs to happen is that the DLL for the python com >>> server needs to have the MSVCRT part of the manifest instead. >>> >>> I had a quick look at the setup.py for pywin32 build 216 and found the >>> monkey patching of link that includes the _want_assemply_with_crt flag >>> for perfmondata.dll and PyISAPI_loader.dll. Should that list also >>> include the COM Server DLL? Is there a better way to solve this than >>> rebuilding all my compiled extensions to include the full manifest or >>> am I stuck with rebuilding all the time? >> >> "In theory" (gotta love that), COM objects should now be hosted by >> pythoncomloader.dll. This DLL should be built with the CRT manifest >> included, and the DLL itself has some hacks which should mean the extension >> modules then loaded don't need the manifest reference - these hacks are the >> same as made by Python itself (ie, any module which imports correctly under >> normal Python should also import correctly in a COM object hosted by >> pythoncomloader.dll. See _build_pycom_loader in the pywin32 setup.py. >> >> Is it possible the registration process for asp is still using >> pythoncomxx.dll as the COM entry-point instead of pythoncomloaderxx.dll? >> >> In other words, when you say: >> >>> what actually needs to happen is that the DLL for the python com >>> server needs to have the MSVCRT part of the manifest instead. >> >> I believe it already should. Which isn't to say you aren't having a problem >> - it is just I don't quite understand it :) >> >> Mark. >> > > > From chris at kateandchris.net Wed Sep 7 05:24:15 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Tue, 6 Sep 2011 23:24:15 -0400 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: <4E66E087.6090503@skippinet.com.au> References: <4E66D6C9.4000409@gmail.com> <4E66E087.6090503@skippinet.com.au> Message-ID: Hi Mark, I make changes to *other* extensions. I documented the change I made to distuils here: http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660 Basically I disable the step that filters the MSVCRT out of the manifest. And then re-build the extension. I have not yet ventured into building Pywin32. I ended up modifying distutils because of a link to a Python bug when I searched for the error I got when loading a C extension. | can't remember which bug and I would have to muck with things to generate the error again, which I will do, just not tonight :) I have not tried using x64 all the way though, mostly because when I got started with this project I wanted to use Psyco (which was a miserable failure that I have given up on), which only support x86. I'll try to do a simple x64 test and see what I get. I am on win7 so I can select x64 or x32 Application Pools in IIS and not disrupt my other work. I have also determined that I have no reference to pythoncom26.dll, only pythoncomloader26.dll, in my registry. -Chris On Tue, Sep 6, 2011 at 11:09 PM, Mark Hammond wrote: > On 7/09/2011 12:56 PM, Chris Lambacher wrote: >> >> Hi Mark, >> >> It looks like it is trying to use pythoncomloader26.dll. Maybe it is >> to due with the Wow64 stuff? I've pasted the Registry values below in >> case you can get any insight into it. If you have any suggestions >> about how to go about debugging it. I am happy to put a little effort >> in here on my end, but this stuff is a little bit beyond my >> experience. > > That looks right to me. ?The Wow64 stuff could well be an issue - it appears > you have the 32bit version of Python installed (and therefore its COM > objects got registered in Wow6432Node) which means these objects will only > work with a 32bit version of ASP - but I'm not sure how ASP gets packaged > these days on a 64bit OS. > > However, as you mentioned your problem goes away simply rebuilding the > pywin32 extensions with different flags, it doesn't sound like a simple > 32bit/64bit problem - can you find the exact changes you had to make to the > build process to get things working? > > Mark > >> >> Thanks, >> Chris >> >> Here are what I think are the registry values for the ActiveX Script >> registration: >> >> Windows Registry Editor Version 5.00 >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}] >> @="Python ActiveX Scripting Engine" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Debugging] >> @="0" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented >> Categories] >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented >> Categories\{B3EF80D0-68E2-11D0-A689-00C04FD658FF}] >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented >> Categories\{F0B7A1A1-9847-11CF-8F20-00805F2CD064}] >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\Implemented >> Categories\{F0B7A1A2-9847-11CF-8F20-00805F2CD064}] >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32] >> "ThreadingModel"="both" >> @="pythoncomloader26.dll" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\LocalServer32] >> @="C:\\Python26\\pythonw.exe >> \"C:\\Python26\\lib\\site-packages\\win32com\\server\\localserver.py\" >> {DF630910-1C1D-11d0-AE36-8C0F5E000000}" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\ProgID] >> @="Python.AXScript.2" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\PythonCOM] >> @="win32com.axscript.client.pyscript.PyScript" >> >> >> [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\VersionIndependentProgID] >> @="Python" >> >> >> >> On Tue, Sep 6, 2011 at 10:28 PM, Mark Hammond >> ?wrote: >>> >>> On 7/09/2011 5:17 AM, Chris Lambacher wrote: >>>> >>>> Hi, >>>> >>>> Whenever I load an extension using the ActiveX Script for Python in a >>>> Classic ASP page, I get an error saying the DLL can't be loaded. I >>>> have solved this problem thus far by patching the distutils source for >>>> my local Python instance and rebuilding the extension (see >>>> http://groups.google.com/group/isapi_wsgi-dev/msg/aa11ed3058e73660). >>>> Thus far I have suffered no ill effects for doing this, but suspect >>>> that what actually needs to happen is that the DLL for the python com >>>> server needs to have the MSVCRT part of the manifest instead. >>>> >>>> I had a quick look at the setup.py for pywin32 build 216 and found the >>>> monkey patching of link that includes the _want_assemply_with_crt flag >>>> for perfmondata.dll and PyISAPI_loader.dll. Should that list also >>>> include the COM Server DLL? Is there a better way to solve this than >>>> rebuilding all my compiled extensions to include the full manifest or >>>> am I stuck with rebuilding all the time? >>> >>> "In theory" (gotta love that), COM objects should now be hosted by >>> pythoncomloader.dll. ?This DLL should be built with the CRT manifest >>> included, and the DLL itself has some hacks which should mean the >>> extension >>> modules then loaded don't need the manifest reference - these hacks are >>> the >>> same as made by Python itself (ie, any module which imports correctly >>> under >>> normal Python should also import correctly in a COM object hosted by >>> pythoncomloader.dll. ?See _build_pycom_loader in the pywin32 setup.py. >>> >>> Is it possible the registration process for asp is still using >>> pythoncomxx.dll as the COM entry-point instead of pythoncomloaderxx.dll? >>> >>> In other words, when you say: >>> >>>> what actually needs to happen is that the DLL for the python com >>>> server needs to have the MSVCRT part of the manifest instead. >>> >>> I believe it already should. ?Which isn't to say you aren't having a >>> problem >>> - it is just I don't quite understand it :) >>> >>> Mark. >>> >> >> >> > > -- Christopher Lambacher chris at kateandchris.net From Chester_Lab at fltg.net Thu Sep 8 15:20:37 2011 From: Chester_Lab at fltg.net (FT) Date: Thu, 8 Sep 2011 09:20:37 -0400 Subject: [python-win32] How to call Python methods and properties from VBS? References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> <4E65527A.90605@gmail.com> <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> <4E65A063.9050109@skippinet.com.au> Message-ID: <000901cc6e2a$1d16ff70$6401a8c0@brucehseog9r4k> Mark, This script: set interp = CreateObject("Python.Interpreter") interp.Exec "import sys" Is this not calling a local computers installation of Python? I read over several times the Py2Exe docs and the chapter 12 stuff on making the .dll and .exe. I always compile with both being made and test my programs and they work fine. This example that you pointed me to and I had already read seems to indicate that the Python is already on that computer by calling that CreateObject method. It does not answer my original question, for looking around it seems all examples assume the Python is already installed. I read the way you use specific commands inside all definitions to indicate what you want to expose and not expose, but where is the complete example of someone installing th e .dll and or .exe into a machine that does not have Python and registering assuming that? Question number 2, I attempted to download the latest win32 packages one compiled/built July 2009 and May of this year. In both cases I could not install the .exe and the error was saying both are corrupted! Now, I need a direct link to the actual download and not a third party, jump, moved to another page link, for I think I may have been directed to a virus loaded page to download these files. So, I need a good example on what I had asked below and the page to have the latest Python2.5 com and win32 packages to run with, for I have only 2007 versions on my computer. Sincerely Bruce Sent: Tuesday, September 06, 2011 12:24 AM Subject: Re: [python-win32] How to call Python methods and properties from VBS? Please keep replies on the python-win32 list - others may also be able to help you too. You might like to check out the sample in samples\pywin32\com_server in the py2exe distribution - that demonstrates a simple COM object and has a VBScript sample which calls it. Hope this helps, Mark On 6/09/2011 1:38 PM, FT wrote: > > Hi Mark, > > I wanted to have the python and other modules from a py2exe accessible > from vb script. So I would need to have the best documentation on how to set > up the python com library to be able to call it from vb script. This is not > using a web server, but inside a screen reader script language. The one I am > using is Windoweyes Scripting language which has all or most windows methods > and the external xml file for screen displays. > > I am a blind programmer and use the screen reader with a built in vb > script programming language. So, knowing Python I want to be able to call > those module methods at will. I have made executables but they reside in a > sub directory of Windoweyes and are limited to only what the .exe file does > and not flexible beyond that point. > > I was given snap shots of examples but they are very spotty and actual > say they show a vb script example, but none was displayed. > > I am assuming that you have to make a class for all the modules you want > to be able to call, but not really sure on that. I have spent all evening > trying to find examples and such and came up with almost nothing but an old > activestate 2.4 brief description which said little on what to do. > > So, this is where I am at the moment and have found little to explain > fully what to do. It showed a way to set up the py2exe but the so called > example call from vb script was not there but it said it was. The typical > hello script example. > > So, what I need is a very good tutorial on how to step by step make the > class and compile it to a distributle so it can be registered and called as > a com or automation call from vb script. Using what I would assume to be the > CreatObject command in vbs to make an instance of that object/module/method. > > I am blind, so no pictures, I need just plain text to do it. > > Sincerely > Bruce > > Sent: Monday, September 05, 2011 6:51 PM > Subject: Re: [python-win32] How to call Python methods and properties from > VBS? > > > On 4/09/2011 11:35 PM, FT wrote: >> Hi Again, >> To be more specific I have compiled the Python inside a distributed >> package and need to know how to call from within that compiled package >> any method. In other words do I have to register the Python inside my >> .vbs script before calling any methods? >> I am saying this so another user does not need to install Python, just >> call using com inside the distributed Python compiled version. >> If so, how do I get the Python setup or in a form to call? I will be >> doing all the calls from .VBS and how would the CreateObject from there >> be done to setup to call the compiled Python interpreter? > > You should develop and test using normal Python, then once you want to > distribute it to others, look into py2exe to "compile" it and an > installer program such as nsis or inno so the user can simply install it. > > Hope this helps, > > Mark > From skippy.hammond at gmail.com Fri Sep 9 02:02:44 2011 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 09 Sep 2011 10:02:44 +1000 Subject: [python-win32] How to call Python methods and properties from VBS? In-Reply-To: <000901cc6e2a$1d16ff70$6401a8c0@brucehseog9r4k> References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> <4E65527A.90605@gmail.com> <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> <4E65A063.9050109@skippinet.com.au> <000901cc6e2a$1d16ff70$6401a8c0@brucehseog9r4k> Message-ID: <4E6957A4.2010606@gmail.com> On 8/09/2011 11:20 PM, FT wrote: > Mark, > > This script: > set interp = CreateObject("Python.Interpreter") > interp.Exec "import sys" > > Is this not calling a local computers installation of Python? If you built a DLL via py2exe and registered that, then it will not be using the local installation of Python but a copy of Python which py2exe has packaged up. That is basically the entire point of py2exe. > > I read over several times the Py2Exe docs and the chapter 12 stuff on > making the .dll and .exe. I always compile with both being made and test my > programs and they work fine. > > This example that you pointed me to and I had already read seems to > indicate that the Python is already on that computer by calling that > CreateObject method. > > It does not answer my original question, for looking around it seems all > examples assume the Python is already installed. > > I read the way you use specific commands inside all definitions to > indicate what you want to expose and not expose, but where is the complete > example of someone installing th e .dll and or .exe into a machine that does > not have Python and registering assuming that? A py2exe created package does not need Python installed to work. However, it also doesn't perform the actual installation - you want something like nsis or inno for that. > > Question number 2, I attempted to download the latest win32 packages one > compiled/built July 2009 and May of this year. In both cases I could not > install the .exe and the error was saying both are corrupted! I have heard that internet explorer can get upset with the installation files for some reason - can you try a different browser? Or even try and start the installer executable from Windows itself instead of via IE? FWIW, the files on sourceforge are fine. > Now, I need a direct link to the actual download and not a third party, > jump, moved to another page link, for I think I may have been directed to a > virus loaded page to download these files. The files are hosted on sourceforge and they often redirect you to a mirror. I'm afraid I'm not sure of what the canonical location of the "actual download" is, but I'd be very very surprised if one of their mirrors added a virus. Cheers, Mark > So, I need a good example on what I had asked below and the page to have > the latest Python2.5 com and win32 packages to run with, for I have only > 2007 versions on my computer. > > Sincerely > Bruce > > > Sent: Tuesday, September 06, 2011 12:24 AM > Subject: Re: [python-win32] How to call Python methods and properties from > VBS? > > > Please keep replies on the python-win32 list - others may also be able > to help you too. > > You might like to check out the sample in samples\pywin32\com_server in > the py2exe distribution - that demonstrates a simple COM object and has > a VBScript sample which calls it. > > Hope this helps, > > Mark > > On 6/09/2011 1:38 PM, FT wrote: >> >> Hi Mark, >> >> I wanted to have the python and other modules from a py2exe > accessible >> from vb script. So I would need to have the best documentation on how to > set >> up the python com library to be able to call it from vb script. This is > not >> using a web server, but inside a screen reader script language. The one I > am >> using is Windoweyes Scripting language which has all or most windows > methods >> and the external xml file for screen displays. >> >> I am a blind programmer and use the screen reader with a built in vb >> script programming language. So, knowing Python I want to be able to call >> those module methods at will. I have made executables but they reside in a >> sub directory of Windoweyes and are limited to only what the .exe file > does >> and not flexible beyond that point. >> >> I was given snap shots of examples but they are very spotty and > actual >> say they show a vb script example, but none was displayed. >> >> I am assuming that you have to make a class for all the modules you > want >> to be able to call, but not really sure on that. I have spent all evening >> trying to find examples and such and came up with almost nothing but an > old >> activestate 2.4 brief description which said little on what to do. >> >> So, this is where I am at the moment and have found little to explain >> fully what to do. It showed a way to set up the py2exe but the so called >> example call from vb script was not there but it said it was. The typical >> hello script example. >> >> So, what I need is a very good tutorial on how to step by step make > the >> class and compile it to a distributle so it can be registered and called > as >> a com or automation call from vb script. Using what I would assume to be > the >> CreatObject command in vbs to make an instance of that > object/module/method. >> >> I am blind, so no pictures, I need just plain text to do it. >> >> Sincerely >> Bruce >> >> Sent: Monday, September 05, 2011 6:51 PM >> Subject: Re: [python-win32] How to call Python methods and properties from >> VBS? >> >> >> On 4/09/2011 11:35 PM, FT wrote: >>> Hi Again, >>> To be more specific I have compiled the Python inside a distributed >>> package and need to know how to call from within that compiled package >>> any method. In other words do I have to register the Python inside my >>> .vbs script before calling any methods? >>> I am saying this so another user does not need to install Python, just >>> call using com inside the distributed Python compiled version. >>> If so, how do I get the Python setup or in a form to call? I will be >>> doing all the calls from .VBS and how would the CreateObject from there >>> be done to setup to call the compiled Python interpreter? >> >> You should develop and test using normal Python, then once you want to >> distribute it to others, look into py2exe to "compile" it and an >> installer program such as nsis or inno so the user can simply install it. >> >> Hope this helps, >> >> Mark >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From Chester_Lab at fltg.net Fri Sep 9 02:23:59 2011 From: Chester_Lab at fltg.net (FT) Date: Thu, 8 Sep 2011 20:23:59 -0400 Subject: [python-win32] How to call Python methods and properties from VBS? References: <001101cc6b07$90b1db60$6401a8c0@brucehseog9r4k> <4E65527A.90605@gmail.com> <001601cc6c46$8df9a340$6401a8c0@brucehseog9r4k> <4E65A063.9050109@skippinet.com.au> <000901cc6e2a$1d16ff70$6401a8c0@brucehseog9r4k> <4E6957A4.2010606@gmail.com> Message-ID: <000601cc6e86$cdd9d560$6401a8c0@brucehseog9r4k> Hi Mark, I am aware of the registering issue and the demo listed a path to pointed to every location where that .DLL or .exe file may be located. It was as if it got installed everywhere; assuming that both the compiled and install path of Python is also being shown. The IE problem is not the problem, for I downloaded the files, not once, but twice, and each time when using windows to run the .exe file the same error comes up. It also will ask for a password, yet none of my other executables I download ask that question. In other words, I am not running it from IE. I have downloaded Portable Python because it's packages has all these packages inside of it. I don't know when I will use that version. But it sounds like a real good alternative for running Python and all packages. I am getting back hopefully tomorrow afternoon my Del latest XP computer which was in repair, rebuilt. That version may open these files but I just don't think so. My old computer I am using now just has an old version of my screen reader program and only SP1 of any Windows stuff. Maybe that is the issue, but that does not explain failure of only these .exe files and none of my other downloads on different pages of that same web site for Python downloads. Some difference is some are .sy, but still only these files give me any grief. Once I get my better computer back I will experiment with the files and registering Python as shown. For this computer will not have Python loaded onto it until I do so and will be able to test to see if it in fact does work when compiled and registered. My old computer I have no desire to change anything since it does compile and things run, but as attempting to update the win32 stuff, it dies...attempting to install them. All I can see right now is to compile on the old and run them on the new as if Python did not exist. Once confident I can do this I will then install Python, maybe; or use Portable Python. I guess the question to ask is, have you had any problems with Portable Python? That's if you have run it. Sincerely Bruce Sent: Thursday, September 08, 2011 8:02 PM Subject: Re: [python-win32] How to call Python methods and properties from VBS? On 8/09/2011 11:20 PM, FT wrote: > Mark, > > This script: > set interp = CreateObject("Python.Interpreter") > interp.Exec "import sys" > > Is this not calling a local computers installation of Python? If you built a DLL via py2exe and registered that, then it will not be using the local installation of Python but a copy of Python which py2exe has packaged up. That is basically the entire point of py2exe. > > I read over several times the Py2Exe docs and the chapter 12 stuff on > making the .dll and .exe. I always compile with both being made and test my > programs and they work fine. > > This example that you pointed me to and I had already read seems to > indicate that the Python is already on that computer by calling that > CreateObject method. > > It does not answer my original question, for looking around it seems all > examples assume the Python is already installed. > > I read the way you use specific commands inside all definitions to > indicate what you want to expose and not expose, but where is the complete > example of someone installing th e .dll and or .exe into a machine that does > not have Python and registering assuming that? A py2exe created package does not need Python installed to work. However, it also doesn't perform the actual installation - you want something like nsis or inno for that. > > Question number 2, I attempted to download the latest win32 packages one > compiled/built July 2009 and May of this year. In both cases I could not > install the .exe and the error was saying both are corrupted! I have heard that internet explorer can get upset with the installation files for some reason - can you try a different browser? Or even try and start the installer executable from Windows itself instead of via IE? FWIW, the files on sourceforge are fine. > Now, I need a direct link to the actual download and not a third party, > jump, moved to another page link, for I think I may have been directed to a > virus loaded page to download these files. The files are hosted on sourceforge and they often redirect you to a mirror. I'm afraid I'm not sure of what the canonical location of the "actual download" is, but I'd be very very surprised if one of their mirrors added a virus. Cheers, Mark > So, I need a good example on what I had asked below and the page to have > the latest Python2.5 com and win32 packages to run with, for I have only > 2007 versions on my computer. > > Sincerely > Bruce > > > Sent: Tuesday, September 06, 2011 12:24 AM > Subject: Re: [python-win32] How to call Python methods and properties from > VBS? > > > Please keep replies on the python-win32 list - others may also be able > to help you too. > > You might like to check out the sample in samples\pywin32\com_server in > the py2exe distribution - that demonstrates a simple COM object and has > a VBScript sample which calls it. > > Hope this helps, > > Mark > > On 6/09/2011 1:38 PM, FT wrote: >> >> Hi Mark, >> >> I wanted to have the python and other modules from a py2exe > accessible >> from vb script. So I would need to have the best documentation on how to > set >> up the python com library to be able to call it from vb script. This is > not >> using a web server, but inside a screen reader script language. The one I > am >> using is Windoweyes Scripting language which has all or most windows > methods >> and the external xml file for screen displays. >> >> I am a blind programmer and use the screen reader with a built in vb >> script programming language. So, knowing Python I want to be able to call >> those module methods at will. I have made executables but they reside in a >> sub directory of Windoweyes and are limited to only what the .exe file > does >> and not flexible beyond that point. >> >> I was given snap shots of examples but they are very spotty and > actual >> say they show a vb script example, but none was displayed. >> >> I am assuming that you have to make a class for all the modules you > want >> to be able to call, but not really sure on that. I have spent all evening >> trying to find examples and such and came up with almost nothing but an > old >> activestate 2.4 brief description which said little on what to do. >> >> So, this is where I am at the moment and have found little to explain >> fully what to do. It showed a way to set up the py2exe but the so called >> example call from vb script was not there but it said it was. The typical >> hello script example. >> >> So, what I need is a very good tutorial on how to step by step make > the >> class and compile it to a distributle so it can be registered and called > as >> a com or automation call from vb script. Using what I would assume to be > the >> CreatObject command in vbs to make an instance of that > object/module/method. >> >> I am blind, so no pictures, I need just plain text to do it. >> >> Sincerely >> Bruce >> >> Sent: Monday, September 05, 2011 6:51 PM >> Subject: Re: [python-win32] How to call Python methods and properties from >> VBS? >> >> >> On 4/09/2011 11:35 PM, FT wrote: >>> Hi Again, >>> To be more specific I have compiled the Python inside a distributed >>> package and need to know how to call from within that compiled package >>> any method. In other words do I have to register the Python inside my >>> .vbs script before calling any methods? >>> I am saying this so another user does not need to install Python, just >>> call using com inside the distributed Python compiled version. >>> If so, how do I get the Python setup or in a form to call? I will be >>> doing all the calls from .VBS and how would the CreateObject from there >>> be done to setup to call the compiled Python interpreter? >> >> You should develop and test using normal Python, then once you want to >> distribute it to others, look into py2exe to "compile" it and an >> installer program such as nsis or inno so the user can simply install it. >> >> Hope this helps, >> >> Mark >> > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From chris at kateandchris.net Fri Sep 9 04:58:56 2011 From: chris at kateandchris.net (Chris Lambacher) Date: Thu, 8 Sep 2011 22:58:56 -0400 Subject: [python-win32] Loading C extensions in Python 2.6/2.7 from classic ASP In-Reply-To: References: <4E66D6C9.4000409@gmail.com> <4E66E087.6090503@skippinet.com.au> Message-ID: Hi Mark, It is not Wow64. I did a very basic test to see what I get. I installed 2.7.2 x64 and appropriate pywin32 216, and lxml 2.3, throw: into an ASP file and get: 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] Python ActiveX Scripting Engine error '80020009' Traceback (most recent call last): File " > > into an ASP file and get: > > 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] > Python ActiveX Scripting Engine error '80020009' > > Traceback (most recent call last): File " It loads the following dlls: c:\windows\wow64\python27.dll c:\windows\wow64\pywintypes.dll c:\windows\wow64\pythoncomloader.dll c:\windows\pythoncom27.dll It loads the following extensions: c:\python27\lib\site-packages\win32\_win32sysloader.pyd c:\python27\lib\site-packages\win32\win32api.pyd c:\python27\lib\site-packages\win32\win32trace.pyd c:\python27\lib\site-packages\win32comext\axscript\axscript.pyd c:\python27\lib\site-packages\win32comext\axdebug\axdebug.pyd and since they are already loaded, they continue to import without error. I have not been able to trigger the issue with *any* C extension that ships with Python or pywin32. But pretty much any extension that is provided by a 3rd party gives me the DLL load failed :( Maybe this is actually a Python bug. I don't know. It doesn't make any sense. At least I have a work-around. -Chris On Tue, Sep 13, 2011 at 7:54 PM, Chris Lambacher wrote: > I don't import anything from pywin32 other than what would have already been > loaded before getting to my code by the pywin32 machinery that makes active > scripting work. When I get back to my computer I'll look at what gets loaded > in the most basic app and try to determine what loads those modules first. > > -Chris > > On Tuesday, September 13, 2011, mhammond at skippinet.com.au > wrote: >> But none of pywin32, right? So the obvious question is still how those >> other modules differ from pywin32 >> -- >> Sent from my Android phone with K-9 Mail. Please excuse my brevity. >> >> Chris Lambacher wrote: >>> >>> Basically every C extension I have ever tried: >>> >>> lxml >>> pycrypto >>> pyodbc >>> psyco >>> >>> -Chris >>> >>> On Tue, Sep 13, 2011 at 1:30 PM, mhammond at skippinet.com.au >>> wrote: >>> > What are the other modules? Is it just the etree one? >>> > >>> > Mark >>> > -- >>> > Sent from my Android phone with K-9 Mail. Please excuse my brevity. >>> > >>> > Chris Lambacher wrote: >>> >> >>> >> On Sun, Sep 11, 2011 at 3:42 PM, Mark Hammond >>> >> >>> >> wrote: >>> >> > The best I can suggest is to make a small .asp example which >>> >> > requires >>> >> > nothing beyond pywin32 - eg, some of the asp samples. ?Once you are >>> >> > convinced that works, I'd start looking into what is different about >>> >> > the >>> >> > lxml.etree >>> module - I suspect you will find that module references the >>> >> > CRT >>> >> > assembly. >>> >> > >>> >> >>> >> I was looking at something else in Process Explorer and noticed a pyd >>> >> that was loaded in the standalone part of the app that I did not >>> >> rebuild and wondered if it loaded correctly in the ASP app. In this >>> >> case it was the _speedups.pyd extension of the markupsafe package and >>> >> indeed when I look at the running w3p.exe process, I see the >>> >> _speedups.pyd extension is loaded and modifying my test app to load >>> >> the _speedups.pyd module and >>> >> everything works. >>> >> >>> >> Maybe the other modules are loading other DLLs and therefore need the >>> >> manifest in order to be able to inherit it since it is not the ? main >>> >> process loading the DLLs anymore? >>> >> >>> >> -Chris >>> >> >>> >> >>> >> -- >>> >> Christopher Lambacher >>> >> chris at kateandchris.net >>> > >>> >>> >>> >>> -- >>> Christopher Lambacher >>> chris at kateandchris.net? >> > > -- > Christopher Lambacher > chris at kateandchris.net > -- Christopher Lambacher chris at kateandchris.net From mycommercials.79 at web.de Sat Sep 17 17:25:35 2011 From: mycommercials.79 at web.de (=?UTF-8?Q?=22peter_m=C3=BCller=22?=) Date: Sat, 17 Sep 2011 17:25:35 +0200 (CEST) Subject: [python-win32] win32 network, sendto blocks Message-ID: <704685405.147590.1316273135715.JavaMail.fmail@mwmweb050> An HTML attachment was scrubbed... URL: From reckoner at gmail.com Sat Sep 17 19:37:10 2011 From: reckoner at gmail.com (reckoner) Date: Sat, 17 Sep 2011 10:37:10 -0700 Subject: [python-win32] Get executables corresponding to system tray icons? Message-ID: <4E74DAC6.9090403@gmail.com> Hi, Is there a way to use Python to get a list of all the icons in the system tray (lower right hand corner) and their associated processes and executables? Here is a thread on how to do this using AHK: http://www.autohotkey.com/forum/topic17314.html but it relies heavily on AHK, and the problem with that is that it is difficult to get at the output from AHK scripts (without writing to a file or the clipboard, for example). Note that I'm interested this for in Windows XP/7 Thanks! From timr at probo.com Mon Sep 19 20:12:00 2011 From: timr at probo.com (Tim Roberts) Date: Mon, 19 Sep 2011 11:12:00 -0700 Subject: [python-win32] Get executables corresponding to system tray icons? In-Reply-To: <4E74DAC6.9090403@gmail.com> References: <4E74DAC6.9090403@gmail.com> Message-ID: <4E7785F0.6000705@probo.com> reckoner wrote: > Hi, > > Is there a way to use Python to get a list of all the icons in the > system tray (lower right hand corner) and their associated processes and > executables? > > Here is a thread on how to do this using AHK: > > http://www.autohotkey.com/forum/topic17314.html > > but it relies heavily on AHK, and the problem with that is that it is > difficult to get at the output from AHK scripts (without writing to a > file or the clipboard, for example). Well, it IS possible, but it's a fair amount of Windows magic. See if this is enough to get you started in porting the AHK script to Python: import win32con import win32gui import win32process import ctypes OpenProcess = ctypes.windll.kernel32.OpenProcess VirtualAllocEx = ctypes.windll.kernel32.VirtualAllocEx VirtualFreeEx = ctypes.windll.kernel32.VirtualFreeEx CloseHandle = ctypes.windll.kernel32.CloseHandle def TrayIcons(): hwnd = win32gui.FindWindow( "Shell_TrayWnd", "" ) print hwnd tid, pid = win32process.GetWindowThreadProcessId( hwnd ) print pid hProc = OpenProcess( 0x38, 0, pid ) print hProc pProc = VirtualAllocEx( hProc, 0, 32, 0x1000, 4 ) print hex(pProc) VirtualFreeEx( hProc, pProc, 0, 0x8000 ) CloseHandle( hProc ) TrayIcons() -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From blindza at gmail.com Tue Sep 20 09:50:25 2011 From: blindza at gmail.com (Jacob Kruger) Date: Tue, 20 Sep 2011 09:50:25 +0200 Subject: [python-win32] Passing command line arguments to imported modules, or something like a session/global variable Message-ID: Hi there Playing around with a module called layout-by-code that lets me generate wxPython interfaces quickly/easily, but, if I want to, for example, open a new window that then also defines it's own interface, it would be nice to be able to either pass object variables to it, that could also maybe have their content changed before focus reverts to the original/parent window, or something, and suppose could use some form of external communications channel, like a text file, a sqlite3 database file, etc., but was just wondering if there was something am missing out on, since global variable definition doesn't seem to work, etc., but anyway. Have tried playing around with 3 different ways of implementing this using just a module import statement - and that's the only one that's really stable/working at the moment - importing a module and then calling a function in it, with arguments - that one crashes out over and over again - and importing a class defined in the module file - but that one seems to get stuck/hang up a bit. I know I could more manually work around this using wxPython interface itsself more directly, but this LBC module really makes it easy/simple to almost literally spit out a usable/accessible interface quite easily/quickly at the moment. My tests are in this zip file if that means much - parentWindow.py runs tests on the child...py children - and, yes, know have again made use of tab characters for indentation, but that's also more suitable for my sort of development environment: http://www.blindza.co.za/uploads/LBC/childWindowsLBC.zip TIA Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' From myrtactle at gmail.com Wed Sep 21 20:35:52 2011 From: myrtactle at gmail.com (Marte Soliza) Date: Thu, 22 Sep 2011 02:35:52 +0800 Subject: [python-win32] Get path of the current open document of the current active application Message-ID: Hello, I'm looking for a way to, first, determine the current active application (i.e. the one with the top-most window). I think I got this now, but I'm not sure how much of this will help in my final goal which is to get the path of the current open document (for those that have them). I believe there is no single way to do this that will work for all applications, but is there a way to do this for most applications? Is there some convention that most applications follow to define what their current document is? If there's no general way, I'm willing to do this on an app-to-app basis starting with, say, MS Word. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Sep 21 22:35:53 2011 From: timr at probo.com (Tim Roberts) Date: Wed, 21 Sep 2011 13:35:53 -0700 Subject: [python-win32] Get path of the current open document of the current active application In-Reply-To: References: Message-ID: <4E7A4AA9.8080903@probo.com> Marte Soliza wrote: > > I'm looking for a way to, first, determine the current active > application (i.e. the one with the top-most window). I think I got > this now, but I'm not sure how much of this will help in my final goal > which is to get the path of the current open document (for those that > have them). > > I believe there is no single way to do this that will work for all > applications, but is there a way to do this for most applications? Is > there some convention that most applications follow to define what > their current document is? > > If there's no general way, I'm willing to do this on an app-to-app > basis starting with, say, MS Word. This is an extremely difficult problem with no general case solutions. I worked on a multi-year project for A Major Processor Manufacturer a few years ago that tried to do this, in an attempt to create an immersive, collaborative team environment. They wanted to tell whether several people were working on the same document. We were able to support Office and Internet Explorer, but that was pretty much it, and even that was quite delicate. It didn't always work, and it failed after virtually every Office upgrade. That's why the product has never gone public. One huge problem is that Windows, in general, does not have the concept of a "document". Some applications have a document-centric architecture (although many do not), but there are no Win32 APIs about documents. The Office applications can be controlled by COM, but then you need to map from a window handle to a COM object. Now, it turns out that last problem is solvable. The Office applications all register themselves in the Running Object Table. It's possible to enumerate the monikers in the Running Object Table and figure out which one maps to a particular window handle. That gives you the root application object, and you can ask that for the current document, assuming the document has been saved. For IE, you can actually go probing through the window handles to find the text box that contains the current URL. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From myrtactle at gmail.com Thu Sep 22 09:01:25 2011 From: myrtactle at gmail.com (Marte Soliza) Date: Thu, 22 Sep 2011 15:01:25 +0800 Subject: [python-win32] Get path of the current open document of the current active application In-Reply-To: <4E7A4AA9.8080903@probo.com> References: <4E7A4AA9.8080903@probo.com> Message-ID: Do you think most apps provide some interface in one way or another, especially major apps (e.g. MS Office apps, Adobe apps)? It's ok if we do this on an app-to-app basis, but for each app, how easy is it do you think will it take to determine the interface for them? Thanks for a very informative answer! On Thu, Sep 22, 2011 at 4:35 AM, Tim Roberts wrote: > Marte Soliza wrote: > > > > I'm looking for a way to, first, determine the current active > > application (i.e. the one with the top-most window). I think I got > > this now, but I'm not sure how much of this will help in my final goal > > which is to get the path of the current open document (for those that > > have them). > > > > I believe there is no single way to do this that will work for all > > applications, but is there a way to do this for most applications? Is > > there some convention that most applications follow to define what > > their current document is? > > > > If there's no general way, I'm willing to do this on an app-to-app > > basis starting with, say, MS Word. > > This is an extremely difficult problem with no general case solutions. > > I worked on a multi-year project for A Major Processor Manufacturer a > few years ago that tried to do this, in an attempt to create an > immersive, collaborative team environment. They wanted to tell whether > several people were working on the same document. We were able to > support Office and Internet Explorer, but that was pretty much it, and > even that was quite delicate. It didn't always work, and it failed > after virtually every Office upgrade. That's why the product has never > gone public. > > One huge problem is that Windows, in general, does not have the concept > of a "document". Some applications have a document-centric architecture > (although many do not), but there are no Win32 APIs about documents. > The Office applications can be controlled by COM, but then you need to > map from a window handle to a COM object. > > Now, it turns out that last problem is solvable. The Office > applications all register themselves in the Running Object Table. It's > possible to enumerate the monikers in the Running Object Table and > figure out which one maps to a particular window handle. That gives you > the root application object, and you can ask that for the current > document, assuming the document has been saved. > > For IE, you can actually go probing through the window handles to find > the text box that contains the current URL. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiran.nair at rsa.com Thu Sep 22 13:54:49 2011 From: kiran.nair at rsa.com (kirancnair) Date: Thu, 22 Sep 2011 04:54:49 -0700 (PDT) Subject: [python-win32] Accessing a Remote Registry.... In-Reply-To: <20080415130746.WBHUA.115687.imail@eastrmwml14.mgt.cox.net> References: <20080415130746.WBHUA.115687.imail@eastrmwml14.mgt.cox.net> Message-ID: <32503805.post@talk.nabble.com> You can do something like this: import _winreg import wmi c = wmi.WMI(computer="XXX.XXX.XXX.XXX", user="devuser", password="devpass1!",namespace="root/default").StdRegProv result, names = c.EnumKey ( hDefKey=_winreg.HKEY_LOCAL_MACHINE, sSubKeyName="SYSTEM\ControlSet001\Services\MRxDAV" ) for item in names: print item Tom Moulton-2 wrote: > > I have found many references to accessing a registry remotely; however, > none > that work for me. Admittedly, I am a bit green on understanding Windows > security permissions and the like. I have tried a number of solutions > (i.e., > wmi, win32api, _winreg), but to no avail. I am trying to update registry > settings between Windows XP systems using user a local administrator > account for > authentication. I've tried the following... > > BEGIN SNIPPET 1: > > c = wmi.WMI(computer='', user='', > password='') > reg = c.Registry()[0] > reg.EnumKey (hDefKey=_winreg.HKEY_LOCAL_MACHINE, > sSubKeyName="Software") > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\site-packages\wmi.py", line 491, in __getattr__ > return getattr (self.ole_object, attribute) > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line > 496, in > __getattr__ > raise AttributeError, "%s.%s" % (self._username_, attr) > AttributeError: .EnumKey > > END SNIPPET 1 > > > BEGIN SNIPPET 2: > > objSWbemLocator = > win32com.client.Dispatch("WbemScripting.SWbemLocator") > objSWbemServices = > objSWbemLocator.ConnectServer('','root\default:Cimv2', > '', > '') > objReg = objSWbemServices.Get('StdRegProv') > objReg.EnumKey(hDefKey=_winreg.HKEY_LOCAL_MACHINE, > sSubKeyName='Software') > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line > 491, in > __getattr__ > raise pythoncom.com_error, details > com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', > 'Invalid > parameter ', None, 0, -2147217400), None) > > END SNIPPET 2 > > I've looked at using the wmi.Registry function; however, it only allows > you to > specify the computer name and not any credentials (i.e., username and > password). > I've also tried a various forms of monikers (e.g., > ///root/default); > however, anytime I specify the IP address within the moniker I get an > Access > Denied error (see below). Also, passing in the moniker seems to override > use of > the user, password and computer arguments. > > > BEGIN SNIPPET 3: > > reg = wmi.WMI(computer=', > moniker='winmgmts:///root/default:StdRegProv', > user='', > password='') > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\site-packages\wmi.py", line 1190, in connect > handle_com_error (error_info) > File "C:\Python25\lib\site-packages\wmi.py", line 189, in > handle_com_error > raise x_wmi, "\n".join (exception_string) > x_wmi: -0x7ff8fffb - Access is denied. > > END SNIPPET 3 > > > Thanks, > > Tom > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- View this message in context: http://old.nabble.com/Accessing-a-Remote-Registry....-tp16706968p32503805.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From mail at timgolden.me.uk Thu Sep 22 14:05:59 2011 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 22 Sep 2011 13:05:59 +0100 Subject: [python-win32] Accessing a Remote Registry.... In-Reply-To: <32503805.post@talk.nabble.com> References: <20080415130746.WBHUA.115687.imail@eastrmwml14.mgt.cox.net> <32503805.post@talk.nabble.com> Message-ID: <4E7B24A7.4060505@timgolden.me.uk> Not that it isn't a useful answer, but the original question was posed back in April 2008! http://mail.python.org/pipermail/python-win32/2008-April/007327.html TJG On 22/09/2011 12:54, kirancnair wrote: > > You can do something like this: > > > import _winreg > import wmi > c = wmi.WMI(computer="XXX.XXX.XXX.XXX", user="devuser", > password="devpass1!",namespace="root/default").StdRegProv > > > result, names = c.EnumKey ( > hDefKey=_winreg.HKEY_LOCAL_MACHINE, > sSubKeyName="SYSTEM\ControlSet001\Services\MRxDAV" > ) > > for item in names: > print item > > > > Tom Moulton-2 wrote: >> >> I have found many references to accessing a registry remotely; [...] From alhaddeshpande at gmail.com Fri Sep 23 08:49:44 2011 From: alhaddeshpande at gmail.com (ad3d) Date: Thu, 22 Sep 2011 23:49:44 -0700 (PDT) Subject: [python-win32] encoding decoding for python2.5 Message-ID: <32503855.post@talk.nabble.com> Hi Guys, I want to encode and decode some data using python 2.5. can someone plz suggest me some algorithms(freeware not trial version) for the same.. thanx in advance -- View this message in context: http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32503855.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From vernondcole at gmail.com Fri Sep 23 16:23:03 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Fri, 23 Sep 2011 08:23:03 -0600 Subject: [python-win32] encoding decoding for python2.5 In-Reply-To: <32503855.post@talk.nabble.com> References: <32503855.post@talk.nabble.com> Message-ID: Dear person: There are lots of ways to encode and decode data. You'll need to provide some more information about the use you intend in order to get good advise. Do you just want to protect something from prying eyes on one workstation? How secure does it have to be? Are you sending the data to someone else, who must then decode it? Is it in some compressed format (like audio or picture) and you need to read and write it? Are you perhaps a terrorist with whom we prefer not to share information about cryptography, and thats why you don't have a name? Or do you only want to change a character string from one encoding to another? Provide more details, please. -- Vernon On Fri, Sep 23, 2011 at 12:49 AM, ad3d wrote: > > Hi Guys, > > I want to encode and decode some data using python 2.5. can someone plz > suggest me some algorithms(freeware not trial version) for the same.. > > thanx in advance > -- > View this message in context: > http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32503855.html > Sent from the Python - python-win32 mailing list archive at Nabble.com. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alhaddeshpande at gmail.com Wed Sep 28 20:22:10 2011 From: alhaddeshpande at gmail.com (ad3d) Date: Wed, 28 Sep 2011 11:22:10 -0700 (PDT) Subject: [python-win32] encoding decoding for python2.5 In-Reply-To: References: <32503855.post@talk.nabble.com> Message-ID: <32549609.post@talk.nabble.com> Dude, i was just trying to develop a software in which some sensative data like employee salary are stored..so for the data security purpose i was trying to find a way out... i tried using chilkat but its full version is not available..thats why i was trying for some help on this topic..i am using MySQL as database..and using python2.5 and all the fields i am trying to store are strings..no one should be able to view salaries or review information of employees from database tht was d agenda.. Thanx ad3d Vernon Cole-3 wrote: > > Dear person: > > There are lots of ways to encode and decode data. You'll need to provide > some more information about the use you intend in order to get good > advise. > Do you just want to protect something from prying eyes on one workstation? > How secure does it have to be? Are you sending the data to someone else, > who > must then decode it? Is it in some compressed format (like audio or > picture) and you need to read and write it? Are you perhaps a terrorist > with whom we prefer not to share information about cryptography, and thats > why you don't have a name? Or do you only want to change a character > string > from one encoding to another? > > Provide more details, please. > -- > Vernon > > On Fri, Sep 23, 2011 at 12:49 AM, ad3d wrote: > >> >> Hi Guys, >> >> I want to encode and decode some data using python 2.5. can someone plz >> suggest me some algorithms(freeware not trial version) for the same.. >> >> thanx in advance >> -- >> View this message in context: >> http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32503855.html >> Sent from the Python - python-win32 mailing list archive at Nabble.com. >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -- View this message in context: http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32549609.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From planders at gmail.com Thu Sep 29 00:18:14 2011 From: planders at gmail.com (Preston Landers) Date: Wed, 28 Sep 2011 17:18:14 -0500 Subject: [python-win32] encoding decoding for python2.5 In-Reply-To: <32549609.post@talk.nabble.com> References: <32503855.post@talk.nabble.com> <32549609.post@talk.nabble.com> Message-ID: Hi, I think people might be reluctant to give you an in-depth tutorial here on security and encryption. For one thing it's not really the right place - this is the mailing list for the PyWin32 extensions and related topics, not for the general topic of securing information in databases. Also it's pretty clear that you're a bit of a neophyte at this (no offense intended, it may also be a language issue) so people might be reluctant to give you simple advice (one or two paragraph's worth) and then you might get a false sense of security that you've got the "security issue" handled. Securing a web app is a complex process and it involves way more than simply encoding a few fields. Personally, I would focus on securing overall access to your database instead of trying to secure particular fields within the database. I wouldn't recommend giving untrusted users direct access (even read-only) to a production database like this. I would mediate everything through access controls in my web app. If you still want to encrypt fields, there's packages out there like PyCrypto you can investigate. MySQL also seems to contain some encryption functions though I'm not personally familiar with them. Good luck, Preston On Wed, Sep 28, 2011 at 1:22 PM, ad3d wrote: > > Dude, > > ? i was just trying to develop a software in which some sensative data like > employee salary are stored..so for the data security purpose i was trying to > find a way out... i tried using chilkat but its full version is not > available..thats why i was trying for some help on this topic..i am using > MySQL as database..and using python2.5 and all the fields i am trying to > store are strings..no one should be able to view salaries or review > information of employees from database tht was d agenda.. > > Thanx > ad3d > > > > Vernon Cole-3 wrote: >> >> Dear person: >> >> There are lots of ways to encode and decode data. ?You'll need to provide >> some more information about the use you intend in order to get good >> advise. >> Do you just want to protect something from prying eyes on one workstation? >> How secure does it have to be? Are you sending the data to someone else, >> who >> must then decode it? ?Is it in some compressed format (like audio or >> picture) and you need to read and write it? ?Are you perhaps a terrorist >> with whom we prefer not to share information about cryptography, and thats >> why you don't have a name? ?Or do you only want to change a character >> string >> from one encoding to another? >> >> Provide more details, please. >> -- >> Vernon >> >> On Fri, Sep 23, 2011 at 12:49 AM, ad3d wrote: >> >>> >>> Hi Guys, >>> >>> ? I want to encode and decode some data using python 2.5. can someone plz >>> suggest me some algorithms(freeware not trial version) for the same.. >>> >>> thanx in advance >>> -- >>> View this message in context: >>> http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32503855.html >>> Sent from the Python - python-win32 mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> http://mail.python.org/mailman/listinfo/python-win32 >>> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > > -- > View this message in context: http://old.nabble.com/encoding-decoding-for-python2.5-tp32503855p32549609.html > Sent from the Python - python-win32 mailing list archive at Nabble.com. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From jacobk at mailzone.co.za Thu Sep 29 13:39:26 2011 From: jacobk at mailzone.co.za (Jacob Kruger) Date: Thu, 29 Sep 2011 13:39:26 +0200 Subject: [python-win32] Somewhat GUInterface for my mapData IF/RPG engine Message-ID: <3935dfc48120971e82e09d2ea3e1383a@192.168.1.36> If you want to check it out, here's the source code, etc. - and switched over the indentation to 2 spaces instead of tabs for this archive - and you'll see that am making use of a module called lbc - layout by code - that lets me put together a relatively dynamic interface quite quickly/easily, including building new child windows/frames on the fly, etc., but anyway - has some minor limitations, but seems generally alright for some things, and it actually also makes use of wxPython FWIW - is sort of a wrapper arond parts of it. Anyway, here's the source if you want to have a look at it - starting point/file is mapDataGenerator.py - 421Kb: http://www.blindza.co.za/uploads/mapData/mapDataLBC_src/mapDataGenLBC_indent_src.zip -- Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' From michael.illgner at googlemail.com Thu Sep 29 16:46:06 2011 From: michael.illgner at googlemail.com (Michael Illgner) Date: Thu, 29 Sep 2011 16:46:06 +0200 Subject: [python-win32] Python COM arguments types Message-ID: Hi folks, I have some problems calling a specific COM method with VARIANT parameters, the documentation of the COM library says HRESULT LoadDispTotal( [in] BOOL bSync, // Must be FALSE [in] VARIANT *pvarBills, // Long array [in] VARIANT *pvarCoins, // Long array [out, retval] long *nRetVal // 0 if Ok, -1 if error, ); LoadDispTotal(0, [1,2,3], [2,3,4]) does not seem to work, but i don't know if a python sequence would be "translated" to the right COM arguments. The generated python code from genpy is def LoadDispTotal(self, bSync=defaultNamedNotOptArg, pvarBills=defaultNamedNotOptArg, pvarCoins=defaultNamedNotOptArg): """method LoadDispTotal""" return self._oleobj_.InvokeTypes(30, LCID, 1, (3, 0), ((3, 1), (16396, 1), (16396, 1)),bSync , pvarBills, pvarCoins) I am using python 3.2 and all other COM methods with simple parameters seem to work on the same COM object Any ideas what I'm doing wrong ? Regards Michael