From Edward.Irwin at loudoun.gov Tue Sep 9 21:11:34 2014 From: Edward.Irwin at loudoun.gov (Irwin, Edward) Date: Tue, 9 Sep 2014 19:11:34 +0000 Subject: [python-win32] Build 219, adodbapi: no module apibase Message-ID: <8A76FE2D6AFC494981AEEBFFF8E8D93738ED90A0@govmbx02> Vernon, Any update on a new compiled version of pywin that includes all the adodbapi components? If not, how should I go about making my system work? I want to document the exact steps so our sys admin can replicate on other systems that are running PyWin. So far I have identified that apibase.py and process_connect_string.py are missing. I first tried to run adodbapi-2.6.0.7\setup.py to repair it, but that did not resolve my issues. Next, I manually copied the files to site-packages\adodbapi and everything seemed to work. How should I be patching my site-package of adodbapi? Is there another option? Sys.version '2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]' Thanks Ed -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Sep 10 18:52:14 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Wed, 10 Sep 2014 16:52:14 +0000 Subject: [python-win32] Build 219, adodbapi: no module apibase In-Reply-To: <8A76FE2D6AFC494981AEEBFFF8E8D93738ED90A0@govmbx02> References: <8A76FE2D6AFC494981AEEBFFF8E8D93738ED90A0@govmbx02> Message-ID: Dear Edward: I feel your pain. The whole idea of including adodbapi as part of pywin32 was to eliminate having to download and install it as a separate product. Having it broken in this release sadly means a trip back in time to the bad old days. Here are the steps I took to attempt to reproduce your problem: 1) create an new Windaws 8.1 virtual machine on Azure 2) install Python 2.7.8 32 bit from python.org using msi. 3) instal pywin32 v 219 for 32 bit Python 2.7 from http://sourceforge.net/projects/pywin32 4) put a "python" command on the search path using the method of my choice 5) download adodbapi from http://sourceforge.net/projects/adodbapi 6) unzip adodbapi 7) running *as an administrator*,in the unzipped directory, "python setup.py install" C:\Users\vernon>c:\python27\python.exe > Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] > on win > 32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import adodbapi > >>> adodbapi.version > 'adodbapi v2.6.0.6' > >>> exit() > And that should do it. On Tue, Sep 9, 2014 at 7:11 PM, Irwin, Edward wrote: > Vernon, > > > > Any update on a new compiled version of pywin that includes all the > adodbapi components? > > > > If not, how should I go about making my system work? I want to document > the exact steps so our sys admin can replicate on other systems that are > running PyWin. So far I have identified that apibase.py and > process_connect_string.py are missing. I first tried to run > adodbapi-2.6.0.7\setup.py to repair it, but that did not resolve my > issues. Next, I manually copied the files to site-packages\adodbapi and > everything seemed to work. How should I be patching my site-package of > adodbapi? Is there another option? > > > > Sys.version '2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit > (Intel)]' > > > > > > Thanks > > > > Ed > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Edward.Irwin at loudoun.gov Wed Sep 10 22:10:18 2014 From: Edward.Irwin at loudoun.gov (Irwin, Edward) Date: Wed, 10 Sep 2014 20:10:18 +0000 Subject: [python-win32] Build 219, adodbapi: no module apibase In-Reply-To: References: <8A76FE2D6AFC494981AEEBFFF8E8D93738ED90A0@govmbx02> Message-ID: <8A76FE2D6AFC494981AEEBFFF8E8D93738ED97CF@govmbx02> Vernon, I tested and it worked like a charm. Thank you for helping me dispatch that headache so quickly. Ed From: Vernon D. Cole [mailto:vernondcole at gmail.com] Sent: Wednesday, September 10, 2014 12:52 PM To: Irwin, Edward Cc: python-win32 at python.org Subject: Re: [python-win32] Build 219, adodbapi: no module apibase Dear Edward: I feel your pain. The whole idea of including adodbapi as part of pywin32 was to eliminate having to download and install it as a separate product. Having it broken in this release sadly means a trip back in time to the bad old days. Here are the steps I took to attempt to reproduce your problem: 1) create an new Windaws 8.1 virtual machine on Azure 2) install Python 2.7.8 32 bit from python.org using msi. 3) instal pywin32 v 219 for 32 bit Python 2.7 from http://sourceforge.net/projects/pywin32 4) put a "python" command on the search path using the method of my choice 5) download adodbapi from http://sourceforge.net/projects/adodbapi 6) unzip adodbapi 7) running as an administrator,in the unzipped directory, "python setup.py install" C:\Users\vernon>c:\python27\python.exe Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> import adodbapi >>> adodbapi.version 'adodbapi v2.6.0.6' >>> exit() And that should do it. On Tue, Sep 9, 2014 at 7:11 PM, Irwin, Edward > wrote: Vernon, Any update on a new compiled version of pywin that includes all the adodbapi components? If not, how should I go about making my system work? I want to document the exact steps so our sys admin can replicate on other systems that are running PyWin. So far I have identified that apibase.py and process_connect_string.py are missing. I first tried to run adodbapi-2.6.0.7\setup.py to repair it, but that did not resolve my issues. Next, I manually copied the files to site-packages\adodbapi and everything seemed to work. How should I be patching my site-package of adodbapi? Is there another option? Sys.version '2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]' Thanks Ed _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy.006 at gmail.com Mon Sep 15 17:53:04 2014 From: jeremy.006 at gmail.com (Jeremy Herbert) Date: Mon, 15 Sep 2014 17:53:04 +0200 Subject: [python-win32] Why doesn't dir() list COM object properties, only methods? Message-ID: Hi all, I'm currently struggling a little with pywin32, and to me it seems that the default python dir() behaviour is broken. For the record, I am forcing early-binding. To explain, I think some code would be best: class A(object): def __init__(self): self.member = 1 def hello(self): print "test" tmp = A() dir(tmp) ### The following is printed in iPython: Out[4]: ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'hello', 'member'] Note that both member functions and variables are present. When I run dir() on a COM object instance however, it does not show any of the member properties, just the member functions. So if the A class was instantiated as an COM object, it would only show "hello" as well as the builtins in the printout, and "member" would be missing. Given that I am trying to interact with Autodesk Inventor, and 90% of the functionality of the COM interface is via properties, this is quite frustrating! Is there any way to list all of the properties of a COM object instance? Thanks, Jeremy Herbert From timr at probo.com Mon Sep 15 19:33:18 2014 From: timr at probo.com (Tim Roberts) Date: Mon, 15 Sep 2014 10:33:18 -0700 Subject: [python-win32] Why doesn't dir() list COM object properties, only methods? In-Reply-To: References: Message-ID: <541722DE.4070203@probo.com> Jeremy Herbert wrote: > I'm currently struggling a little with pywin32, and to me it seems > that the default python dir() behaviour is broken. For the record, I > am forcing early-binding. "Broken" is too harsh of a word. What you're seeing here is more or less an impedance mismatch between two very different interfaces. The Python dir() function knows about Python objects living in the Python object space. COM objects live in an entirely different space. Python, being cross-platform, doesn't have any internal knowledge about COM, which is strictly a Windows concept. The win32com code does its best to provide a bridge between those worlds, by providing a simulated Python object that satisfies most of the Python object requirements, but proxies its activities to the COM object it is wrapping. In the case of early binding, the only way win32com can do that is by parsing the TLB to figure out the object layout. If you look at the Python file generated by makepy, do you see the properties there? One interesting side note is that COM doesn't really have the notion of properties, because many languages don't support them. When an object supports a Color property, that's actually implemented by having methods called get_Color and set_Color. You might see if those are in the makepy file. > Note that both member functions and variables are present. When I run > dir() on a COM object instance however, it does not show any of the > member properties, just the member functions. So if the A class was > instantiated as an COM object, it would only show "hello" as well as > the builtins in the printout, and "member" would be missing. You do need to remember that you're not really looking at a COM object instance. You're looking at a win32com proxy that is communicating with the COM object. It's doing the best it can with the information it can extract, but if the TLB doesn't include everything, makepy can't make it up. > Given that I am trying to interact with Autodesk Inventor, and 90% of > the functionality of the COM interface is via properties, this is > quite frustrating! Is there any way to list all of the properties of a > COM object instance? Check the makepy file and see if they are present. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jeremy.006 at gmail.com Mon Sep 15 20:43:52 2014 From: jeremy.006 at gmail.com (Jeremy Herbert) Date: Mon, 15 Sep 2014 20:43:52 +0200 Subject: [python-win32] Why doesn't dir() list COM object properties, only methods? In-Reply-To: <541722DE.4070203@probo.com> References: <541722DE.4070203@probo.com> Message-ID: Hi Tim, Sorry, I did not intend for my message to be interpreted as overly harsh :) Is there any way to introspect the properties of the objects at runtime using python? They are present in the makepy file under _prop_map_get_. Thanks, Jeremy Herbert On Mon, Sep 15, 2014 at 7:33 PM, Tim Roberts wrote: > Jeremy Herbert wrote: >> I'm currently struggling a little with pywin32, and to me it seems >> that the default python dir() behaviour is broken. For the record, I >> am forcing early-binding. > > "Broken" is too harsh of a word. What you're seeing here is more or > less an impedance mismatch between two very different interfaces. > > The Python dir() function knows about Python objects living in the > Python object space. COM objects live in an entirely different space. > Python, being cross-platform, doesn't have any internal knowledge about > COM, which is strictly a Windows concept. > > The win32com code does its best to provide a bridge between those > worlds, by providing a simulated Python object that satisfies most of > the Python object requirements, but proxies its activities to the COM > object it is wrapping. In the case of early binding, the only way > win32com can do that is by parsing the TLB to figure out the object > layout. If you look at the Python file generated by makepy, do you see > the properties there? > > One interesting side note is that COM doesn't really have the notion of > properties, because many languages don't support them. When an object > supports a Color property, that's actually implemented by having methods > called get_Color and set_Color. You might see if those are in the > makepy file. > > >> Note that both member functions and variables are present. When I run >> dir() on a COM object instance however, it does not show any of the >> member properties, just the member functions. So if the A class was >> instantiated as an COM object, it would only show "hello" as well as >> the builtins in the printout, and "member" would be missing. > > You do need to remember that you're not really looking at a COM object > instance. You're looking at a win32com proxy that is communicating with > the COM object. It's doing the best it can with the information it can > extract, but if the TLB doesn't include everything, makepy can't make it up. > > >> Given that I am trying to interact with Autodesk Inventor, and 90% of >> the functionality of the COM interface is via properties, this is >> quite frustrating! Is there any way to list all of the properties of a >> COM object instance? > > Check the makepy file and see if they are present. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 From timr at probo.com Mon Sep 15 21:46:51 2014 From: timr at probo.com (Tim Roberts) Date: Mon, 15 Sep 2014 12:46:51 -0700 Subject: [python-win32] Why doesn't dir() list COM object properties, only methods? In-Reply-To: References: <541722DE.4070203@probo.com> Message-ID: <5417422B.2040100@probo.com> Jeremy Herbert wrote: > Is there any way to introspect the properties of the objects > at runtime using python? They are present in the makepy file under > _prop_map_get_. Well, clearly some combination of _prop_map_get and _prop_map_put will give you this information. If Mark Hammond is listening in, he's the real guru in this area, and may know of a more "blessed" way of getting that info. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nmz787 at gmail.com Tue Sep 16 03:17:34 2014 From: nmz787 at gmail.com (Nathan McCorkle) Date: Mon, 15 Sep 2014 18:17:34 -0700 Subject: [python-win32] How do I change the executable/process name to un-group taskbar icons? Message-ID: I've been writing GUIs with wxPython for a while now, and am trying to figure out now how to get each program not to group into a generic 'pythonw' taskbar icon. I found this API, but it doesn't work on my version of Windows XP: SetCurrentProcessExplicitAppUserModelID Is there some other method to change things? Thanks! -Nathan From wernerfbd at gmx.ch Tue Sep 16 08:18:22 2014 From: wernerfbd at gmx.ch (Werner) Date: Tue, 16 Sep 2014 08:18:22 +0200 Subject: [python-win32] How do I change the executable/process name to un-group taskbar icons? In-Reply-To: References: Message-ID: Hi Nathan, On 9/16/2014 3:17, Nathan McCorkle wrote: > I've been writing GUIs with wxPython for a while now, and am trying to > figure out now how to get each program not to group into a generic > 'pythonw' taskbar icon. > > I found this API, but it doesn't work on my version of Windows XP: > SetCurrentProcessExplicitAppUserModelID > > Is there some other method to change things? Hhm, not sure but I think using wx.App.SetAppName should do that. Werner From nmz787 at gmail.com Tue Sep 16 18:07:35 2014 From: nmz787 at gmail.com (Nathan McCorkle) Date: Tue, 16 Sep 2014 09:07:35 -0700 Subject: [python-win32] How do I change the executable/process name to un-group taskbar icons? In-Reply-To: References: Message-ID: On Mon, Sep 15, 2014 at 11:18 PM, Werner wrote: >> I found this API, but it doesn't work on my version of Windows XP: >> SetCurrentProcessExplicitAppUserModelID >> >> Is there some other method to change things? > > Hhm, not sure but I think using wx.App.SetAppName should do that. Didn't help :( My GUI is still grouped with all the other pythonw processes I've got open. From fzumstein at gmail.com Tue Sep 16 18:11:14 2014 From: fzumstein at gmail.com (Felix Zumstein) Date: Tue, 16 Sep 2014 18:11:14 +0200 Subject: [python-win32] list with datetime objects doesn't format cells in Excel Message-ID: Hi all, The code snipped below always formats cell A1 correctly as Date in Excel. However, the second call (2 datetime objects in a list) only formats the cells as Date on one of my systems, but not on the other one even though they are essentially the same (Win7 64bit, Excel 2010 32 bit, Anaconda Python 2.7 64bit, pywin32 v219). In fact, the third call formats the two cells (A3:B3) correctly on both systems. I've played around with Regional Settings both on Windows and Excel, made sure that the post_install script was run for pywin32 and ran makepy.py to import the Excel Object Model. Does anybody have any idea why the list of datetime objects doesn't get formatted correctly on Excel? from win32com.client import dynamic from datetime import datetime app = dynamic.Dispatch('Excel.Application') app.Visible = True wb = app.Workbooks.Add() wb.Sheets('Sheet1').Range('A1').Value = datetime(2000, 1, 1) # formats Excel cell correctly wb.Sheets('Sheet1').Range('A2:B2').Value = [datetime(2000, 1, 1), datetime(2000, 1, 1)] # doesn't format the cells wb.Sheets('Sheet1').Range('A3:B3').Value = [datetime(2000, 1, 1)] # formats Excel cell correctly thanks, Felix -------------- next part -------------- An HTML attachment was scrubbed... URL: From d_webre at yahoo.com Tue Sep 16 21:13:32 2014 From: d_webre at yahoo.com (DJ Webre) Date: Tue, 16 Sep 2014 12:13:32 -0700 Subject: [python-win32] Interactive Code to Script File Message-ID: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> I am trying to convert a program from interactive to script file. The program consists of the following 2 lines: import webbrowser webbrowser.open_new('http://www.google') When I run it interactively, it works but if I run it as a scrip file, it produces an error unless I import webbrowser interactively. What am I doing wrong? Thanks in advance for any assistance. D. J. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Error.doc Type: application/msword Size: 83456 bytes Desc: not available URL: From bhood2 at comcast.net Wed Sep 17 01:05:11 2014 From: bhood2 at comcast.net (Bob Hood) Date: Tue, 16 Sep 2014 17:05:11 -0600 Subject: [python-win32] Interactive Code to Script File In-Reply-To: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: <5418C227.5020608@comcast.net> Hi, DJ. On 9/16/2014 1:13 PM, DJ Webre wrote: > I am trying to convert a program from interactive to script file. > > The program consists of the following 2 lines: > > import webbrowser > webbrowser.open_new('http://www.google') > > When I run it interactively, it works but if I run it as a scrip file, it > produces an error unless I import webbrowser interactively. > > What am I doing wrong? That code worked perfectly for me in a Python script file when run from the command line (Windows 7 64-bit, Python 2.7.6 64-bit). -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Wed Sep 17 02:13:52 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Wed, 17 Sep 2014 00:13:52 +0000 Subject: [python-win32] Interactive Code to Script File In-Reply-To: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: Dear D.J.: First, let me mention that you violated several of the unwritten rules of asking for help. For example, the code you typed into for email is not the same as the code in the picture you sent as an attachment (using a proprietary format). Code samples should be cut-and-paste, not retyped. The unwritten rules have been summarized at http://www.catb.org/~esr/faqs/smart-questions.html This helps us help you. Now to answer your question: The code you typed in has an incorrect URL, but it reliably opens a browser which informs me of that fact when run as a script from the command line using Python versions from 2.3 to 3.4. The only error in the code pictured in your attachment is the over-specification of the Python version in your #! line. It is correct to specify the version to the second level, like > #!python2.7 > but specifying the third level is an error in the Python Launcher for Windows (which you were not using.) As a practical matter, your code is not at all version sensitive, so you should simply use: > #!/usr/bin/python > After I removed the offending ".8" that version of the program also operated as expected in all versions tested. I tried running it from the pythonwin IDE (as you were doing in the screen capture) and it worked correctly in Python 2.7 and 3.4. This leads me to believe that the problem lies in your specific installation of Python. In what way might your installation be unusual? Might it, perhaps, have been installed without administrative privileges, or for only your user (not all users)? On Tue, Sep 16, 2014 at 7:13 PM, DJ Webre wrote: > I am trying to convert a program from interactive to script file. > > The program consists of the following 2 lines: > > import webbrowser > webbrowser.open_new('http://www.google') > > When I run it interactively, it works but if I run it as a scrip file, it > produces an error unless I import webbrowser interactively. > > What am I doing wrong? > > Thanks in advance for any assistance. > > D. J. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jahagird at usc.edu Wed Sep 17 00:57:48 2014 From: jahagird at usc.edu (Abhay Anant Jahagirdar) Date: Tue, 16 Sep 2014 15:57:48 -0700 Subject: [python-win32] Interactive Code to Script File In-Reply-To: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: Hi, You are doing it right but, for the URL string use " "(double quotes). you should be fine https://docs.python.org/2.0/ref/strings.html import webbrowser webbrowser.open_new("https://www.google.org/") Thanks, Abhay On Tue, Sep 16, 2014 at 12:13 PM, DJ Webre wrote: > I am trying to convert a program from interactive to script file. > > The program consists of the following 2 lines: > > import webbrowser > webbrowser.open_new('http://www.google') > > When I run it interactively, it works but if I run it as a scrip file, it > produces an error unless I import webbrowser interactively. > > What am I doing wrong? > > Thanks in advance for any assistance. > > D. J. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > -- Thank you, Abhay Anant Jahagirdar MS candidate at Dept. of Computer Science University of Southern California Email: jahagird at usc.edu Phone: (323) 578-1548 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.ware+pydev at gmail.com Wed Sep 17 01:37:20 2014 From: zachary.ware+pydev at gmail.com (Zachary Ware) Date: Tue, 16 Sep 2014 18:37:20 -0500 Subject: [python-win32] Interactive Code to Script File In-Reply-To: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: On Tue, Sep 16, 2014 at 2:13 PM, DJ Webre wrote: > I am trying to convert a program from interactive to script file. > > The program consists of the following 2 lines: > > import webbrowser > webbrowser.open_new('http://www.google') > > When I run it interactively, it works but if I run it as a scrip file, it > produces an error unless I import webbrowser interactively. > > What am I doing wrong? > > Thanks in advance for any assistance. Notice the path for webbrowser in the traceback, you have a file named 'webbrowser.py' in the same folder as 'webbrowser00.py', and the 'import webbrowser' line in webrowser00 is importing your own webbrowser module, which doesn't have 'open_new'. You'll need to either rename 'webbroswer.py' to something else or delete it (and make sure to delete 'webbrowser.pyc' either way). By the way, it's usually best to just copy and paste your code and error messages as text in the body of the email rather than attaching an image, and embedding the image in a Word document just makes it harder to see what's going on. Just for future reference :) -- Zach From nmz787 at gmail.com Wed Sep 17 02:48:31 2014 From: nmz787 at gmail.com (Nathan McCorkle) Date: Tue, 16 Sep 2014 17:48:31 -0700 Subject: [python-win32] Interactive Code to Script File In-Reply-To: References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: On Sep 16, 2014 5:27 PM, "Zachary Ware" wrote: > By the way, it's usually best to just copy and paste your code and > error messages as text in the body of the email rather than attaching > an image, and embedding the image in a Word document just makes it > harder to see what's going on. Just for future reference :) Huh, I didn't even see the attachment the first or second time I looked at this email thread. There is also pastebin and similar short-or-long-lived code snippet pasting sites that even sometimes handle syntax highlighting and such. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.ware+pydev at gmail.com Wed Sep 17 06:48:17 2014 From: zachary.ware+pydev at gmail.com (Zachary Ware) Date: Tue, 16 Sep 2014 23:48:17 -0500 Subject: [python-win32] Interactive Code to Script File In-Reply-To: <1410921056.46270.YahooMailNeo@web121802.mail.ne1.yahoo.com> References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> <1410921056.46270.YahooMailNeo@web121802.mail.ne1.yahoo.com> Message-ID: Responding on-list: On Tue, Sep 16, 2014 at 9:30 PM, DJ Webre wrote off-list: > That was it. Thanks all for the assistance. I will also incorporate the > suggestions in future request for help. Thanks again. Glad I could be of help :). Regards, -- Zach From timr at probo.com Wed Sep 17 19:25:00 2014 From: timr at probo.com (Tim Roberts) Date: Wed, 17 Sep 2014 10:25:00 -0700 Subject: [python-win32] Interactive Code to Script File In-Reply-To: References: <1410894812.45562.YahooMailNeo@web121804.mail.ne1.yahoo.com> Message-ID: <5419C3EC.3000607@probo.com> Abhay Anant Jahagirdar wrote: > > You are doing it right but, for the URL string use " "(double quotes). > you should be fine > https://docs.python.org/2.0/ref/strings.html You do understand that there is absolutely no difference between a single-quoted string and a double-quoted string in Python, don't you? (Unlike PHP) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nmz787 at gmail.com Wed Sep 17 19:48:52 2014 From: nmz787 at gmail.com (Nathan McCorkle) Date: Wed, 17 Sep 2014 10:48:52 -0700 Subject: [python-win32] How do I change the executable/process name to un-group taskbar icons? In-Reply-To: References: Message-ID: See here for an update and some code that uses the pywin32 stuff to mess around with TaskManager (I think... I adapted the code from some Visual Basic code I found online): https://groups.google.com/d/msg/wxpython-users/2BXSDFvWdAk/RE32KQPDb8MJ -- -Nathan From iceblink at chello.nl Sun Sep 21 11:26:43 2014 From: iceblink at chello.nl (Patrick Asselman) Date: Sun, 21 Sep 2014 11:26:43 +0200 Subject: [python-win32] pip not working? Message-ID: Can somebody please shed some light on what is going on here? $ pip freeze lxml==3.4.0 $ python3 Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import lxml Traceback (most recent call last): File "", line 1, in ImportError: No module named 'lxml' >>> Also help('modules') doesn't show lxml in the list. This is on OSX 10.9.5 Before this, I install py34-lxml through macports and it said "Installing py34-lxml @3.3.5_0", which made me think it was installing an older version, so I chose to uninstall and use pip instead. Pip completes the installation succesfully, but the module cannot be found by Python. Best regards, Patrick From vernondcole at gmail.com Sun Sep 21 12:31:52 2014 From: vernondcole at gmail.com (Vernon D. Cole) Date: Sun, 21 Sep 2014 10:31:52 +0000 Subject: [python-win32] pip not working? In-Reply-To: References: Message-ID: Patrick: I am very sorry, but you are asking this question on the wrong list. This list is for Python for Windows Extension. You may find more productive answers on a list which specializes in either mac OS, or the lxml package. On Sun, Sep 21, 2014 at 9:26 AM, Patrick Asselman wrote: > Can somebody please shed some light on what is going on here? > > $ pip freeze > lxml==3.4.0 > $ python3 > Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import lxml > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named 'lxml' > >>> > > Also help('modules') doesn't show lxml in the list. > > This is on OSX 10.9.5 > > Before this, I install py34-lxml through macports and it said "Installing > py34-lxml @3.3.5_0", which made me think it was installing an older > version, so I chose to uninstall and use pip instead. Pip completes the > installation succesfully, but the module cannot be found by Python. > > Best regards, > Patrick > > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From blairdhall at gmail.com Fri Sep 26 07:32:16 2014 From: blairdhall at gmail.com (Blair Hall) Date: Fri, 26 Sep 2014 17:32:16 +1200 Subject: [python-win32] py2exe com_server newbie problem Message-ID: I have been working on this all day, with no joy. Some help would be appreciated :-) I have a simple COM server (that I found on the internet): #------------------------------------------------------------------- import pythoncom import sys class HelloWorld: #pythoncom.frozen = 1 if hasattr(sys, 'importers'): _reg_class_spec_ = "__main__.HelloWorld" _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER _reg_clsid_ = '{E3D5F332-F080-47B3-A319-A3A0E287E466}' _reg_desc_ = "Python Test COM Server" _reg_progid_ = "Python.TestServer" _public_methods_ = ['Hello'] _public_attrs_ = ['softspace', 'noCalls'] _readonly_attrs_ = ['noCalls'] def __init__(self): self.softspace = 1 self.noCalls = 0 def Hello(self, who): self.noCalls = self.noCalls + 1 # insert "softspace" number of spaces print "Hello" + " " * self.softspace + str(who) return "Hello" + " " * self.softspace + str(who) if __name__=='__main__': import sys if hasattr(sys, 'importers'): # running as packed executable. if '--register' in sys.argv[1:] or '--unregister' in sys.argv[1:]: # --register and --unregister work as usual import win32com.server.register win32com.server.register.UseCommandLine(HelloWorld) else: # start the server. from win32com.server import localserver localserver.main() else: import win32com.server.register win32com.server.register.UseCommandLine(HelloWorld) #------------------------------------------------------------------- This works just fine as a python module. I can run it, register the COM server and use the Hello method in VBA code inside Excel. However, I would like to make a DLL, register it, and be able to have the same access to the COM server. I have not been able to do that so far. I have the following simple setup.py module #------------------------------------------------------------------------ from distutils.core import setup import py2exe setup(com_server = ["test"]) #------------------------------------------------------------------------ Using this with py2exe generates both test.dll and test.exe. I can call test.exe with '--register' on the command line and the COM server is registered. However, when I use regsvr32 to register test.dll, the COM server does not work with Excel. (although regsvr32 says that the DLL has been successfully registered). What am I missing? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cpede at outlook.dk Sun Sep 28 00:36:32 2014 From: cpede at outlook.dk (cpede) Date: Sat, 27 Sep 2014 22:36:32 +0000 (UTC) Subject: [python-win32] Calling COM Interface from Python Script Message-ID: I'm trying to call a COM Interface using Python Script. I got the installation of Python from ActivePython, and I'm trying to script parts of my code using the Script Engine. This normally works with VBScript and JScript, but now I want to extend this with PythonScript. The Script Engine is called through a COM interface that I have defined. It seems that most things works, but when I call a method with both a Set and Get defined, Python fails to locate the correct version of the method. In my ODL file I have defined a method called Property, which has a propget and propput flag, with the same name and id, like this: [propget,id(100)] HRESULT Property([in]BSTR* name,[out,retval]VARIANT* val); [propput,id(100)] HRESULT Property([in]BSTR* name,[in]VARIANT val); When called from JScript I can do like this: Session.Property("Test",2); In the Scripting Engine "oledisp1.cpp" in COleDispatchImpl::Invoke line 1309, this call is interpret as a DISPATCH_METHOD method, and then corrected to DISPATCH_PROPERTYPUTREF, based on a test on the arguments in this part of the code: // treat member calls on properties just like property get/set if ((wFlags == DISPATCH_METHOD) && ((pEntry->pfn == NULL && pEntry->pfnSet == NULL) || (pEntry->pfn == NULL && pEntry->pfnSet != NULL) || (pEntry->pfn != NULL && pEntry->pfnSet != NULL))) { // the entry describes a property but a method call is being // attempted -- change it to a property get/set based on the // number of parameters being passed. wFlags &= ~DISPATCH_METHOD; UINT nExpectedArgs = pEntry->lpszParams != NULL ? (UINT)lstrlenA(pEntry->lpszParams) : 0; if (pDispParams->cArgs <= nExpectedArgs) { // no extra param -- so treat as property get wFlags |= DISPATCH_PROPERTYGET; } else { // extra params -- treat as property set wFlags |= DISPATCH_PROPERTYPUTREF; pDispParams->cNamedArgs = 1; } } When the same method is called from Python, the COleDispatchImpl::Invoke is initially called with the flag DISPATCH_PROPERTYGET. This is of cause wrong, since the call must be interpret as a DISPATCH_PROPERTYPUTREF, then the method call fails with wrong number of arguments. Why are Python Script misinterpreting this method call? Is Python Script not able to handle propget and propput methods as defined in the OLD file? Can I in the call to the method in Python Script somehow tell that it is the propput version of the method I want to call? Update 1 The above code calls the following macro: DISP_PROPERTY_PARAM_ID(CMyScriptingObject,"Property",100,GetProperty,SetProp erty,VT_VARIANT,VTS_BSTR) Here a Set and a Get (in this case SetProperty and GetProperty) methods are created. I now found out, that if I implicitly calls the SetProperty method, it works: Session.SetProperty("Test",2) Intuitively I would then expect that GetProperty would work like this: myProp = Session.GetProperty("Test") However this calls fails with the following error: [13:32:49] Python Test [13:32:52] Scripting Python ActiveX Scripting Engine Error: Traceback (most recent call last): File "