From hejibo at gmail.com Wed Dec 1 01:37:32 2010 From: hejibo at gmail.com (He Jibo) Date: Tue, 30 Nov 2010 18:37:32 -0600 Subject: [python-win32] How do I get the URL of the active tab in Internet Explorer In-Reply-To: References: <4CF513C0.6060604@co.marshall.ia.us> Message-ID: Thanks. Following your link, I get the following code in C#, The following function GetActiveTabIndex seems to what I need. But I do not know how to do it in python. Any ideas? Thanks. http://social.msdn.microsoft.com/Forums/en-US/ieextensiondevelopment/thread/03a8c835-e9e4-405b-8345-6c3d36bc8941 public int GetActiveTabIndex(IntPtr ieHandle) { AccessibleObjectFromWindow(GetDirectUIHWND(ieHandle), OBJID.OBJID_WINDOW, ref accessible); if (accessible == null) throw new Exception(); var index = 0; var ieDirectUIHWND = new IEAccessible(ieHandle); foreach (IEAccessible accessor in ieDirectUIHWND.Children) { foreach (var child in accessor.Children) { foreach (var tab in child.Children) { object tabIndex = tab.accessible.get_accState(0); if ((int)tabIndex == IE_ACTIVE_TAB) return index; index++; } } } return -1; } --------------------------- He Jibo Department of Psychology, Beckman Institute for Advanced Science and Technology University of Illinois, Urbana Champaign, 603 East Daniel St., Champaign, IL 61820 website: www.hejibo.info On Tue, Nov 30, 2010 at 4:00 PM, sharpblade wrote: > This might be of some help: > > http://social.msdn.microsoft.com/forums/en-US/ieextensiondevelopment/thread/e3a501d6-2163-4cc0-be2d-5011e7fa9613/ > Check > out Dan Morris's post, or T E dixons. > > On Tue, Nov 30, 2010 at 5:42 PM, He Jibo wrote: > >> Thanks so much for your valuable information. I will only need the url of >> a browser when it is in the front. I am going to try SendKey, it seems to be >> a good way to go. Have a nice day! >> >> >> --------------------------- >> He Jibo >> Department of Psychology, >> Beckman Institute for Advanced Science and Technology >> University of Illinois, Urbana Champaign, >> 603 East Daniel St., >> Champaign, IL 61820 >> website: www.hejibo.info >> >> >> >> On Tue, Nov 30, 2010 at 9:09 AM, Mike Driscoll < >> mdriscoll at co.marshall.ia.us> wrote: >> >>> On 1:59 PM, He Jibo wrote: >>> >>> Hi, >>> I am writing a small program, which needs to get the URL of the active >>> tab in either of firefox, internet exploerer or chrome. >>> My need is similar as the one posted at, >>> >>> http://stackoverflow.com/questions/3631216/how-do-i-get-the-url-of-the-visible-tab-in-firefox- >>> ie-chrome >>> >>> I did a lot of Googling, and get the following code. The following >>> code can get the url of the first tab in internet explorer. My >>> question is, how can I get the url of the current active tab? Thanks. >>> >>> ''' >>> >>> http://efreedom.com/Question/1-2555905/Get-Internet-Explorer-Address-Bar-Python >>> http://blogs.msdn.com/b/oldnewthing/archive/2005/07/05/435657.aspx >>> http://mail.python.org/pipermail/python-win32/2004-June/002040.html >>> >>> http://code.activestate.com/recipes/302324-browser-automation-tool-py-class-file/ >>> ''' >>> from win32com.client import Dispatch >>> import win32api, win32con,win32gui >>> >>> >>> SHELL = Dispatch("Shell.Application") >>> >>> def get_ie(shell): >>> for win in shell.Windows(): >>> # print win >>> if win.Name == "Windows Internet Explorer": >>> return win >>> return None >>> >>> def main(): >>> ie = get_ie(SHELL) >>> if ie: >>> print ie.LocationURL >>> print ie.LocationName >>> print ie.ReadyState >>> print ie >>> print ie.Document.title >>> print ie.Document.location >>> print ie.Document.forms >>> >>> # title = win32gui.GetWindowText(ie) >>> # print title >>> >>> else: >>> print "no ie window" >>> >>> if __name__ == '__main__': >>> main() >>> --------------------------- >>> He Jibo >>> Department of Psychology, >>> Beckman Institute for Advanced Science and Technology >>> University of Illinois, Urbana Champaign, >>> 603 East Daniel St., >>> Champaign, IL 61820 >>> website: www.hejibo.info >>> >>> >>> It will probably be frowned on here, but one of the easiest ways would be >>> to use SendKeys in combination with some Windows hackery. I have attached >>> some code I came up with after getting help from several of the fine people >>> on this list. It shows how to bring a window into focus by just passing in >>> an expected string. In this case, you would want to use something like >>> "Windows Internet Explorer" and have it search for that. >>> >>> Once that's in focus, you can use the SendKeys package ( >>> http://www.rutherfurd.net/python/sendkeys/) to send an ALT+D to select >>> the url and then CTRL+C to copy it. Then you can use the win32clipboard >>> module from PyWin32 to grab the text from the clipboard. >>> >>> It's a hack, but it's kind of fun. Of course, you can't use your PC while >>> the script runs or you might interrupt the process and send the keys to the >>> wrong window. >>> >>> >>> -- >>> Mike Driscoll >>> Applications Specialist >>> Blog: http://blog.pythonlibrary.org >>> >> >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 >> >> > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Dec 1 17:00:40 2010 From: robin at reportlab.com (Robin Becker) Date: Wed, 01 Dec 2010 16:00:40 +0000 Subject: [python-win32] odbc exceptions In-Reply-To: References: <4CF5182C.6010609@chamonix.reportlab.co.uk> <4CF53B16.7070601@chamonix.reportlab.co.uk> Message-ID: <4CF67128.3080300@chamonix.reportlab.co.uk> On 01/12/2010 00:28, Vernon Cole wrote: > even more important, also install a new copy of pywin32. > http://sourceforge.net/projects/pywin32/ > > ....... OK I have installed both python 2.6.6 and the latest pywin32 ie build 214 for 2.6 (before I had 212). I'm still getting that error. C:\code\rlextra\graphics\guiedit>cat toad.py try: import odbc print odbc.__file__ conn = odbc.odbc('not_a_db_path') except: raise C:\code\rlextra\graphics\guiedit>toad.py C:\Python26\lib\site-packages\win32\odbc.pyd Traceback (most recent call last): File "C:\code\rlextra\graphics\guiedit\toad.py", line 4, in conn = odbc.odbc('not_a_db_path') dbi.opError: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in LOGIN C:\code\rlextra\graphics\guiedit>ls -l C:\Python26\lib\site-packages\win32\odbc.pyd -rw-rw-rw- 1 user group 28160 Jul 5 2009 C:\Python26\lib\site-packages\win32\odbc.pyd C:\code\rlextra\graphics\guiedit> can you tell me what the timestamp of your odbc.pyd is to finally eliminate that as the source of the problem? -- Robin Becker From planders at gmail.com Wed Dec 1 17:22:22 2010 From: planders at gmail.com (Preston Landers) Date: Wed, 1 Dec 2010 10:22:22 -0600 Subject: [python-win32] odbc exceptions In-Reply-To: <4CF67128.3080300@chamonix.reportlab.co.uk> References: <4CF5182C.6010609@chamonix.reportlab.co.uk> <4CF53B16.7070601@chamonix.reportlab.co.uk> <4CF67128.3080300@chamonix.reportlab.co.uk> Message-ID: No, it appears you're getting a different (and expected) error now. "[ODBC Driver Manager] Data source name not found and no default driver specified in LOGIN" That means you didn't give a valid ODBC connection string when you tried to create a connection. Earlier you were getting "TypeError: exceptions must be classes or instances, not str". Try putting a valid connection string in your test. thanks, Preston On Wed, Dec 1, 2010 at 10:00 AM, Robin Becker wrote: > On 01/12/2010 00:28, Vernon Cole wrote: > >> even more important, also install a new copy of pywin32. >> http://sourceforge.net/projects/pywin32/ >> >> >> ....... > > OK I have installed both python 2.6.6 and the latest pywin32 ie build 214 > for 2.6 (before I had 212). I'm still getting that error. > > C:\code\rlextra\graphics\guiedit>cat toad.py > > try: > import odbc > print odbc.__file__ > conn = odbc.odbc('not_a_db_path') > except: > raise > > C:\code\rlextra\graphics\guiedit>toad.py > > C:\Python26\lib\site-packages\win32\odbc.pyd > Traceback (most recent call last): > File "C:\code\rlextra\graphics\guiedit\toad.py", line 4, in > > conn = odbc.odbc('not_a_db_path') > dbi.opError: [Microsoft][ODBC Driver Manager] Data source name not found > and no default driver specified in LOGIN > > C:\code\rlextra\graphics\guiedit>ls -l > C:\Python26\lib\site-packages\win32\odbc.pyd > -rw-rw-rw- 1 user group 28160 Jul 5 2009 > C:\Python26\lib\site-packages\win32\odbc.pyd > > C:\code\rlextra\graphics\guiedit> > > can you tell me what the timestamp of your odbc.pyd is to finally eliminate > that as the source of the problem? > > -- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gstellenberg at gmail.com Wed Dec 1 17:26:55 2010 From: gstellenberg at gmail.com (Gerry Stellenberg) Date: Wed, 1 Dec 2010 10:26:55 -0600 Subject: [python-win32] Python COM server corrupting VB parameter? In-Reply-To: References: Message-ID: Thanks Matt. I'm still hopeful there's something I can do from the python (server) side as the VB scripts are managed in somebody else's project. Does anybody else have input on this? Is this a known issue with pyWin32 or do I need to do something differently in the server code? If a known issue, is the cause known and a fix in the works? Alternately, can somebody help me identify the issue in the pyWin32 source so I can rebuild my local copy? Thanks. - Gerry On Mon, Nov 29, 2010 at 8:19 AM, Matthias Kirst wrote: > We stumbled across the same problem (10 years ago) and our solutions are: > > - use global variables > > - copy variable to another one and call COM server with this copy > > > > Hope this helps, > > Matt > > > > _______________________________________________ > 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 robin at reportlab.com Wed Dec 1 18:13:05 2010 From: robin at reportlab.com (Robin Becker) Date: Wed, 01 Dec 2010 17:13:05 +0000 Subject: [python-win32] odbc exceptions In-Reply-To: References: <4CF5182C.6010609@chamonix.reportlab.co.uk> <4CF53B16.7070601@chamonix.reportlab.co.uk> <4CF67128.3080300@chamonix.reportlab.co.uk> Message-ID: <4CF68221.7010801@chamonix.reportlab.co.uk> On 01/12/2010 16:22, Preston Landers wrote: > No, it appears you're getting a different (and expected) error now. > > "[ODBC Driver Manager] Data source name not found and no default driver > specified in LOGIN" > > That means you didn't give a valid ODBC connection string when you tried to > create a connection. Earlier you were getting "TypeError: exceptions must > be classes or instances, not str". Try putting a valid connection string in > your test. > > thanks, > Preston ...... you're absolutely right, I must have been snow blind. The exception's no longer a string which is what we expect. -- Robin Becker From mdhowle at att.net Wed Dec 1 19:32:39 2010 From: mdhowle at att.net (Matthew Howle) Date: Wed, 1 Dec 2010 10:32:39 -0800 (PST) Subject: [python-win32] Inheritance not applied to objects and containers Message-ID: <571383.18937.qm@web80013.mail.sp1.yahoo.com> The permissions are applied to the directory but subdirectories and files within the directory aren't inheriting the permissions. I can manually go the Advanced Security Settings for the directory and check "Apply these permissions to objects and/or container within this container only" to get the desired result. There was the same issue listed in the archive http://mail.python.org/pipermail/python-win32/2006-March/004472.html, but there was no response. Any ideas what I'm missing? Here is the sample code I'm using: >>> user,domain,type = win32security.LookupAccountName("","DOMAIN\\username") >>> sd = >>>win32security.GetFileSecurity("C:\\testdir",win32security.DACL_SECURITY_INFORMATION) >>> >>> dacl = sd.GetSecurityDescriptorDacl() >>> dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION_DS,win32security.OBJECT_INHERIT_ACE|win32security.CONTAINER_INHERIT_ACE,win32file.FILE_ALL_ACCESS,user) >>> >>> sd.SetSecurityDescriptorDacl(1,dacl,0) >>> win32security.SetFileSecurity("C:\\testdir",win32security.DACL_SECURITY_INFORMATION,sd) >>> Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Dec 1 19:59:12 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 1 Dec 2010 10:59:12 -0800 Subject: [python-win32] Inheritance not applied to objects and containers In-Reply-To: <571383.18937.qm@web80013.mail.sp1.yahoo.com> References: <571383.18937.qm@web80013.mail.sp1.yahoo.com> Message-ID: <4CF69B00.3010502@probo.com> Matthew Howle wrote: > The permissions are applied to the directory but subdirectories and > files within the directory aren't inheriting the permissions. You've stumbled across a very nasty little dark corner. There are several APIs for managing security descriptors, including APIs like SetFileSecurity, SetSecurityInfo, and SetNamedSecurityInfo. You happened to choose SetFileSecurity. It turns out this is a low-level API which does not automatically propagate the inherited permissions. Your permissions will apply to NEW objects, but it doesn't modify EXISTING child objects. You should investigate either SetSecurityInfo or SetNamedSecurityInfo. Both of those will do the propagation automatically. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mdhowle at att.net Wed Dec 1 20:47:16 2010 From: mdhowle at att.net (Matthew Howle) Date: Wed, 1 Dec 2010 11:47:16 -0800 (PST) Subject: [python-win32] Inheritance not applied to objects and containers In-Reply-To: <4CF69B00.3010502@probo.com> Message-ID: <428914.11688.qm@web80010.mail.sp1.yahoo.com> Aha! Thank you, using SetNamedSecurityInfo() worked perfectly. Here's the test code I used >>> user = win32security.LookupAccountName("","DOMAIN\\username")[0] >>> sd = win32security.GetFileSecurity("C:\\testdir",win32security.DACL_SECURITY_INFORMATION) >>> dacl = sd.GetSecurityDescriptorDacl() >>> dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION,win32security.OBJECT_INHERIT_ACE|win32security.CONTAINER_INHERIT_ACE,win32file.FILE_ALL_ACCESS,user) >>> ret = win32security.SetNamedSecurityInfo("C:\\testdir",win32security.SE_FILE_OBJECT,win32security.DACL_SECURITY_INFORMATION,None,None,dacl,None) >>> print ret # None == Success --- On Wed, 12/1/10, Tim Roberts wrote: > From: Tim Roberts > Subject: Re: [python-win32] Inheritance not applied to objects and containers > To: "Python-Win32 List" > Date: Wednesday, December 1, 2010, 6:59 PM > Matthew Howle wrote: > > The permissions are applied to the directory but > subdirectories and > > files within the directory aren't inheriting the > permissions. > > You've stumbled across a very nasty little dark corner. > > There are several APIs for managing security descriptors, > including APIs > like SetFileSecurity, SetSecurityInfo, and > SetNamedSecurityInfo.? You > happened to choose SetFileSecurity.? It turns out this > is a low-level > API which does not automatically propagate the inherited > permissions. > Your permissions will apply to NEW objects, but it doesn't > modify > EXISTING child objects. > > You should investigate either SetSecurityInfo or > SetNamedSecurityInfo. > Both of those will do the propagation automatically. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From kevinlcarlson at gmail.com Wed Dec 1 21:16:56 2010 From: kevinlcarlson at gmail.com (Kevin Carlson) Date: Wed, 1 Dec 2010 12:16:56 -0800 Subject: [python-win32] Checking app windows for certain keywords Message-ID: Hello, My searches didn't turn up anything so I'm posting to the group: I'd like to develop a Python app that periodically scans all open app windows (browser, Word, Outlook, etc.) for specific keywords. The idea is to have an alert window popup (using wxPython) as a reminder to the user to handle certain documents in a special way. Libraries such as WinGuiAuto.py can apparently check the contents of forms, but I haven't seen anything to simply identify keyword text anywhere within an open window. Ideas? Thanks, Kevin From timr at probo.com Wed Dec 1 22:56:20 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 1 Dec 2010 13:56:20 -0800 Subject: [python-win32] Checking app windows for certain keywords In-Reply-To: References: Message-ID: <4CF6C484.3070706@probo.com> Kevin Carlson wrote: > I'd like to develop a Python app that periodically scans all open app > windows (browser, Word, Outlook, etc.) for specific keywords. What does that mean, exactly? Remember that most applications have hundreds of windows (buttons, list boxes, input boxes, tree controls, icons, menu bars, tool bars, etc). Do you mean you want to scan their open documents? If you look at windows, you will often only get the part that's visible right now. > The idea is to have an alert window popup (using wxPython) as a reminder > to the user to handle certain documents in a special way. Hmm, I can see that getting really annoying, really quickly. > Libraries such as WinGuiAuto.py can apparently check the contents of > forms, but I haven't seen anything to simply identify keyword text > anywhere within an open window. Ideas? I don't see why you think a form is different from a window. WinGuiAuto.py would seem to be just what you want, mostly. However, it turns out that what you ask is simply not possible in the general case. You can certainly enumerate all of the top level windows in the system, then enumerate all of the child windows looking for text boxes and rich text controls, then fetch their contents (all using WinGuiAuto.py). Then you can search the text for your keywords. However, that won't work with Word (or any of the other Office applications). The Office applications do not use traditional windows to display their controls. They treat the entire window as a blank canvas, and use their own internal scheme to display the text. You can't use a window message to read the visible part of a Word document. To control Word, you'd have to use COM. That opens up an entirely new can of worms. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rsyring at inteli-com.com Thu Dec 2 02:02:36 2010 From: rsyring at inteli-com.com (Randy Syring) Date: Wed, 01 Dec 2010 20:02:36 -0500 Subject: [python-win32] Running GUI apps from a python/IIS web application Message-ID: <4CF6F02C.4090306@inteli-com.com> I have been tasked with integrating an command line program (.exe) with a python web application. The program is intended to be run by a normal user and therefore pops up a "helpful" GUI window that displays a "working on it" type message while the program gathers data from a remote location. The web application is written in python and uses isapi-wsgi to integrate into IIS. Long story short, I have a routine in my web application that calls the program using the subprocess module, waits for it to finish, and then imports the data it collected. We have successfully tested this routine with the user that the IIS application pool runs under. But, when I try to run said routine from the web application, the external program hangs. It seems likely to me that you can not run a GUI program under a non-interactive service like IIS. But, I am not 100% sure on this so I was hoping that this list might be able to shed some light on this topic. Thank you in advance for any help you might be able to give. -- -------------------------------------- Randy Syring Intelicom Direct: 502-276-0459 Office: 502-212-9913 For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord (Rom 6:23) From timr at probo.com Thu Dec 2 02:28:02 2010 From: timr at probo.com (Tim Roberts) Date: Wed, 1 Dec 2010 17:28:02 -0800 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF6F02C.4090306@inteli-com.com> References: <4CF6F02C.4090306@inteli-com.com> Message-ID: <4CF6F622.2010903@probo.com> Randy Syring wrote: > It seems likely to me that you can not run a GUI program under a > non-interactive service like IIS. But, I am not 100% sure on this so I > was hoping that this list might be able to shed some light on this topic. Your analysis is quite correct. It is possible, through painful and creative use of CreateProcessAsUser, to create a process as the user that is running on the primary visible desktop. Here's more information, although I don't really think it solves your problem: http://msdn.microsoft.com/en-us/library/ms683502.aspx -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rsyring at inteli-com.com Thu Dec 2 03:43:58 2010 From: rsyring at inteli-com.com (Randy Syring) Date: Wed, 01 Dec 2010 21:43:58 -0500 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF6F622.2010903@probo.com> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> Message-ID: <4CF707EE.4000404@inteli-com.com> On 12/01/2010 08:28 PM, Tim Roberts wrote: > Randy Syring wrote: >> It seems likely to me that you can not run a GUI program under a >> non-interactive service like IIS. But, I am not 100% sure on this so I >> was hoping that this list might be able to shed some light on this topic. > Your analysis is quite correct. Thank you for the confirmation. > It is possible, through painful and creative use of CreateProcessAsUser, > to create a process as the user that is running on the primary visible > desktop. Here's more information, although I don't really think it > solves your problem: > > http://msdn.microsoft.com/en-us/library/ms683502.aspx > Good to know, but you are correct that it doesn't solve the problem. This program needs to work even when no users are logged into the server, as that will be the case 99% of the time. Thanks again. -------------------------------------- Randy Syring Intelicom Direct: 502-276-0459 Office: 502-212-9913 For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord (Rom 6:23) From roberto.c.aguilar at gmail.com Thu Dec 2 04:02:06 2010 From: roberto.c.aguilar at gmail.com (Roberto Aguilar) Date: Wed, 1 Dec 2010 19:02:06 -0800 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF707EE.4000404@inteli-com.com> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> Message-ID: On Dec 1, 2010, at 6:43 PM, Randy Syring wrote: > On 12/01/2010 08:28 PM, Tim Roberts wrote: >> Randy Syring wrote: >>> It seems likely to me that you can not run a GUI program under a >>> non-interactive service like IIS. But, I am not 100% sure on this so I >>> was hoping that this list might be able to shed some light on this topic. >> Your analysis is quite correct. > Thank you for the confirmation. >> It is possible, through painful and creative use of CreateProcessAsUser, >> to create a process as the user that is running on the primary visible >> desktop. Here's more information, although I don't really think it >> solves your problem: >> >> http://msdn.microsoft.com/en-us/library/ms683502.aspx >> > Good to know, but you are correct that it doesn't solve the problem. This program needs to work even when no users are logged into the server, as that will be the case 99% of the time. My guess is that you do not have access to the source code of the .exe in order to yank out the dialog and recompile, correct? We had a similar issue at work and ended up using Ollydbg [1] to find out where the msgbox call was being made within the executable. Once located, the msgbox call and associated instructions were replaced with noop calls. Hacky? Absolutely. Did it work? Yep. Hope this helps, -Roberto. [1] http://www.ollydbg.de/ From vernondcole at gmail.com Thu Dec 2 04:38:01 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 1 Dec 2010 20:38:01 -0700 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> Message-ID: There is a registry hack to make a Windows box auto log in when it boots up. If you cannot find an example, get back to me and I will get a sample from a co-worker at a former employer. We had several dozen machines there which were actually servers, but the software was written for a GUI desktop. An auto-login with a Python startup script make them work automatically. Something like that may do the trick for your application. Vernon On Wed, Dec 1, 2010 at 8:02 PM, Roberto Aguilar wrote: > On Dec 1, 2010, at 6:43 PM, Randy Syring wrote: > > On 12/01/2010 08:28 PM, Tim Roberts wrote: > >> Randy Syring wrote: > >>> It seems likely to me that you can not run a GUI program under a > >>> non-interactive service like IIS. But, I am not 100% sure on this so I > >>> was hoping that this list might be able to shed some light on this > topic. > >> Your analysis is quite correct. > > Thank you for the confirmation. > >> It is possible, through painful and creative use of CreateProcessAsUser, > >> to create a process as the user that is running on the primary visible > >> desktop. Here's more information, although I don't really think it > >> solves your problem: > >> > >> http://msdn.microsoft.com/en-us/library/ms683502.aspx > >> > > Good to know, but you are correct that it doesn't solve the problem. > This program needs to work even when no users are logged into the server, > as that will be the case 99% of the time. > > My guess is that you do not have access to the source code of the .exe in > order to yank out the dialog and recompile, correct? > > We had a similar issue at work and ended up using Ollydbg [1] to find out > where the msgbox call was being made within the executable. Once located, > the msgbox call and associated instructions were replaced with noop calls. > > Hacky? Absolutely. Did it work? Yep. > > Hope this helps, > -Roberto. > > [1] http://www.ollydbg.de/ > _______________________________________________ > 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 rupole at hotmail.com Thu Dec 2 04:45:11 2010 From: rupole at hotmail.com (Roger Upole) Date: Wed, 1 Dec 2010 22:45:11 -0500 Subject: [python-win32] Running GUI apps from a python/IIS web application References: <4CF6F02C.4090306@inteli-com.com> Message-ID: You might be able to use win32service.CreateDesktop to give the program a desktop to work with. Roger Randy Syring wrote: >I have been tasked with integrating an command line program (.exe) with a >python web application. The program is intended to be run by a normal user >and therefore pops up a "helpful" GUI window that displays a "working on >it" type message while the program gathers data from a remote location. >The web application is written in python and uses isapi-wsgi to integrate >into IIS. > > Long story short, I have a routine in my web application that calls the > program using the subprocess module, waits for it to finish, and then > imports the data it collected. We have successfully tested this routine > with the user that the IIS application pool runs under. But, when I try > to run said routine from the web application, the external program hangs. > > It seems likely to me that you can not run a GUI program under a > non-interactive service like IIS. But, I am not 100% sure on this so I > was hoping that this list might be able to shed some light on this topic. > > Thank you in advance for any help you might be able to give. > From rsiravara at yahoo.com Thu Dec 2 00:20:21 2010 From: rsiravara at yahoo.com (rmsauthor) Date: Wed, 1 Dec 2010 15:20:21 -0800 (PST) Subject: [python-win32] cannot install pywin32, 'access denied, cannot open archive' In-Reply-To: <4BC5255B.5090307@scheie.homedns.org> References: <4BC5255B.5090307@scheie.homedns.org> Message-ID: <30354395.post@talk.nabble.com> I'm getting the same error and am unable to resolve it. Peter, were you able to install successfully? Peter Scheie-2 wrote: > > I'm trying to install the pywin32-214.win32-py2.5.exe package onto a > Windows XP > virtual machine running on VirtualBox on Ubuntu 9.04 (Jaunty). I've got > python > 2.5 installed. Whenever I try to run the pywin32-214.win32-py2.5.exe, it > first > gives me a "Run As" dialog that asks me which ID it should run under, > either my > own ID (which has administrator privileges) or Administrator. If I choose > my > own ID, I get a Runtime Error saying "Access is denied. Could not open > archive." > If I try to run it as Administrator, it just instantly pops back to the > same > "Run As" dialog. I've tried logging in as Administrator, but I get the > same > thing. I've tried the version 213 package, and I get the same thing. > I've > installed PIL, FileZilla, etc. with no problems. I just can't seem to get > pywin32's installer to run. Any suggestions? Thanks. > > Peter > _______________________________________________ > 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/cannot-install-pywin32%2C-%27access-denied%2C-cannot-open-archive%27-tp28237711p30354395.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From python at bdurham.com Thu Dec 2 12:49:23 2010 From: python at bdurham.com (python at bdurham.com) Date: Thu, 02 Dec 2010 06:49:23 -0500 Subject: [python-win32] Prevent a (Tkinter) window from maximizing via win32 api call? Message-ID: <1291290563.24525.1408268743@webmail.messagingengine.com> If I have a windows handle to my Tkinter window, is there a win32 api call that I can use that will prevent my window from being maximized? There is no way to prevent a resizable window from being maximized in Tkinter other than to remove the window's border and titlebar (both of which I would like to keep). Thank you, Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.brunel at pragmadev.com Thu Dec 2 14:20:13 2010 From: eric.brunel at pragmadev.com (Eric Brunel) Date: Thu, 2 Dec 2010 14:20:13 +0100 Subject: [python-win32] Prevent a (Tkinter) window from maximizing via win32 api call? In-Reply-To: <1291290563.24525.1408268743@webmail.messagingengine.com> References: <1291290563.24525.1408268743@webmail.messagingengine.com> Message-ID: On 2 d?c. 10, at 12:49, python at bdurham.com wrote: > If I have a windows handle to my Tkinter window, is there a win32 > api call that I can use that will prevent my window from being > maximized? > > There is no way to prevent a resizable window from being maximized > in Tkinter other than to remove the window's border and titlebar > (both of which I would like to keep). Are you sure about that? I just tried: from Tkinter import * root = Tk() root.wm_resizable(False, False) and it disables the maximize button. I'm on a Mac though, not sure it works on Windows? > Thank you, > Malcolm -------------- next part -------------- An HTML attachment was scrubbed... URL: From python at bdurham.com Thu Dec 2 15:13:24 2010 From: python at bdurham.com (python at bdurham.com) Date: Thu, 02 Dec 2010 09:13:24 -0500 Subject: [python-win32] Prevent a (Tkinter) window from maximizing via win32 api call? In-Reply-To: References: <1291290563.24525.1408268743@webmail.messagingengine.com> Message-ID: <1291299204.31739.1408289677@webmail.messagingengine.com> Hi Eric, > Are you sure about that? I just tried: My original question said "resizable window" :) I have a *resizable* Tkinter window with min and max sizes set. I want to prevent users from attempting to maximize this window because the window pops over to the upper left of the display - a behavior that my users find very frustrating (and of little value). I can trap the maximize event in Tkinter by binding to a window's event, but the Tkinter raises the event *after* it has maximized the window so I can't cancel the maximize behavior. Thanks for your help! Malcolm On 2 d?c. 10, at 12:49, [1]python at bdurham.com wrote: If I have a windows handle to my Tkinter window, is there a win32 api call that I can use that will prevent my window from being maximized? There is no way to prevent a resizable window from being maximized in Tkinter other than to remove the window's border and titlebar (both of which I would like to keep). References 1. mailto:python at bdurham.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jimragsdale02 at gmail.com Thu Dec 2 15:59:23 2010 From: jimragsdale02 at gmail.com (Jim Ragsdale) Date: Thu, 2 Dec 2010 08:59:23 -0600 Subject: [python-win32] Access femap API, Type mismatch Message-ID: I am trying to access the femap API, and having a bit of trouble. Here is a simple example: from win32com.client import Dispatch femap = Dispatch("femap.model") rc = femap.feAppGetActiveView(viewID) This method, according to the documentation, is supposed to return a long integer in viewID. If I do not define viewID, python returns the error: NameError: name 'viewID' is not defined if I define viewID=0, python returns: com_error: (-2147352571, 'Type mismatch.', None, 1) I ran makepy and it generates a file, but I don't know if it is using it or not. In the file, I can find the definition for the method: def feAppGetActiveView(self, nViewID=pythoncom.Missing): return self._ApplyTypes_(20376, 1, (3, 0), ((16387, 2),), u'feAppGetActiveView', None,nViewID ) To me it looks like win32 is not getting the information about the variable types from com. Is there any way to get around this or am I out of luck? Thanks, Jim From timr at probo.com Thu Dec 2 20:04:57 2010 From: timr at probo.com (Tim Roberts) Date: Thu, 2 Dec 2010 11:04:57 -0800 Subject: [python-win32] Access femap API, Type mismatch In-Reply-To: References: Message-ID: <4CF7EDD9.5090500@probo.com> Jim Ragsdale wrote: > I am trying to access the femap API, and having a bit of trouble. Here > is a simple example: > > from win32com.client import Dispatch > femap = Dispatch("femap.model") > rc = femap.feAppGetActiveView(viewID) > > This method, according to the documentation, is supposed to return a > long integer in viewID. If I do not define viewID, python returns the > error: > > NameError: name 'viewID' is not defined Right, because it's not. Python never passes variables by reference. The language simply does not have that concept. When a COM method has an output parameter, Pythoncom turns it into a true output parameter. What you probably need is this: viewID = femap.feAppGetActiveView() > I ran makepy and it generates a file, but I don't know if it is using > it or not. The use of makepy is critical when the interface includes reference parameters. > In the file, I can find the definition for the method: > > def feAppGetActiveView(self, nViewID=pythoncom.Missing): > return self._ApplyTypes_(20376, 1, (3, 0), ((16387, 2),), > u'feAppGetActiveView', None,nViewID) > > To me it looks like win32 is not getting the information about the > variable types from com. Sure it is. The type code 16387 is VT_I4 + VT_BYREF, which means a 4-byte integer passed by reference. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From greg.antal at ata-e.com Thu Dec 2 19:07:40 2010 From: greg.antal at ata-e.com (Greg Antal) Date: Thu, 02 Dec 2010 10:07:40 -0800 Subject: [python-win32] Access femap API, Type mismatch In-Reply-To: References: Message-ID: <4CF7E06C.9050603@ata-e.com> An HTML attachment was scrubbed... URL: From jimragsdale02 at gmail.com Thu Dec 2 21:01:55 2010 From: jimragsdale02 at gmail.com (Jim Ragsdale) Date: Thu, 2 Dec 2010 14:01:55 -0600 Subject: [python-win32] Access femap API, Type mismatch In-Reply-To: <4CF7E06C.9050603@ata-e.com> References: <4CF7E06C.9050603@ata-e.com> Message-ID: Greg, THANKS!!! That was a big help. I searched all over but could not find any information that I could understand that addressed this. I guess I didn't know what to look for. Thank you for taking the time to write this up. On Thu, Dec 2, 2010 at 12:07 PM, Greg Antal wrote: > Jim: > > The thing about the Femap API is that its class methods use tons of ByRef > arguments to return data to the caller. This is not something Python really > supports. PythonCOM gets around it by turning the output arguments in to > return values, but I find that only works if I enforce early binding. Here's > what I recommend: > > Run makepy on the "femap.tlb" and have it save the output to a file. I > always call that file PyFemap.py. > In your Python code, import this file along with all your other import > statements: import PyFemap. If you look in PyFemap.py, you'll see that it > imports all the win32com stuff it needs, so you don't have to do that > yourself. Also, all the Femap stuff is now accessible by "early binding", > and that is essential when dealing with those pesky return values. > Access the femap model object like this: zFemap = PyFemap.model() > Get the active view ID like this: iRet, iViewId = > zFemap.feAppGetActiveView() > > Item 4 shows how an output argument in VB or C++ becomes a return value in > Python. That happens with every method in the API that uses output > arguments. The standard return code is always first in the list, followed by > the output arguments in the order they appear in the VB argument list. See, > for example, the output vector method "GetOutputList" which retrieves all > the data in the output vector. In Python, the call looks like this: > iRet, nVals, liIds, lrData = zOutVec.GetOutputList(). > > The key thing in all this is to import that PyFemap file. When you do that, > it's infinitely easier to use the Femap API in Python than it is in VB or > C++. If you don't do it, you'll just never get it to work. > > - Greg Antal > > Gregory W. Antal > Senior Technical Advisor > ATA Engineering, Inc. > 11995 El Camino Real, Suite 200 > San Diego, CA 92130 > www.ata-e.com > > greg.antal at ata-e.com > 858-480-2072 (Phone) > 858-792-8932 (Fax) > > Jim Ragsdale wrote, On 12/2/2010 6:59 AM: > > I am trying to access the femap API, and having a bit of trouble. Here > is a simple example: > > from win32com.client import Dispatch > femap = Dispatch("femap.model") > rc = femap.feAppGetActiveView( > viewID) > > This method, according to the documentation, is supposed to return a > long integer in viewID. If I do not define viewID, python returns the > error: > > NameError: name 'viewID' is not defined > > if I define viewID=0, python returns: > > com_error: (-2147352571, 'Type mismatch.', None, 1) > > I ran makepy and it generates a file, but I don't know if it is using > it or not. In the file, I can find the definition for the method: > > def feAppGetActiveView(self, nViewID=pythoncom.Missing): > return self._ApplyTypes_(20376, 1, (3, 0), ((16387, 2),), > u'feAppGetActiveView', None,nViewID > ) > > To me it looks like win32 is not getting the information about the > variable types from com. Is there any way to get around this or am I > out of luck? > > Thanks, > Jim > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From timr at probo.com Thu Dec 2 21:02:40 2010 From: timr at probo.com (Tim Roberts) Date: Thu, 2 Dec 2010 12:02:40 -0800 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF707EE.4000404@inteli-com.com> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> Message-ID: <4CF7FB60.3060208@probo.com> Randy Syring wrote: > > Good to know, but you are correct that it doesn't solve the problem. > This program needs to work even when no users are logged into the > server, as that will be the case 99% of the time. There is no easy solution for this. There is no practical way to run a GUI application when no one is logged in, without delving deep into Windows magic. You will need to modify (or patch) the application. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From RDahlstrom at directedge.com Thu Dec 2 21:24:09 2010 From: RDahlstrom at directedge.com (Dahlstrom, Roger) Date: Thu, 2 Dec 2010 15:24:09 -0500 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF7FB60.3060208@probo.com> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> <4CF7FB60.3060208@probo.com> Message-ID: <78C91C6FD63DD04BB8812EE9288C1E8126A6CCC987@EXCHANGE01.office.directedge.net> Sure there is, autologon! -----Original Message----- From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Tim Roberts Sent: Thursday, December 02, 2010 3:03 PM To: Python-Win32 List Subject: Re: [python-win32] Running GUI apps from a python/IIS web application Randy Syring wrote: > > Good to know, but you are correct that it doesn't solve the problem. > This program needs to work even when no users are logged into the > server, as that will be the case 99% of the time. There is no easy solution for this. There is no practical way to run a GUI application when no one is logged in, without delving deep into Windows magic. You will need to modify (or patch) the application. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 DISCLAIMER: This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. Direct Edge may, at its discretion, monitor and review the content of all e-mail communications. From vernondcole at gmail.com Thu Dec 2 21:58:36 2010 From: vernondcole at gmail.com (Vernon Cole) Date: Thu, 2 Dec 2010 13:58:36 -0700 Subject: [python-win32] Access femap API, Type mismatch In-Reply-To: <4CF7E06C.9050603@ata-e.com> References: <4CF7E06C.9050603@ata-e.com> Message-ID: Jim: Greg's answer is correct for you. Use it. It made me think of the following question which you may safely ignore. VC Dear Gurus: This thread made me wonder. (It happens occasionally.) The IronPython team chose a different work-around for system calls: they have a class which can be used to handle ByRef arguments. The result is less Pythonic and less elegant, but looks more like the calls made using other languages. Consider the following code lifted from adodbapi. The Execute() method is the place where the COM call actually executes the SQL statement which has been loaded into self.cmd: if onIronPython: ra = clr.Reference[int]() # prepare to get a ByRef return parameter recordset = self.cmd.Execute(ra) count = ra.Value # obtain the return value else: #pywin32 recordset, count = self.cmd.Execute() # the return parameter is passed in a tuple For the sake of compatibility, would it be worth the trouble to support the option of using a return parameter helper class? i.e. if an optional parameter is present, if it is a .Reference class, then use it to return the value, else return an exception hinting that it must BE a reference class, else return the value as part of a tuple. The exception text should lead future programmers toward a correct solution. Bad idea, or Good idea? -- Vernon On Thu, Dec 2, 2010 at 11:07 AM, Greg Antal wrote: > Jim: > > The thing about the Femap API is that its class methods use tons of ByRef > arguments to return data to the caller. This is not something Python really > supports. PythonCOM gets around it by turning the output arguments in to > return values, but I find that only works if I enforce early binding. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Dec 2 22:05:06 2010 From: timr at probo.com (Tim Roberts) Date: Thu, 2 Dec 2010 13:05:06 -0800 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <78C91C6FD63DD04BB8812EE9288C1E8126A6CCC987@EXCHANGE01.office.directedge.net> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> <4CF7FB60.3060208@probo.com> <78C91C6FD63DD04BB8812EE9288C1E8126A6CCC987@EXCHANGE01.office.directedge.net> Message-ID: <4CF80A02.4070909@probo.com> Dahlstrom, Roger wrote: > Sure there is, autologon! Ah, but if one uses autologon, then it is no longer the case that "no one is logged in", so I think my comment is still valid... ;) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rsyring at inteli-com.com Thu Dec 2 23:07:02 2010 From: rsyring at inteli-com.com (Randy Syring) Date: Thu, 02 Dec 2010 17:07:02 -0500 Subject: [python-win32] Running GUI apps from a python/IIS web application In-Reply-To: <4CF7FB60.3060208@probo.com> References: <4CF6F02C.4090306@inteli-com.com> <4CF6F622.2010903@probo.com> <4CF707EE.4000404@inteli-com.com> <4CF7FB60.3060208@probo.com> Message-ID: <4CF81886.30507@inteli-com.com> Thanks for all the responses on this. I spoke with the company that develops the external application and they are going to work on removing the calls that create the GUI windows. Thank God, b/c the workarounds were looking pretty unsavory! -------------------------------------- Randy Syring Intelicom Direct: 502-276-0459 Office: 502-212-9913 For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord (Rom 6:23) On 12/02/2010 03:02 PM, Tim Roberts wrote: > Randy Syring wrote: >> Good to know, but you are correct that it doesn't solve the problem. >> This program needs to work even when no users are logged into the >> server, as that will be the case 99% of the time. > There is no easy solution for this. There is no practical way to run a > GUI application when no one is logged in, without delving deep into > Windows magic. You will need to modify (or patch) the application. > From greg.ewing at canterbury.ac.nz Thu Dec 2 23:11:38 2010 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 03 Dec 2010 11:11:38 +1300 Subject: [python-win32] Prevent a (Tkinter) window from maximizing via win32 api call? In-Reply-To: <1291299204.31739.1408289677@webmail.messagingengine.com> References: <1291290563.24525.1408268743@webmail.messagingengine.com> <1291299204.31739.1408289677@webmail.messagingengine.com> Message-ID: <4CF8199A.2010101@canterbury.ac.nz> python at bdurham.com wrote: > I have a *resizable* Tkinter window with min and max sizes set. I want > to prevent users from attempting to maximize this window because the > window pops over to the upper left of the display - a behavior that my > users find very frustrating (and of little value). If they find it annoying, why can't they simply refrain from maximising the window? Nobody's forcing them to *use* the maximise button... -- Greg From ckkart at hoc.net Sun Dec 5 11:48:27 2010 From: ckkart at hoc.net (Christian K.) Date: Sun, 05 Dec 2010 11:48:27 +0100 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty Message-ID: Hi, has anybody experiencs in writing Outlook com addins using the IRibbonExtensibilty mechanism? I would like to make use of the ui features provided by office 2010. Currently I am creating office toolbars as demonstrated in the win32com.demos and all toolbars go to the "Addins" tab. Thanks in advance, Christian From robert2682 at verizon.net Mon Dec 6 05:42:42 2010 From: robert2682 at verizon.net (robert2682) Date: Sun, 05 Dec 2010 23:42:42 -0500 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty In-Reply-To: References: Message-ID: <4CFC69C2.9040307@verizon.net> Christian K. wrote: > Hi, > > has anybody experiencs in writing Outlook com addins using the > IRibbonExtensibilty mechanism? I would like to make use of the ui > features provided by office 2010. Currently I am creating office > toolbars as demonstrated in the win32com.demos and all toolbars go to > the "Addins" tab. > > Thanks in advance, Christian > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > Hi, I tried to get it working using Excel 2007 (I have not tried 2010). I was able to get the extension to display on the Ribbon, and was able to call a function on a button click, but I ran into trouble reading the value of the IRibbonControl parameter to the callback. I just kept getting a com error (I don't recall the number, but it was the one that means generic error to Microsoft) trying to access the properties of the IRibbonControl. I spent a goodly amount of time on this, and eventually decided it was some kind of bug. I had meant to post a small program demonstrating the bug, but never got to it. If you make any progress, or want to discuss this further, please let me know, on or off list. Robert Kaplan robert2682 at verizon.net From ugshrin9 at rockwellcollins.com Mon Dec 6 18:44:02 2010 From: ugshrin9 at rockwellcollins.com (ugshrin9 at rockwellcollins.com) Date: Mon, 6 Dec 2010 11:44:02 -0600 Subject: [python-win32] Regarding "LICENSING INFORMATION" for PyWin 32 Message-ID: Dear Sir/Madam, This is Uday Shriniwar, I am a Software Engineer at Rockwell Collins. We are using Python and PyWin32. We need Licensing Information for both. We managed to get Licensing Information for Python but could not find any information regarding PyWin32. It would be a great help if you could tell us the information needed. Regards, Uday Shriniwar -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Mon Dec 6 23:00:42 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 06 Dec 2010 14:00:42 -0800 Subject: [python-win32] Regarding "LICENSING INFORMATION" for PyWin 32 In-Reply-To: References: Message-ID: <4CFD5D0A.5040304@gmail.com> Sadly the license files aren't included with the binary builds, but you can find them in the source code. The short story is it currently uses a very permissive BSD style license, but my intention is to eventually relicense them under the same terms as Python itself, mainly for consistency. This means you can pretty-much whatever you like with them... HTH, Mark On 6/12/2010 9:44 AM, ugshrin9 at rockwellcollins.com wrote: > > Dear Sir/Madam, > > This is Uday Shriniwar, I am a Software Engineer at Rockwell Collins. We > are using Python and PyWin32. We need Licensing Information for both. > We managed to get Licensing Information for Python but could not find > any information regarding PyWin32. > > It would be a great help if you could tell us the information needed. > > Regards, > Uday Shriniwar > > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 From erik at softwaresociety.nl Tue Dec 7 10:00:14 2010 From: erik at softwaresociety.nl (Erik Oosterwaal) Date: Tue, 7 Dec 2010 09:00:14 +0000 Subject: [python-win32] Python in classic ASP Message-ID: Hi Everybody, In reply to my own mail, because others might run into the same problem; I received some help from Mark Hammond regarding the use of Python in WSC's. Here's the deal: 1. It is possible to use a Python WSC from vbscript ASP, as long as your returnvalues are simple types (strings, integers..) or COM types (so having a Python WSC that passes an ADO recordset object from a vbscript WSC to a vbscript ASP page will work). 2. Even when using Python WSC's and calling them from a Python code block, it is not possible to pass Python objects to and from the WSC. The WSC is still a "com-layer" between the ASP page and the Python code in the WSC, and it wants all passed objects to be com variants. You will get an error like: Unexpected Python Error: TypeError: Objects of type 'module' can not be converted to a COM VARIANT 3. The tag you can normally use in a WSC doesn't work, so you don't have IIS' objects available. A workaround for this is to pass these objects from ASP to the WSC yourself: class IISobjectsClass public request, response, session, application, server end class dim IISobjects set IISobjects = new IISobjectsClass set IISobjects.request = request set IISobjects.response = response set IISobjects.session = session set IISobjects.application = application set IISobjects.server = server ' suppose we have a translation WSC in the current directory, that has open(), close() and Label() functions defined. ' the open() function could have a parameter to accept the IISobjects, so you pass them to, and have them available inside the WSC : Dim translate Set translate = GetObject("script:" & Server.MapPath("./translate.wsc") ) translate.open(IISobjects) Response.Write(translate.label("firstname")) translate.close() Set translate = Nothing 4. When an error occurs in the Python code of the WSC, there will be a very vague ASP error, i.e.: error '80020009' Exception occurred. Mark has concluded that the Python engine -is- reporting the error, but the script container doesn't pass it to asp. Python doesn't print the error, assuming asp will show it. A workaround for this is to decorate the functions in the WSC you want to debug: Add this function to the top of the Python WSC: def debug(func): def callit(*args, **kw): try: return func(*args, **kw) except: import traceback traceback.print_exc() raise return callit Then add the decorator to the function you want to debug, any other functions that get called by the function you decorated will also be debugged: @debug def Label(lblName): """ Returns a specific label from a Python dictionary """ global d, new_labels_added if str(lblName) in d: return d[str(lblName)] else: d[lblName] = unicode(str(lcid) + "|" + lblName) new_labels_added = True return str(lcid) + "|" + lblName Any errors will now show up in a Python trace collector. I have tested this under IIS6 on XP and IIS7 on Windows 7 x64 (setting the application pool to support 32-bit). Under IIS6 this works out of the box (when enabling server-side debugging). Under IIS7 I had to adjust some settings in the IIS configuration to get it to work. Unfortunately I don't know exactly what settings I changed on IIS7 to get the errors to be passed from the WSC to ASP and the trace collector, but at first the "exception occurred" error that IIS6 gave me was not showing up in IIS7, just a blank screen. Messing with some of the debugging settings in IIS7 made them show up eventually and at that point the trace collector was also showing me the underlying Python errors. Problem nr. 2 mentioned above (not being able to pass Python objects from a WSC to an ASP page and vice versa), limits the usability of Python in WSC's severely. There is another option Mark suggested; using plain Python in ASP (in a If you include Python blocks in your page, it is possible to access Python functions from other languages (i.e. vbscript) if there are multiple of these script blocks on the page. Please note however that there are some things to consider regarding the order in which these blocks are processed by IIS: http://phrogz.net/tmp/serversidejsandvb.html Using this method Python can access all of IIS' special objects as well. I'm still struggling now to get the Python imports to work like my WSC's work, so I don't have to change the syntax throughout my pages; i.e.; I have a "translate" wsc, and currently I can translate parts of a webpage by saying for example: Translate.Label("pagetitle") In the Python example above I would import "translate.py" and then call the Label() function directly, so without the leading "Translate.". In order to maintain the same syntax I guess I need to write a class inside the .py file and import that, but being new to Python I haven't yet figured out how that works exactly. Hopefully this helps some other people struggling with Python/classic asp/WSC's, if there still are any :) Thanks to Mark for all of his help. Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From ckkart at hoc.net Tue Dec 7 21:03:10 2010 From: ckkart at hoc.net (Christian K.) Date: Tue, 07 Dec 2010 21:03:10 +0100 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty In-Reply-To: <4CFC69C2.9040307@verizon.net> References: <4CFC69C2.9040307@verizon.net> Message-ID: Am 06.12.10 05:42, schrieb robert2682: > Christian K. wrote: >> Hi, >> >> has anybody experiencs in writing Outlook com addins using the >> IRibbonExtensibilty mechanism? I would like to make use of the ui >> features provided by office 2010. Currently I am creating office >> toolbars as demonstrated in the win32com.demos and all toolbars go to >> the "Addins" tab. > > I tried to get it working using Excel 2007 (I have not tried 2010). I > was able to get the extension to display on the Ribbon, and was able to I even fail to get that far. What do I have to change here to be able access the new style toolbars? class Addin: _com_interfaces_ = ['_IDTExtensibility2'] _public_methods_ = [] _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER _reg_clsid_ = "{D371B22C-78B1-4271-8C10-60AE4719CEE5}" _reg_progid_ = "my_addin" _reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy" I must admit that I have neither read M.Hammonds book nor am I a windows programmer. > call a function on a button click, but I ran into trouble reading the > value of the IRibbonControl parameter to the callback. I just kept > getting a com error (I don't recall the number, but it was the one that > means generic error to Microsoft) trying to access the properties of the > IRibbonControl. I spent a goodly amount of time on this, and eventually > decided it was some kind of bug. > > I had meant to post a small program demonstrating the bug, but never got > to it. If you make any progress, or want to discuss this further, please > let me know, on or off list. Let us continue the discussion here. I would have been glad if I had found something about that topic while searching. Regards, Christian From m.g.bode at web.de Tue Dec 7 21:08:24 2010 From: m.g.bode at web.de (Michael Bode) Date: Tue, 07 Dec 2010 21:08:24 +0100 Subject: [python-win32] what means "library not registered"? Message-ID: <4CFE9438.7070501@web.de> I'm trying to use a 3rd party COM dll for which I have only instructions how to use it in VB. The instructions say I have to create a cFM2Listener object, obtain an IFM2Listener interface from it, implement my own version of a cFM2DeviceEvents object and assign that to the DeviceEvents property of the cFM2Listener object. I called makepy on the dll (FieldMax2DLLServer.dll) and got a 3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050x0x2x0.py file. Then I try to implement the cFM2DeviceEvents object which has to implement the IFM2DeviceEvents interface. import win32com.client import win32com.server.util from win32com import universal class Notifier(object): _public_methods_ = [ 'DisplayErrorToClient', 'NotifyData', 'NotifyDeviceStatus', 'DisplayZeroDeviceProgressToClient'] _public_attrs_ = [ 'CallbackEvent', 'CallbackMessage', 'DeviceIndex', 'SerialNumber', 'ZeroDeviceTimeoutCounter'] _com_interfaces_ = [ '_IFM2DeviceEvents' ] _typelib_guid_ = '{3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050}' _typelib_version = 2, 0 def __init__(self): self._CallbackEvent = "" self._CallbackMessage = "" self._DeviceIndex = 0 self._SerialNumber = "" self._ZeroDeviceTimeoutCounter = 0 def DisplayErrorToClient(self): print "DisplayErrorToClient" def NotifyData(self, CallbackData): print "NotifyData" def NotifyDeviceStatus(self, CallbackData, DevicesList): print "NotifyDeviceStatus" def DisplayZeroDeviceProgressToClient(self): print "DisplayZeroDeviceProgressToClient" def get_CallbackEvent(self): return self._CallbackEvent def set_CallbackEvent(self, value): self._CallbackEvent = value CallbackEvent = property(get_CallbackEvent, set_CallbackEvent, doc = "CallbackEvent property") def get_DeviceIndex(self): return self._DeviceIndex def set_DeviceIndex(self, value): self._DeviceIndex = value DeviceIndex = property(get_DeviceIndex, set_DeviceIndex, doc = "DeviceIndex property") def get_SerialNumber(self): return self._SerialNumber def set_SerialNumber(self, value): self._SerialNumber = value SerialNumber = property(get_SerialNumber, set_SerialNumber, doc = "SerialNumber property") def set_ZeroDeviceTimeoutCounter(self, value): self._ZeroDeviceTimeoutCounter = value ZeroDeviceTimeoutCounter = property(fset = set_ZeroDeviceTimeoutCounter, doc = "ZeroDeviceTimeoutCounter property") win32com.client.gencache.EnsureModule('{3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050}', 0, 2, 0) print "gencache" fml = win32com.client.Dispatch("FieldMax2DLLServer.cFM2Listener") print fml universal.RegisterInterfaces('{3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050}', 0, 2, 0, ['_IFM2DeviceEvents']) print "RegisterInterfaces" NM = Notifier() print NM notifyMe = win32com.server.util.wrap(NM, useDispatcher=1) And here I get the following error: Traceback (most recent call last): File "C:\myprogs\python\comtest\comtest.py", line 63, in notifyMe = win32com.server.util.wrap(NM, useDispatcher=1) File "C:\Python27\lib\site-packages\win32com\server\util.py", line 25, in wrap ob = useDispatcher(usePolicy, ob) File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 203, in __init__ DispatcherTrace.__init__(self, policyClass, object) File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py", line 24, in __init__ self.policy = policyClass(object) File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 181, in __init__ self._wrap_(object) File "C:\Python27\lib\site-packages\win32com\server\policy.py", line 466, in _wrap_ tlb_major, tlb_minor, interfaces) File "C:\Python27\lib\site-packages\win32com\universal.py", line 21, in RegisterInterfaces tlb = pythoncom.LoadRegTypeLib(typelibGUID, major, minor, lcid) com_error: (-2147319779, 'Bibliothek nicht registriert.', None, None) The message in the last line translates to 'library not registered'. I have a sample VB program which works fine, so I don't think this means there is something wrong with the FieldMax2DLLServer.dll. But what am I doing wrong here? -- PGP fingerprint: A391 4109 F8D0 F67B C504 1EF6 0158 E3BB 3687 53CF From robert2682 at verizon.net Wed Dec 8 03:18:57 2010 From: robert2682 at verizon.net (robert2682) Date: Tue, 07 Dec 2010 21:18:57 -0500 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty In-Reply-To: References: <4CFC69C2.9040307@verizon.net> Message-ID: <4CFEEB11.2020506@verizon.net> Christian K. wrote: > I even fail to get that far. What do I have to change here to be able > access the new style toolbars? > > class Addin: > _com_interfaces_ = ['_IDTExtensibility2'] > _public_methods_ = [] > _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER > _reg_clsid_ = "{D371B22C-78B1-4271-8C10-60AE4719CEE5}" > _reg_progid_ = "my_addin" > _reg_policy_spec_ = "win32com.server.policy.EventHandlerPolicy" > > I must admit that I have neither read M.Hammonds book nor am I a > windows programmer. > It's quite different. For example, you have to write XML for the controls for the ribbon. I'll work up the sample program I'd been meaning to do and post that. It may be a day or 2 as I have to redo my working code. > Let us continue the discussion here. I would have been glad if I had > found > something about that topic while searching. > > Regards, Christian > Bob From robert2682 at verizon.net Thu Dec 9 00:05:52 2010 From: robert2682 at verizon.net (robert2682) Date: Wed, 08 Dec 2010 18:05:52 -0500 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty In-Reply-To: References: <4CFC69C2.9040307@verizon.net> Message-ID: <4D000F50.9020902@verizon.net> Christian K. wrote: Hi Christian, As promised, attached please find a sample program for accessing the Office Ribbon from Python. A couple notes: 1) The program I've written is for Excel; if you want Outlook you'll need to change the registration code, but this shouldn't be a big deal! 2) I'd appreciate it if you'll let me know whether the Tag attribute in the callback can be read. This is the problem I mentioned in my initial response. Just let me know the contents of the second message box after clicking the button in Office. 3) If you get into this and have to start writing XML, you might want to pick up a copy of "Ribbon X: Customizing the Office 2007 Ribbon." It's written from a VBA perspective but has a lot of info on the Ribbon controls, their attributes and callbacks. If there are errors in the XML, Excel silently ignores it, not adding anything to the ribbon. Hope this helps. Robert Kaplan robert2682 at veriozn.net -------------- next part -------------- A non-text attachment was scrubbed... Name: ribbon.py Type: text/x-python Size: 6809 bytes Desc: not available URL: From ckkart at hoc.net Thu Dec 9 07:11:25 2010 From: ckkart at hoc.net (Christian K.) Date: Thu, 09 Dec 2010 07:11:25 +0100 Subject: [python-win32] 2010 com addin and IRibbonExtensibilty In-Reply-To: <4D000F50.9020902@verizon.net> References: <4CFC69C2.9040307@verizon.net> <4D000F50.9020902@verizon.net> Message-ID: <4D00730D.5000006@hoc.net> Hi Robert, Am 09.12.10 00:05, schrieb robert2682: 2) I'd appreciate it if you'll let me know whether the Tag attribute in > the callback can be read. This is the problem I mentioned in my initial > response. Just let me know the contents of the second message box after > clicking the button in Office. I did a quick test (with Excel) and it seems to work: Getting tag ok, tag=RibbonCall Let me know if I can help with further tests. Now I will have a look at your code. Thanks a lot! Christian From noa.grasdovitch at live.biu.ac.il Sat Dec 11 18:36:29 2010 From: noa.grasdovitch at live.biu.ac.il (nonino) Date: Sat, 11 Dec 2010 09:36:29 -0800 (PST) Subject: [python-win32] get file tags in windows7 vista Message-ID: <30434433.post@talk.nabble.com> Hi, First I would like to say that I really searched the net but couldn't find an answer... (I found someone who asked the same question but couldn't track him/her). I am trying to read file tags in windows7 and/or vista. How can I do that? I have tried win32file.getAttributesEx('my file name') and all I got is date I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not supported. Can you please help me? I am trying to write this little program for my PhD but with no luck... Thanks, Noa -- View this message in context: http://old.nabble.com/get-file-tags-in-windows7-vista-tp30434433p30434433.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From smokefloat at gmail.com Sun Dec 12 03:31:14 2010 From: smokefloat at gmail.com (David Hutto) Date: Sat, 11 Dec 2010 21:31:14 -0500 Subject: [python-win32] get file tags in windows7 vista In-Reply-To: <30434433.post@talk.nabble.com> References: <30434433.post@talk.nabble.com> Message-ID: On Sat, Dec 11, 2010 at 12:36 PM, nonino wrote: > > Hi, > > First I would like to say that I really searched the net but couldn't find > an answer... (I found someone who asked the same question but couldn't track > him/her). > > I am trying to read file tags in windows7 and/or vista. > How can I do that? > I have tried win32file.getAttributesEx('my file name') and all I got is date > I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not > supported. > > Can you please help me? I am trying to write this little program for my PhD > but with no luck... > Thanks, On Sat, Dec 11, 2010 at 12:36 PM, nonino wrote: > > Hi, > > First I would like to say that I really searched the net but couldn't find > an answer... (I found someone who asked the same question but couldn't track > him/her). Maybe: http://www.google.com/search?client=ubuntu&channel=fs&q=file+tags+in+windows7+and%2For+vista&ie=utf-8&oe=utf-8 > > I am trying to read file tags in windows7 and/or vista. > How can I do that? > I have tried win32file.getAttributesEx('my file name') and all I got is date > I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not > supported. > > Can you please help me? I am trying to write this little program for my PhD > but with no luck... PhD implies you provide more info. > Thanks, > Noa > -- > View this message in context: http://old.nabble.com/get-file-tags-in-windows7-vista-tp30434433p30434433.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 noa.grasdovitch at live.biu.ac.il Sun Dec 12 09:20:08 2010 From: noa.grasdovitch at live.biu.ac.il (nonino) Date: Sun, 12 Dec 2010 00:20:08 -0800 (PST) Subject: [python-win32] get file tags in windows7 vista In-Reply-To: References: <30434433.post@talk.nabble.com> Message-ID: <30437184.post@talk.nabble.com> Ok, Lets start from the beginning: I am doing a PhD in information science. As part of my study I am studying the use of folders vs. tags. starting from windows vista there is an option in windows to add tags to office files photos and other file formats. In the first part of my experience I will run on the participant's computer a program (the one that I am trying to write:)) that return the ouput: 1000 files in total: 100 in under folder hierarchy of 4, 300 under folder hierarchy of 3 600 under folder hierarchy of 2. (I wrote this program with os.walk) then I will teach the participants how to use the tag options and will ask them to tag their files for the next 2 weeks. After two weeks I would like to run again the program and now to see how many tags were added. so the output will be for example: 1010 files in total: 105 in under folder hierarchy of 4, 305 under folder hierarchy of 3 600 under folder hierarchy of 2. 7 files with 3 tags 3 files with 2 tags 10 files with 1 tag. So, please help me. how can I get those tags out of the files? David Hutto-2 wrote: > > On Sat, Dec 11, 2010 at 12:36 PM, nonino > wrote: >> >> Hi, >> >> First I would like to say that I really searched the net but couldn't >> find >> an answer... (I found someone who asked the same question but couldn't >> track >> him/her). >> >> I am trying to read file tags in windows7 and/or vista. >> How can I do that? >> I have tried win32file.getAttributesEx('my file name') and all I got is >> date >> I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not >> supported. >> >> Can you please help me? I am trying to write this little program for my >> PhD >> but with no luck... >> Thanks, > > On Sat, Dec 11, 2010 at 12:36 PM, nonino > wrote: >> >> Hi, >> >> First I would like to say that I really searched the net but couldn't >> find >> an answer... (I found someone who asked the same question but couldn't >> track >> him/her). > > Maybe: > http://www.google.com/search?client=ubuntu&channel=fs&q=file+tags+in+windows7+and%2For+vista&ie=utf-8&oe=utf-8 > >> >> I am trying to read file tags in windows7 and/or vista. >> How can I do that? >> I have tried win32file.getAttributesEx('my file name') and all I got is >> date >> I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not >> supported. >> >> Can you please help me? I am trying to write this little program for my >> PhD >> but with no luck... > > PhD implies you provide more info. > > >> Thanks, >> Noa >> -- >> View this message in context: >> http://old.nabble.com/get-file-tags-in-windows7-vista-tp30434433p30434433.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/get-file-tags-in-windows7-vista-tp30434433p30437184.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From smokefloat at gmail.com Sun Dec 12 20:23:58 2010 From: smokefloat at gmail.com (David Hutto) Date: Sun, 12 Dec 2010 14:23:58 -0500 Subject: [python-win32] get file tags in windows7 vista In-Reply-To: <30437184.post@talk.nabble.com> References: <30434433.post@talk.nabble.com> <30437184.post@talk.nabble.com> Message-ID: On Sun, Dec 12, 2010 at 3:20 AM, nonino wrote: > > Ok, Lets start from the beginning: > I am doing a PhD in information science. As part of my study I am studying > the use of folders vs. tags. starting from windows vista there is an option > in windows to add tags to office files photos and other file formats. In the > first part of my experience I will run on the participant's computer a > program (the one that I am trying to write:)) that return the ouput: 1000 > files in total: 100 in under folder hierarchy of 4, 300 under folder > hierarchy of 3 600 under folder hierarchy of 2. (I wrote this program with > os.walk) then I will teach the participants how to use the tag options and > will ask them to tag their files for the next 2 weeks. > After two weeks I would like to run again the program and now to see how > many tags were added. So you have a tag. This is a specific mark, a regular expression. You need to search for the instances of this tag in a file, and then utilize the info in between these tags. Us sophisticated doctors and PhD's would splice out the info in between tags, right?:) help(re) And scientific method from there. so the output will be for example: 1010 files in > total: 105 in under folder hierarchy of 4, 305 under folder hierarchy of 3 > 600 under folder hierarchy of 2. 7 files with 3 tags 3 files with 2 tags 10 > files with 1 tag. > So, please help me. how can I get those tags out of the files? > > > David Hutto-2 wrote: >> >> On Sat, Dec 11, 2010 at 12:36 PM, nonino >> wrote: >>> >>> Hi, >>> >>> First I would like to say that I really searched the net but couldn't >>> find >>> an answer... (I found someone who asked the same question but couldn't >>> track >>> him/her). >>> >>> I am trying to read file tags in windows7 and/or vista. >>> How can I do that? >>> I have tried win32file.getAttributesEx('my file name') and all I got is >>> date >>> I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not >>> supported. >>> >>> Can you please help me? I am trying to write this little program for my >>> PhD >>> but with no luck... >>> Thanks, >> >> On Sat, Dec 11, 2010 at 12:36 PM, nonino >> wrote: >>> >>> Hi, >>> >>> First I would like to say that I really searched the net but couldn't >>> find >>> an answer... (I found someone who asked the same question but couldn't >>> track >>> him/her). >> >> Maybe: >> http://www.google.com/search?client=ubuntu&channel=fs&q=file+tags+in+windows7+and%2For+vista&ie=utf-8&oe=utf-8 >> >>> >>> I am trying to read file tags in windows7 and/or vista. >>> How can I do that? >>> I have tried win32file.getAttributesEx('my file name') and all I got is >>> date >>> I tried to add FILE_ATTRIBUTE_SYSTEM and got that this level is not >>> supported. >>> >>> Can you please help me? I am trying to write this little program for my >>> PhD >>> but with no luck... >> >> PhD implies you provide more info. >> >> >>> Thanks, >>> Noa >>> -- >>> View this message in context: >>> http://old.nabble.com/get-file-tags-in-windows7-vista-tp30434433p30434433.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/get-file-tags-in-windows7-vista-tp30434433p30437184.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 skippy.hammond at gmail.com Sun Dec 12 20:41:22 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sun, 12 Dec 2010 11:41:22 -0800 Subject: [python-win32] get file tags in windows7 vista In-Reply-To: <30437184.post@talk.nabble.com> References: <30434433.post@talk.nabble.com> <30437184.post@talk.nabble.com> Message-ID: <4D052562.5010602@gmail.com> On 12/12/2010 12:20 AM, nonino wrote: > > Ok, Lets start from the beginning: > I am doing a PhD in information science. As part of my study I am studying > the use of folders vs. tags. starting from windows vista there is an option > in windows to add tags to office files photos and other file formats. In the I'm completely guessing here, but I suspect different techniques are used depending on the file format. eg, I suspect that jpg files used the EXIF data, while office files etc use "structured storage". Windows may have APIs available in Vista to hide these details from you, but I'm not familiar with them. You probably need to do a little research into how you would access these tags using any language, then we could help you use those same techniques from Python. Cheers, Mark From rupole at hotmail.com Sun Dec 12 23:40:33 2010 From: rupole at hotmail.com (Roger Upole) Date: Sun, 12 Dec 2010 17:40:33 -0500 Subject: [python-win32] get file tags in windows7 vista References: <30434433.post@talk.nabble.com> <30437184.post@talk.nabble.com> Message-ID: nonino wrote: > > Ok, Lets start from the beginning: > I am doing a PhD in information science. As part of my study I am studying > the use of folders vs. tags. starting from windows vista there is an > option > in windows to add tags to office files photos and other file formats. In > the > first part of my experience I will run on the participant's computer a > program (the one that I am trying to write:)) that return the ouput: 1000 > files in total: 100 in under folder hierarchy of 4, 300 under folder > hierarchy of 3 600 under folder hierarchy of 2. (I wrote this program with > os.walk) then I will teach the participants how to use the tag options and > will ask them to tag their files for the next 2 weeks. > After two weeks I would like to run again the program and now to see how > many tags were added. so the output will be for example: 1010 files in > total: 105 in under folder hierarchy of 4, 305 under folder hierarchy of 3 > 600 under folder hierarchy of 2. 7 files with 3 tags 3 files with 2 tags > 10 > files with 1 tag. > So, please help me. how can I get those tags out of the files? > The low-level Property System interfaces introduced in Vista haven't been wrapped in Pywin32 yet. However, you can use the higher level shell objects to retrieve any column that can be displayed in Explorer. As a starting point, here's a script that uses the shell objects. http://web.archive.org/web/20070228173702/www.uselesspython.com/download.php?script_id=124 Roger From erik at softwaresociety.nl Mon Dec 13 16:49:42 2010 From: erik at softwaresociety.nl (Erik Oosterwaal) Date: Mon, 13 Dec 2010 15:49:42 +0000 Subject: [python-win32] Import issue in pyscript Message-ID: Hi All, After struggling using Python in classic ASP for quite a while, I have settled on a method to implement Python inside an existing project. What I want to do is use an import() statement in a Python/PyScript code block in ASP to import a Python class, and in vbscript call some methods from that class. The contents of the two simple files I used to test this is below. I get the following error: Python ActiveX Scripting Engine error '80020009' Traceback (most recent call last): File " --------------------- end pytest.asp --------------------- --------------------- pythonwsc.py --------------------- class justtesting: import win32traceutil import sys import os.path def __init__(self): pass def test(self): """Testing a simple function""" returnvalue = 'Simple test succeeded' return returnvalue def test_asp_objects(self): Response.Write("testing response.write") return Server.MapPath(".") def trigger_error(self): (x,y) = (5,0) z=x/y def list_builtins(self): """Small Python test, listing the builtin functions using the Python 'dir' command""" l = dir(__builtins__) strl = "
".join(l) #dir returns a sorted list of strings, join into one big string with BR's inside return strl --------------------- end pythonwsc.py --------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Tue Dec 14 20:08:43 2010 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 14 Dec 2010 11:08:43 -0800 Subject: [python-win32] Import issue in pyscript In-Reply-To: References: Message-ID: <4D07C0BB.2070704@gmail.com> On 13/12/2010 7:49 AM, Erik Oosterwaal wrote: > The contents of the two simple files I used to test this is below. I get > the following error: > > Python ActiveX Scripting Engine error '80020009' > > Traceback (most recent call last): File "