From stef.mientki at gmail.com Sun Nov 1 16:25:21 2009 From: stef.mientki at gmail.com (Stef Mientki) Date: Sun, 01 Nov 2009 16:25:21 +0100 Subject: [python-win32] Doesn't windows trust Python ? (20 seconds delay running a process from Python) Message-ID: <4AEDA861.4000004@gmail.com> hello, I've an AutoIt program that set some switches in the LAN settings. When I launch the AutoIt executable, the settings are changed immediately. When I launch the AutoIt executable from python (which is the intention), it hangs for about 20 seconds, before any action appears n the screen. Analyzing the script, shows that it hangs on the next 2 lines: Run ( "control.exe ncpa.cpl" ) WinWait( "Network Connections") Transfering the Run command to Python, it hangs on the next subprocess call subprocess.call ( [ r"control.exe", "ncpa.cpl" ]) Does anyone have a clue, why starting a process takes 20 seconds longer when ran from Python ? And even more important, is there a work around ? thanks, Stef Mientki From highcar at gmail.com Mon Nov 2 04:07:10 2009 From: highcar at gmail.com (Paul) Date: Mon, 02 Nov 2009 10:07:10 +0700 Subject: [python-win32] is it possible to disable image to load for webbrowser's page open fastly Message-ID: <4AEE4CDE.1090905@gmail.com> Hi, im using win32com 's webbrowser module. i have some question about it.. is it possible to disable image loading to speed up webpage load? any help ,much appreciate thanks in advance From cournape at gmail.com Mon Nov 2 08:34:57 2009 From: cournape at gmail.com (David Cournapeau) Date: Mon, 2 Nov 2009 16:34:57 +0900 Subject: [python-win32] Interest for patch enabling building egg ? Message-ID: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> Hi, I need to be able to build a pywin32 egg on both windows 32 and 64. I was wondering if there was any interest into integrating patches in that direction ? The way I did was similar to what we do in numpy, that is setup.py is still using distutils by default, but if you call setupegg.py, you get the setuptools feature set. The changes to pywin32 sources are minimal (< 20 lines), and none of the changes should affect current users. cheers, David From skippy.hammond at gmail.com Mon Nov 2 11:38:42 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 02 Nov 2009 21:38:42 +1100 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> Message-ID: <4AEEB6B2.50508@gmail.com> On 2/11/2009 6:34 PM, David Cournapeau wrote: > Hi, > > I need to be able to build a pywin32 egg on both windows 32 and 64. I > was wondering if there was any interest into integrating patches in > that direction ? > > The way I did was similar to what we do in numpy, that is setup.py is > still using distutils by default, but if you call setupegg.py, you get > the setuptools feature set. The changes to pywin32 sources are minimal > (< 20 lines), and none of the changes should affect current users. Yes please! Mark From aahz at pythoncraft.com Tue Nov 3 00:44:52 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 2 Nov 2009 15:44:52 -0800 Subject: [python-win32] win32 errata: AddSourceToRegistry Message-ID: <20091102234452.GA14899@panix.com> The signature for win32evtlogutil.AddSourceToRegistry() on page 359 of win32 has "EventLogType", which should be "eventLogType". Do I win anything? ;-) -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers] "Fancy tail fins on a brand new '59 Cadillac didn't mean throwing out a whole generation of mechanics who started with model As." --Andrew Dalke From r.brown.bayliss at gmail.com Tue Nov 3 08:24:06 2009 From: r.brown.bayliss at gmail.com (Rob Brown-Bayliss) Date: Tue, 3 Nov 2009 20:24:06 +1300 Subject: [python-win32] multiprocessing pickle problem in win32 Message-ID: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> Hi I was playing with multiple mysql connection in separate processes with the multiprocessing module. When I run the following code in linux all goes well. But when I try in win32 I get a pickle error saying it cant pickle None Type when I start the process. Python 2.6 on both platforms. Thanks in advance. from __future__ import print_function import sys import os import platform import MySQLdb import multiprocessing import time import cPickle as Pickle VERBOSE = False class SQL_Query(object): def __init__(self, SQL, callback): self.SQL = SQL self.callback = callback class Connection(multiprocessing.Process): def __init__(self,in_queue, out_queue): multiprocessing.Process.__init__(self) self.in_queue = in_queue self.out_queue = out_queue self.counter = 10 #int(self.conf["db_num_queries"]) # Number of queries to handle before closing down. self.all_ok = True self.con = self.get_connection() def escape(self, string): return MySQLdb.escape(string) def execute(self, sql): "Return results of sql from database, sql must be valid SQL as no checking is done." if VERBOSE: print (sql) res = True last_id = 0 self.counter -= 1 if self.con: try: cur = self.con.cursor() cur.execute("START TRANSACTION") cur.execute(sql) res = cur.fetchall() self.con.commit() last_id = cur.execute("SELECT LAST_INSERT_ID()") cur.close() except Exception as e : res = False # For tracking insert failure etc... self.all_ok = False self.con.rollback() self.out_queue.put((res, last_id)) else: util.error_ui(message = "A Connection has not been established with the database.") def get_connection(self): self.con = "" hst = "127.0.0.1" usr = "usr" pwd = "pass" database = "db" try: self.con = MySQLdb.connect(host=hst, user=usr, passwd=pwd, db=database) except Exception as e: pass return self.con def run(self): proc_name = self.name while self.counter > 0: next_sql = self.in_queue.get() print(self, self.counter, next_sql.SQL) if next_sql is None: # Stop Process return result = self.execute(next_sql.SQL) self.out_queue.put(result) self.close_down() self.out_queue.put(("RESTART", self.name)) return # # clean up # def close_down(self, arg1 = None): if self.con: self.con.close() if __name__ == "__main__": in_queue = multiprocessing.Queue() out_queue = multiprocessing.Queue() pool = [] pool.append(Connection(in_queue, out_queue)) pool.append(Connection(in_queue, out_queue)) pool.append(Connection(in_queue, out_queue)) print(pool) for c in pool: c.start() for i in range(100): print(i) s = SQL_Query("SELECT * FROM customer ", "-") #time.sleep(0.015) in_queue.put(s) while True: o = out_queue.get() if o: if o[0]=="RESTART": print(o) print(pool) for c in pool: if c.name == o[1]: print(c) c.join() c.terminate() pool.remove(c) nc = Connection(in_queue, out_queue) nc.start() pool.append(nc) -- -- Rob From read.beyond.data at gmx.net Tue Nov 3 11:03:01 2009 From: read.beyond.data at gmx.net (Celvin) Date: Tue, 3 Nov 2009 11:03:01 +0100 Subject: [python-win32] win32com: Connecting event class after object creation Message-ID: <3610723310.20091103110301@gmx.net> Hi, I'm currently using win32com to access COM objects created via .NET's COM interop, which is working surprisingly well. Currently, I stumpled upon a minor problem, though: I would like to connect a class implementing several event handlers to an COM object returned by a method call of another COM object. What I'm doing is basically this: class event_class: def event_handler1(self): pass class another_event_class: def foobar(self): pass obj = win32com.client.DispatchWithEvents("{...}", event_class) new_obj = obj.CreateObject() # here i would like another_event_class to handle events of new_obj Do I have to use new_obj._oleobj_'s QueryInterface to obtain an interface pointer to IID_IConnectionPointContainer and attach the event handler myself, or is there any other, more comfortable way using win32com? Any pointers are appreciated, Celvin From cournape at gmail.com Tue Nov 3 14:56:34 2009 From: cournape at gmail.com (David Cournapeau) Date: Tue, 3 Nov 2009 22:56:34 +0900 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <4AEEB6B2.50508@gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> Message-ID: <5b8d13220911030556n6d29538cs8e9f96fac1db8f7d@mail.gmail.com> Hi Mark, On Mon, Nov 2, 2009 at 7:38 PM, Mark Hammond wrote: >> The way I did was similar to what we do in numpy, that is setup.py is >> still using distutils by default, but if you call setupegg.py, you get >> the setuptools feature set. The changes to pywin32 sources are minimal >> (< ?20 lines), and none of the changes should affect current users. I attached the patch to this email. The only test I have done is that python setupegg.py and setup.py install generate the same tree (and that the produced egg is working). I am not very familiar with pywin32, so if there is a formal test suite to run, let me know, cheers, David -------------- next part -------------- A non-text attachment was scrubbed... Name: eggify.patch Type: application/octet-stream Size: 3263 bytes Desc: not available URL: From cournape at gmail.com Tue Nov 3 15:15:45 2009 From: cournape at gmail.com (David Cournapeau) Date: Tue, 3 Nov 2009 23:15:45 +0900 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <4AEEB6B2.50508@gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> Message-ID: <5b8d13220911030615g64ce9ce2r8a672615f148991e@mail.gmail.com> (sorry for having forgotten to CC the list the first time) > On 2/11/2009 6:34 PM, David Cournapeau wrote: >> The way I did was similar to what we do in numpy, that is setup.py is >> still using distutils by default, but if you call setupegg.py, you get >> the setuptools feature set. The changes to pywin32 sources are minimal >> (< ?20 lines), and none of the changes should affect current users. I attached the patch to this email. The only test I have done is that python setupegg.py and setup.py install generate the same tree (and that the produced egg is working). I am not very familiar with pywin32, so if there is a formal test suite to run, let me know, cheers, David -------------- next part -------------- A non-text attachment was scrubbed... Name: eggify.patch Type: application/octet-stream Size: 3263 bytes Desc: not available URL: From p.f.moore at gmail.com Tue Nov 3 16:10:55 2009 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 3 Nov 2009 15:10:55 +0000 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <5b8d13220911030556n6d29538cs8e9f96fac1db8f7d@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030556n6d29538cs8e9f96fac1db8f7d@mail.gmail.com> Message-ID: <79990c6b0911030710g7c87598dyedab02a6554157c6@mail.gmail.com> 2009/11/3 David Cournapeau : > The only test I have done is that python setupegg.py and setup.py > install generate the same tree (and that the produced egg is working). > I am not very familiar with pywin32, so if there is a formal test > suite to run, let me know, I guess this doesn't run the postinstall script that the bdist_wininst installer runs, so that the COM components won't get registered? Does that matter for people wanting to use the egg format? Paul. From aahz at pythoncraft.com Tue Nov 3 17:34:56 2009 From: aahz at pythoncraft.com (Aahz) Date: Tue, 3 Nov 2009 08:34:56 -0800 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> Message-ID: <20091103163456.GA1490@panix.com> On Tue, Nov 03, 2009, Rob Brown-Bayliss wrote: > > When I run the following code in linux all goes well. But when I try > in win32 I get a pickle error saying it cant pickle None Type when I > start the process. You need to provide a full traceback. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers] "Fancy tail fins on a brand new '59 Cadillac didn't mean throwing out a whole generation of mechanics who started with model As." --Andrew Dalke From r.brown.bayliss at gmail.com Tue Nov 3 19:13:06 2009 From: r.brown.bayliss at gmail.com (Rob Brown-Bayliss) Date: Wed, 4 Nov 2009 07:13:06 +1300 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <20091103163456.GA1490@panix.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> Message-ID: <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> On Wed, Nov 4, 2009 at 5:34 AM, Aahz wrote: > On Tue, Nov 03, 2009, Rob Brown-Bayliss wrote: >> >> When I run the following code in linux all goes well. ?But when I try >> in win32 I get a pickle error saying it cant pickle None Type when I >> start the process. > > You need to provide a full traceback. Here it is. >>> C:\Python26\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet [, , ] Traceback (most recent call last): File "C:\Python26\Lib\SITE-P~1\PYTHON~1\pywin\framework\scriptutils.py", line 312, in RunScript exec codeObject in __main__.__dict__ File "C:\Quanto2\database_multi.py", line 120, in c.start() File "C:\Python26\lib\multiprocessing\process.py", line 104, in start self._popen = Popen(self) File "C:\Python26\lib\multiprocessing\forking.py", line 239, in __init__ dump(process_obj, to_child, HIGHEST_PROTOCOL) File "C:\Python26\lib\multiprocessing\forking.py", line 162, in dump ForkingPickler(file, protocol).dump(obj) File "C:\Python26\lib\pickle.py", line 224, in dump self.save(obj) File "C:\Python26\lib\pickle.py", line 331, in save self.save_reduce(obj=obj, *rv) File "C:\Python26\lib\pickle.py", line 419, in save_reduce save(state) File "C:\Python26\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python26\lib\pickle.py", line 649, in save_dict self._batch_setitems(obj.iteritems()) File "C:\Python26\lib\pickle.py", line 681, in _batch_setitems save(v) File "C:\Python26\lib\pickle.py", line 331, in save self.save_reduce(obj=obj, *rv) File "C:\Python26\lib\pickle.py", line 419, in save_reduce save(state) File "C:\Python26\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python26\lib\pickle.py", line 649, in save_dict self._batch_setitems(obj.iteritems()) File "C:\Python26\lib\pickle.py", line 681, in _batch_setitems save(v) File "C:\Python26\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python26\lib\pickle.py", line 649, in save_dict self._batch_setitems(obj.iteritems()) File "C:\Python26\lib\pickle.py", line 680, in _batch_setitems save(k) File "C:\Python26\lib\pickle.py", line 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python26\lib\pickle.py", line 748, in save_global (obj, module, name)) PicklingError: Can't pickle : it's not found as __builtin__.NoneType -- Rob From mhammond at skippinet.com.au Tue Nov 3 22:34:04 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 04 Nov 2009 08:34:04 +1100 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <79990c6b0911030710g7c87598dyedab02a6554157c6@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030556n6d29538cs8e9f96fac1db8f7d@mail.gmail.com> <79990c6b0911030710g7c87598dyedab02a6554157c6@mail.gmail.com> Message-ID: <4AF0A1CC.60501@skippinet.com.au> On 4/11/2009 2:10 AM, Paul Moore wrote: > 2009/11/3 David Cournapeau: >> The only test I have done is that python setupegg.py and setup.py >> install generate the same tree (and that the produced egg is working). >> I am not very familiar with pywin32, so if there is a formal test >> suite to run, let me know, > > I guess this doesn't run the postinstall script that the bdist_wininst > installer runs, so that the COM components won't get registered? Does > that matter for people wanting to use the egg format? There was actually an old setuptools bug which I was hoping would be fixed and the reason I hadn't put any effort into an egg myself. Without this post-install script many things will not work as that script is what copies the pywin32 DLLs to the correct place. Cheers, Mark From cournape at gmail.com Wed Nov 4 01:16:12 2009 From: cournape at gmail.com (David Cournapeau) Date: Wed, 4 Nov 2009 09:16:12 +0900 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <79990c6b0911030710g7c87598dyedab02a6554157c6@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030556n6d29538cs8e9f96fac1db8f7d@mail.gmail.com> <79990c6b0911030710g7c87598dyedab02a6554157c6@mail.gmail.com> Message-ID: <5b8d13220911031616k4d9af97bhae9fa3be0ae55339@mail.gmail.com> On Wed, Nov 4, 2009 at 12:10 AM, Paul Moore wrote: > 2009/11/3 David Cournapeau : >> The only test I have done is that python setupegg.py and setup.py >> install generate the same tree (and that the produced egg is working). >> I am not very familiar with pywin32, so if there is a formal test >> suite to run, let me know, > > I guess this doesn't run the postinstall script that the bdist_wininst > installer runs, so that the COM components won't get registered? Not if you use the egg "normally", but I don't think there is any solution to that. > Does > that matter for people wanting to use the egg format? The reason I build an egg is to use it with enstaller, which installs from eggs but support post install scripts, so that's not an issue for me. David From lersam at gmail.com Tue Nov 3 07:41:16 2009 From: lersam at gmail.com (Samuel Lerner) Date: Tue, 3 Nov 2009 08:41:16 +0200 Subject: [python-win32] ISAPI filter Message-ID: <5fa0ad970911022241v1fa70783medd4adfebe2a2900@mail.gmail.com> Hi Question I have isapi filter and I want to added to W3SVC, can you send me same example for this Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Wed Nov 4 11:00:24 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 04 Nov 2009 21:00:24 +1100 Subject: [python-win32] win32com: Connecting event class after object creation In-Reply-To: <3610723310.20091103110301@gmx.net> References: <3610723310.20091103110301@gmx.net> Message-ID: <4AF150B8.3070307@gmail.com> On 3/11/2009 9:03 PM, Celvin wrote: > > Hi, > > I'm currently using win32com to access COM objects created via .NET's > COM interop, which is working surprisingly well. > > Currently, I stumpled upon a minor problem, though: I would like to > connect a class implementing several event handlers to an COM object > returned by a method call of another COM object. > > What I'm doing is basically this: > > class event_class: > def event_handler1(self): > pass > > class another_event_class: > def foobar(self): > pass > > obj = win32com.client.DispatchWithEvents("{...}", event_class) > new_obj = obj.CreateObject() > # here i would like another_event_class to handle events of new_obj > > Do I have to use new_obj._oleobj_'s QueryInterface to obtain an > interface pointer to IID_IConnectionPointContainer and attach the > event handler myself, or is there any other, more comfortable way > using win32com? If you are lucky, you can pass the new object (instead of a string) to DispatchWithEvents... (If you are unlucky, let me know and I'll do what I can to make you lucky :) Cheers, Mark From skippy.hammond at gmail.com Wed Nov 4 11:02:54 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 04 Nov 2009 21:02:54 +1100 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> Message-ID: <4AF1514E.4000203@gmail.com> On 4/11/2009 5:13 AM, Rob Brown-Bayliss wrote: > On Wed, Nov 4, 2009 at 5:34 AM, Aahz wrote: >> On Tue, Nov 03, 2009, Rob Brown-Bayliss wrote: >>> >>> When I run the following code in linux all goes well. But when I try >>> in win32 I get a pickle error saying it cant pickle None Type when I >>> start the process. >> >> You need to provide a full traceback. > > Here it is. > >>>> C:\Python26\lib\site-packages\MySQLdb\__init__.py:34: DeprecationWarning: the sets module is deprecated > from sets import ImmutableSet > [, initial)>,] > Traceback (most recent call last): > File "C:\Python26\Lib\SITE-P~1\PYTHON~1\pywin\framework\scriptutils.py", > line 312, in RunScript I'd try running it from python.exe to see if it is something funky about the pythonwin execution environment... Cheers, Mark From skippy.hammond at gmail.com Wed Nov 4 11:05:58 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 04 Nov 2009 21:05:58 +1100 Subject: [python-win32] ISAPI filter In-Reply-To: <5fa0ad970911022241v1fa70783medd4adfebe2a2900@mail.gmail.com> References: <5fa0ad970911022241v1fa70783medd4adfebe2a2900@mail.gmail.com> Message-ID: <4AF15206.6070007@gmail.com> On 3/11/2009 5:41 PM, Samuel Lerner wrote: > Hi > > Question > > I have isapi filter and I want to added to W3SVC, can you send me same > example for this I'm afraid I don't understand the question - have you found the samples in the isapi\samples directory? Also, please see the isapi_wsgi-dev at googlegroups.com google group and related project - it allows you to use a WSGI model under ISAPI (using the pywin32 isapi package), which makes sense for a lot of reasons... Cheers, Mark From vernondcole at gmail.com Wed Nov 4 16:38:48 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Wed, 4 Nov 2009 08:38:48 -0700 Subject: [python-win32] Fwd: win32 errata: AddSourceToRegistry In-Reply-To: References: <20091102234452.GA14899@panix.com> Message-ID: Aahz: Thank you. The correction has been made in the source for the second edition. (Now I need to finish writing the *proposal* for the second edition so we can see if O'Reilly will print one.) -- Vernon Cole On Mon, Nov 2, 2009 at 4:44 PM, Aahz wrote: > The signature for win32evtlogutil.AddSourceToRegistry() on page 359 of > win32 has "EventLogType", which should be "eventLogType". > > Do I win anything? ;-) > -- > Aahz (aahz at pythoncraft.com) <*> > http://www.pythoncraft.com/ > > [on old computer technologies and programmers] "Fancy tail fins on a > brand new '59 Cadillac didn't mean throwing out a whole generation of > mechanics who started with model As." --Andrew Dalke > _______________________________________________ > 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 r.brown.bayliss at gmail.com Wed Nov 4 18:57:54 2009 From: r.brown.bayliss at gmail.com (Rob Brown-Bayliss) Date: Thu, 5 Nov 2009 06:57:54 +1300 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <4AF1514E.4000203@gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> <4AF1514E.4000203@gmail.com> Message-ID: <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> On Wed, Nov 4, 2009 at 11:02 PM, Mark Hammond wrote: > > I'd try running it from python.exe to see if it is something funky about the > pythonwin execution environment... > Same result, cant pickle NoneType when I call start() on the process object, exact same code works with out error on linux so I have to assume it's either a problem with multiprocessing on win32 or the win32 machine is not set up properly, I am using active python on the win32 box. -- -- Rob From skippy.hammond at gmail.com Wed Nov 4 23:32:37 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 05 Nov 2009 09:32:37 +1100 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> <4AF1514E.4000203@gmail.com> <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> Message-ID: <4AF20105.50606@gmail.com> On 5/11/2009 4:57 AM, Rob Brown-Bayliss wrote: > On Wed, Nov 4, 2009 at 11:02 PM, Mark Hammond wrote: > >> >> I'd try running it from python.exe to see if it is something funky about the >> pythonwin execution environment... >> > > Same result, cant pickle NoneType when I call start() on the process > object, exact same code works with out error on linux so I have to > assume it's either a problem with multiprocessing on win32 or the > win32 machine is not set up properly, I am using active python on the > win32 box. In that case you probably need to reduce your sample to the smallest possible code which demonstrates the problem. (At face value, it almost looks like you have 2 discrete interpreters in the same process, so have 2 different 'None' objects, but that should be very difficult to make happen...) Cheers, Mark From r.brown.bayliss at gmail.com Thu Nov 5 00:31:48 2009 From: r.brown.bayliss at gmail.com (Rob Brown-Bayliss) Date: Thu, 5 Nov 2009 12:31:48 +1300 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <4AF20105.50606@gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> <4AF1514E.4000203@gmail.com> <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> <4AF20105.50606@gmail.com> Message-ID: <485dbcb40911041531s598b1fcbo78ea2fd89ce3e33b@mail.gmail.com> On Thu, Nov 5, 2009 at 11:32 AM, Mark Hammond wrote: > On 5/11/2009 4:57 AM, Rob Brown-Bayliss wrote: > In that case you probably need to reduce your sample to the smallest > possible code which demonstrates the problem. > > (At face value, it almost looks like you have 2 discrete interpreters in the > same process, so have 2 different 'None' objects, but that should be very > difficult to make happen...) > Hi Again, This would be about as simple as it can get. Processes that do nothing, but the same error. Does multiprocessing library work in windows? Has any one an example? Thanks from __future__ import print_function import MySQLdb import multiprocessing class Connection(multiprocessing.Process): def __init__(self): multiprocessing.Process.__init__(self) def run(self): print(self) return if __name__ == "__main__": pool = [] pool.append(Connection()) pool.append(Connection()) pool.append(Connection()) print(pool) for c in pool: c.start() -- -- Rob From chef at ghum.de Thu Nov 5 09:31:14 2009 From: chef at ghum.de (Massa, Harald Armin) Date: Thu, 5 Nov 2009 09:31:14 +0100 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <485dbcb40911041531s598b1fcbo78ea2fd89ce3e33b@mail.gmail.com> References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> <4AF1514E.4000203@gmail.com> <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> <4AF20105.50606@gmail.com> <485dbcb40911041531s598b1fcbo78ea2fd89ce3e33b@mail.gmail.com> Message-ID: Rob, > from __future__ import print_function > import MySQLdb > import multiprocessing please try it again without importing MySQLdb. My rough guess from using pickle, databases and connections: there is something within MySQLdb that will not pickle. multiprocessing works partially on windows. especially "pickling a socket" is not supported; you have to scale back to pyprocessing (hosted on berlios, converted to multiprocessing for 2.6 and backported) the c-library to "pickle a socket" was not realised in multiprocessing, bug is reported. Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - %s is too gigantic of an industry to bend to the whims of reality From StormDragoness at stormweyr.dk Thu Nov 5 10:35:20 2009 From: StormDragoness at stormweyr.dk (Stormy) Date: Thu, 05 Nov 2009 09:35:20 +0000 Subject: [python-win32] Extending Vista/Windows7 with Python Message-ID: <4AF29C58.30805@stormweyr.dk> Hello. I am trying to implement IPropertyStore in a python component, and run into a few problems. HRESULT GetValue( REFPROPERTYKEY /key/, PROPVARIANT */pv/ ); The GetValue method passes a pointer in the form of an integer to python instead of a key. And secondly the return value never makes it back to windows either. I am wondering what I have to do to make this work properly, which changes to make and where. Excerpt from my component being called by windows: """ __init__ Initialize GetValue: , 134344568 __del__ """ IPropertyStore: http://msdn.microsoft.com/en-us/library/bb761474(VS.85).aspx ============================================================= A little history. I decided to expand my knowledge of python and windows programming alike by starting to construct a shell plugin for explorer on a Windows Vista 64 system. After a while however I found that parts of pywin32 are not very accomodating for this task. The first problem I ran into was that code did not get called at all with a 64 bit explorer, so I built pywin32 from source to try and debug this. Turns out that a vital part was missing from pywin32, the make_method for 64 bit systems in univgw.cpp to be exact. After a short while of trying other things I returned to this and compiled the mockup function only to have the compiler complain about the function definition, va_start and so on, after adding the elipsis to the function arguments the mockup compiled, I proceeded to read back the bytes from the compiled function, and construct a 64 bit version of the make_method. It may well need checking, but it does seem to work, as windows calls my code, and no noticable errors occur. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: univgw.cpp.patch URL: From jnoto at springfield-sec.portsmouth.sch.uk Thu Nov 5 10:42:15 2009 From: jnoto at springfield-sec.portsmouth.sch.uk (Jose Noto) Date: Thu, 05 Nov 2009 09:42:15 +0000 Subject: [python-win32] Get DN of Computer (OU Located) Message-ID: <4AF29DF7.70006@springfield-sec.portsmouth.sch.uk> Good morning, I'm trying to create a script where I need to know in witch OU / DN the computer is located from just knowing its hostname and I can not figure it out or find anything about it on the net. Does anyone know how to do it? On VBScript would be something like this: Set objSysInfo = CreateObject("ADSystemInfo") strComputer = objSysInfo.ComputerName However, I do not find anything similar to it to use with python. Many thanks, Jose -- D I S C L A I M E R This email and any files transmitted with it are confidential and intended solely for the individual to whom they are addressed. Any views or opinions presented are those of the author and do not necessarily represent those of Springfield School unless stated otherwise. If you have received this e-mail in error please delete the e-mail and contact Springfield School, Central Road, Drayton, PO6 1QY Tel:023 92379119 The information contained in this e-mail may be subject to public disclosure under the Freedom of Information Act 2000. Unless the Information is legally exempt from disclosure, the confidentiality of this e-mail and your reply cannot be guaranteed. From mail at timgolden.me.uk Thu Nov 5 13:20:26 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 05 Nov 2009 12:20:26 +0000 Subject: [python-win32] Get DN of Computer (OU Located) In-Reply-To: <4AF29DF7.70006@springfield-sec.portsmouth.sch.uk> References: <4AF29DF7.70006@springfield-sec.portsmouth.sch.uk> Message-ID: <4AF2C30A.5030008@timgolden.me.uk> Jose Noto wrote: > Good morning, > > I'm trying to create a script where I need to know in witch OU / DN the > computer is located from just knowing its hostname and I can not figure > it out or find anything about it on the net. Does anyone know how to do it? > > On VBScript would be something like this: > > Set objSysInfo = CreateObject("ADSystemInfo") > strComputer = objSysInfo.ComputerName Translating literally: import win32com.client sys_info = win32com.client.Dispatch ("ADSystemInfo") computer = sys_info.ComputerName print computer TJG From r.brown.bayliss at gmail.com Thu Nov 5 17:41:55 2009 From: r.brown.bayliss at gmail.com (Rob Brown-Bayliss) Date: Fri, 6 Nov 2009 05:41:55 +1300 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: References: <485dbcb40911022324t37d87097vafedab541db63943@mail.gmail.com> <20091103163456.GA1490@panix.com> <485dbcb40911031013h7382cbeek4cd68677fbd48585@mail.gmail.com> <4AF1514E.4000203@gmail.com> <485dbcb40911040957j45402eeend8a82ceb5a419ea@mail.gmail.com> <4AF20105.50606@gmail.com> <485dbcb40911041531s598b1fcbo78ea2fd89ce3e33b@mail.gmail.com> Message-ID: <485dbcb40911050841n71168a1hb43172ad5ca7778a@mail.gmail.com> On Thu, Nov 5, 2009 at 9:31 PM, Massa, Harald Armin wrote: > Rob, > >> from __future__ import print_function >> import MySQLdb >> import multiprocessing > > please try it again without importing MySQLdb. Thanks. -- -- Rob From timr at probo.com Thu Nov 5 20:06:03 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 05 Nov 2009 11:06:03 -0800 Subject: [python-win32] Extending Vista/Windows7 with Python In-Reply-To: <4AF29C58.30805@stormweyr.dk> References: <4AF29C58.30805@stormweyr.dk> Message-ID: <4AF3221B.4010307@probo.com> Stormy wrote: > > I am trying to implement IPropertyStore in a python component, and run > into a few problems. > > HRESULT GetValue( > REFPROPERTYKEY /key/, > PROPVARIANT */pv/ > ); > The GetValue method passes a pointer in the form of an integer to > python instead of a key. Correct. REFPROPERTYKEY is a pointer to the key. You will probably have to use something like ctypes to dereference the pointer and fetch the actual key. > And secondly the return value never makes it back to windows either. What are you actually returning? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From zakir-durumeric at uiowa.edu Thu Nov 5 16:04:27 2009 From: zakir-durumeric at uiowa.edu (Durumeric, Zakir B) Date: Thu, 5 Nov 2009 09:04:27 -0600 Subject: [python-win32] Setting NTFS Permissions on Tree Message-ID: <3BCDDFB9-5479-4D64-8D20-1D89F31DACD3@uiowa.edu> Hi, I'm trying to set permissions on an NTFS tree. Specifically I'm trying to add a propagable ACE to the DACL on a top-level directory and hoping for it to recursively propagate to children who do not have inherited permissions blocked. I'm currently tying to do this by calling SetNamedSecurityInfo. However, it appears that the ACE is only added to the top-level directory. I'm passing both children_containers_inherit children_noncontainers_inherit to AddAccessAllowedAceEx and when I look at the ACE on the top-level directory it shows as being applied to directory and all children... it's just that none of the permissions actually appear to be propagated to the children in the directory tree. MSDN specifies that SetNamedSecurityInfo does propagate to children. However, I'm under the impression that this propagation isn't truly complete until you somehow manually force the children nodes to recalculate their DACLs and notice the new ACE that applies to them. Is this correct and if so what is the correct way of forcing the children nodes to re-calculate via win32security? I also noticed that in aclapi.h there is a function called TreeResetNamedSecurityInfo (2003+) that appears to do what I'm looking for instead of SetNamedSecurityInfo, however it's not included in win32security. If it's not possible to manually to manually force the recalculation in SetNamedSecurityInfo, is the next best bet to try to manually call out to TreeResetNamedSecurityInfo or are there any other suggestions? I would appreciate any light someone could spread on this issue -- I'm to the point of banging my head against the wall. Thank you Zakir Durumeric -------------- next part -------------- An HTML attachment was scrubbed... URL: From read.beyond.data at gmx.net Fri Nov 6 01:09:29 2009 From: read.beyond.data at gmx.net (Celvin) Date: Fri, 6 Nov 2009 01:09:29 +0100 Subject: [python-win32] More win32com woes: Wrapping COM objects Message-ID: <244326748.20091106010929@gmx.net> Hi, while my recent problem got solved due to Mark being of great help, interacting with COM from Python seems to bring up a few problems I hadn't thought about at first. This is what is taxing my brain at the moment: I would like to wrap a COM object instance with a Python class in order to manage the COM class and additional data associated with that class, but I have trouble accessing the wrapper class from the COM event instance. Code is something like this: class event_handler: def OnSomething(self, param): c = someclass(param) obj = c.method() self.register(obj) # self.register won't work, as self obviously has no attribute # register, additionally, I'm worried about circular references class application(object): def __init__(self): self.__com_obj = DispatchWithEvents("{GUID}", event_handler) self.__objects = [] def register(self, obj): self.__objects.append(obj) Basically, I'm trying to manage a list of objects returned via a call to a COM object, so that I can access them at later times in Python code and to keep them referenced so that the event handler won't get disconnected when Python determines the object is no longer in use. (getevents() alone isn't an option here as it wouldn't solve the problem of accessing the application object everywhere I need it). The real application class is obviously more complex and contains data I need in the event handler. First thing is, I can't think of a clean way to provide event_handler with a reference to an application instance without using globals (ugly), and second, even if I could access an application instance in event_handler, I'm wondering if this wouldn't create a circular reference (i.e. the event handler class would maintain a reference to the COM object via application.__com_obj, while the COM object maintains a reference to the event handler, established via DispatchWithEvents - I don't know if the EventProxy class would somehow prevent this). So: Long story short, anyone knows a clean way to access my application instance in the event_handler class? Any help would be _really_ appreciated. Regards, Celvin From StormDragoness at stormweyr.dk Fri Nov 6 01:41:04 2009 From: StormDragoness at stormweyr.dk (Stormy) Date: Fri, 06 Nov 2009 00:41:04 +0000 Subject: [python-win32] Extending Vista/Windows7 with Python In-Reply-To: <4AF3221B.4010307@probo.com> References: <4AF29C58.30805@stormweyr.dk> <4AF3221B.4010307@probo.com> Message-ID: <4AF370A0.9020702@stormweyr.dk> Tim Roberts wrote: > Stormy wrote: > >> I am trying to implement IPropertyStore in a python component, and run >> into a few problems. >> >> HRESULT GetValue( >> REFPROPERTYKEY /key/, >> PROPVARIANT */pv/ >> ); >> The GetValue method passes a pointer in the form of an integer to >> python instead of a key. >> > > Correct. REFPROPERTYKEY is a pointer to the key. You will probably > have to use something like ctypes to dereference the pointer and fetch > the actual key. > > Found I needed an update to my python distribution for ctypes to load properly. Ok, I've constructed the PROPERTYKEY structure using ctypes, and I am now successfully fetching sensible data from this pointer >> And secondly the return value never makes it back to windows either. >> > > What are you actually returning? > > I am trying to return a string, however I am not sure if there is automatic wrapping of this in a PROPVARIANT as this is the expected return value. The python version of GetValue only accepts the key as an argument., I am unsure how to proceed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.bilokon at citi.com Fri Nov 6 18:05:12 2009 From: paul.bilokon at citi.com (Bilokon, Paul ) Date: Fri, 6 Nov 2009 17:05:12 +0000 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <4AF20105.50606@gmail.com> Message-ID: <527ECB9B96931D4EB1513B92C8950FC336DE2FC3@exlnmb02.eur.nsroot.net> Hi Mark, I wonder if the EOFError in gencache.py described here http://mail.python.org/pipermail/python-win32/2009-February/008770.html has been resolved in more recent revisions? We are hitting exactly the same problem when we are running multiple python processes. Have you come up with any other workarounds? Many thanks for your help! Best wishes, Paul -----Original Message----- From: python-win32-bounces+paul.bilokon=citi.com at python.org [mailto:python-win32-bounces+paul.bilokon=citi.com at python.org] On Behalf Of Mark Hammond Sent: 04 November 2009 22:33 To: Rob Brown-Bayliss Cc: python-win32 at python.org Subject: Re: [python-win32] multiprocessing pickle problem in win32 On 5/11/2009 4:57 AM, Rob Brown-Bayliss wrote: > On Wed, Nov 4, 2009 at 11:02 PM, Mark Hammond wrote: > >> >> I'd try running it from python.exe to see if it is something funky >> about the pythonwin execution environment... >> > > Same result, cant pickle NoneType when I call start() on the process > object, exact same code works with out error on linux so I have to > assume it's either a problem with multiprocessing on win32 or the > win32 machine is not set up properly, I am using active python on the > win32 box. In that case you probably need to reduce your sample to the smallest possible code which demonstrates the problem. (At face value, it almost looks like you have 2 discrete interpreters in the same process, so have 2 different 'None' objects, but that should be very difficult to make happen...) Cheers, Mark _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From mhammond at skippinet.com.au Sat Nov 7 00:01:09 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Sat, 07 Nov 2009 10:01:09 +1100 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <527ECB9B96931D4EB1513B92C8950FC336DE2FC3@exlnmb02.eur.nsroot.net> References: <527ECB9B96931D4EB1513B92C8950FC336DE2FC3@exlnmb02.eur.nsroot.net> Message-ID: <4AF4AAB5.5010401@skippinet.com.au> On 7/11/2009 4:05 AM, Bilokon, Paul wrote: > Hi Mark, > > I wonder if the EOFError in gencache.py described here > > http://mail.python.org/pipermail/python-win32/2009-February/008770.html > > has been resolved in more recent revisions? It hasn't. > We are hitting exactly the same problem when we are running multiple python processes. > > Have you come up with any other workarounds? Try having a single "master" process do the generation bewfore starting the sub-processes? Cheers, Mark From StormDragoness at stormweyr.dk Sat Nov 7 00:27:44 2009 From: StormDragoness at stormweyr.dk (Stormy) Date: Fri, 06 Nov 2009 23:27:44 +0000 Subject: [python-win32] Extending Vista/Windows7 with Python In-Reply-To: <4AF370A0.9020702@stormweyr.dk> References: <4AF29C58.30805@stormweyr.dk> <4AF3221B.4010307@probo.com> <4AF370A0.9020702@stormweyr.dk> Message-ID: <4AF4B0F0.2000600@stormweyr.dk> Ok, I have in fact managed to provide incorrect data based on my meddling with the source. Furthermore, the patch I offered for the 64-bit make_method was also broken, I have attached the corrected version. To the problem at hand: The return type expected is PROPVARIANT, however when I return (a string in this case) I receive trace about VT_RECORD VT_RECORD = 36 (0x24) How would I proceed? ############# __init__ Initialize GetValue: {4DFCB999-F66E-45E1-82D0-9B27FAB443A1}100 pythoncom error: Failed to call the universal dispatcher Traceback (most recent call last): File "C:\Python26-64\lib\site-packages\win32com\universal.py", line 193, in dispatch WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) TypeError: The VARIANT type is unknown (0x24). pythoncom error: Unexpected gateway error Traceback (most recent call last): File "C:\Python26-64\lib\site-packages\win32com\universal.py", line 193, in dispatch WriteFromOutTuple(retVal, meth._gw_out_args, argPtr) TypeError: The VARIANT type is unknown (0x24). __del__ ############# -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: univgw.cpp.patch URL: From ti.crossman at myfairpoint.net Sun Nov 8 06:20:46 2009 From: ti.crossman at myfairpoint.net (Ti Crossman) Date: Sun, 8 Nov 2009 00:20:46 -0500 Subject: [python-win32] Compiling Python code to DLLs: Any way to do this Message-ID: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> Hello, all. I have a need to create application extensions for ESRI ArcGIS geographic information system software. ArcGIS is built from the ground up using COM technology. Supposedly, one can program against the (absolutely enormous) ArcObjects object model with any COM-compliant language. From what I understand, that includes Python -- with the pywin32 extensions, of course. Now, the real trick here is that the extension must be compiled into a DLL (and must implement the IExension interface) for ArcGIS to recognize it as an extension. So, making the whopping assumption that I can pull off such a coding feat with Python (2.5.1 in this case), I have one main question: is there a way to compile my Python code into a DLL that will work for me? I did some reading up on py2exe and gather that it will compile Pyhton modules to DLLs; however, I also saw a reference to COM DLLs vs. C-type DLLs and whether or not they have random entry points. This is out of my league, I'm afraid. Long ago, I used to write extensions for ArcGIS using VB6 in MS Visual Studio -- fast, easy, and powerful, and DLLs were native; however, I can't say that I know which of the two types of DLLs I was producing. Now, ESRI and Microsoft are not supporting VB6 anymore, and I don't know C/C++, .NET, or any other compiled COM-compliant language. I'm simply not a trained programmer. Besides, I don't have access to a modern version of MSVS. I _have_ been trying out Python recently (love it), and with wxPython and other do-dads, I can make some really nice applications. I would love to be able to write ArcGIS extensions in Python, but the DLL thing is a deal-breaker if I can't make one from the Python code. My system: Windows XP ArcGIS 9.3 (for those for whom this means anything) Python 2.5.1 (has to be this version: comes with ArcGIS, and ArcGIS is dependent on it) pywin32 wxPython 2.8 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Sun Nov 8 15:54:30 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Sun, 8 Nov 2009 07:54:30 -0700 Subject: [python-win32] Compiling Python code to DLLs: Any way to do this In-Reply-To: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> References: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> Message-ID: My son, who is a soil scientist in the United States Department of Agriculture, has been encouraging me to learn ArcGIS for years. He tells me that Python is the ESRI's language of choice for implementing extensions to ArcGIS. That being the case, I tried a Google search for "arcgis python" and got a number of links, including this one from ESRI. http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=30028 I have not downloaded the slideshow, but I am guessing that it will answer your questions. If not, feel free to ask for more details here. I would then have an excuse to learn more about this myself. He claims that it would be good for my consulting repertory. -- Vernon Cole On Sat, Nov 7, 2009 at 10:20 PM, Ti Crossman wrote: > Hello, all. I have a need to create application extensions for ESRI > ArcGIS geographic information system software. ArcGIS is built from the > ground up using COM technology. Supposedly, one can program against the > (absolutely enormous) ArcObjects object model with any COM-compliant > language. From what I understand, that includes Python -- with the pywin32 > extensions, of course. Now, the real trick here is that the extension must > be compiled into a DLL (and must implement the IExension interface) for > ArcGIS to recognize it as an extension. > > So, making the whopping assumption that I can pull off such a coding feat > with Python (2.5.1 in this case), I have one main question: is there a way > to compile my Python code into a DLL that will work for me? > > I did some reading up on py2exe and gather that it will compile Pyhton > modules to DLLs; however, I also saw a reference to COM DLLs vs. C-type DLLs > and whether or not they have random entry points. This is out of my league, > I'm afraid. Long ago, I used to write extensions for ArcGIS using VB6 in MS > Visual Studio -- fast, easy, and powerful, and DLLs were native; however, I > can't say that I know which of the two types of DLLs I was producing. Now, > ESRI and Microsoft are not supporting VB6 anymore, and I don't know C/C++, > .NET, or any other compiled COM-compliant language. I'm simply not a > trained programmer. Besides, I don't have access to a modern version of > MSVS. I _have_ been trying out Python recently (love it), and with wxPython > and other do-dads, I can make some really nice applications. I would love > to be able to write ArcGIS extensions in Python, but the DLL thing is a > deal-breaker if I can't make one from the Python code. > > My system: > > Windows XP > ArcGIS 9.3 (for those for whom this means anything) > Python 2.5.1 (has to be this version: comes with ArcGIS, and ArcGIS is > dependent on it) > pywin32 > wxPython 2.8 > > _______________________________________________ > 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 Andrew.MacIntyre at acma.gov.au Mon Nov 9 01:35:49 2009 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Mon, 9 Nov 2009 11:35:49 +1100 Subject: [python-win32] Compiling Python code to DLLs: Any way to do this [SEC=PERSONAL] In-Reply-To: References: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> Message-ID: <7B01D7143C4AD54899EA079D4557562AFEF848@ACT01EXC02.internal.govt> > From: Vernon Cole > > That being the case, I tried a Google search for "arcgis > python" and got a number of links, including this one from ESRI. > http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleS how&d=30028 > I have not downloaded the slideshow, but I am guessing that > it will answer your questions. That slideshow deals with ArcGIS' internal use of Python as a scripting language for geoprocessing, which unfortunately (AFAIK) has little to do with using ArcGIS' COM capabilities. > On Sat, Nov 7, 2009 at 10:20 PM, Ti Crossman > wrote: > > > Hello, all. I have a need to create application > extensions for ESRI ArcGIS geographic information system > software. ArcGIS is built from the ground up using COM > technology. Supposedly, one can program against the > (absolutely enormous) ArcObjects object model with any > COM-compliant language. Indeed, I have been doing so with Python for some years. > From what I understand, that > includes Python -- with the pywin32 extensions, of course. Unfortunately not, as much of the ArcObjects object model doesn't have the Dispatch support that pywin32 requires :-( However ctypes+comtypes can be used to access most of ArcObjects (certainly all that I've tried). > Now, the real trick here is that the extension must be > compiled into a DLL (and must implement the IExension > interface) for ArcGIS to recognize it as an extension. I've never had the need to go that far, and so don't know much about that. I wonder whether it is in fact a DLL that ArcGIS requires, or just a type library - keeping in mind that DLLs can contain type library information, so that a "type library only" DLL might be sufficient (if such a thing is possible). If so, it might be possible to use Python to create COM objects with such a "type library only" DLL. You can probably go a long way just with building COM objects in Python and writing VBA wrappers to call them. > So, making the whopping assumption that I can pull off > such a coding feat with Python (2.5.1 in this case), I have > one main question: is there a way to compile my Python code > into a DLL that will work for me? Can't really address the DLL building issue, but I wouldn't think that Python 2.5.1 is necessarily an absolute requirement, though there might be circumstances where it would be prudent... (to avoid trring to load multiple runtimes into the same process). There is a faint chance that someone with some serious skills could use something like Pyrex or Cython (on top of the MinGW32 toolchain) to create the DLLs you're talking about - even if just to write an extension that embeds Python. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre National Licensing and Allocations Branch tel: +61 2 6219 5356 Inputs to Industry Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au http://www.acma.gov.au/ If you have received this email in error, please notify the sender immediately and erase all copies of the email and any attachments to it. The information contained in this email and any attachments may be private, confidential and legally privileged or the subject of copyright. If you are not the addressee it may be illegal to review, disclose, use, forward, or distribute this email and/or its contents. Unless otherwise specified, the information in the email and any attachments is intended as a guide only and should not be relied upon as legal or technical advice or regarded as a substitute for legal or technical advice in individual cases. Opinions contained in this email or any of its attachments do not necessarily reflect the opinions of ACMA. From theller at ctypes.org Mon Nov 9 08:18:06 2009 From: theller at ctypes.org (Thomas Heller) Date: Mon, 09 Nov 2009 08:18:06 +0100 Subject: [python-win32] Compiling Python code to DLLs: Any way to do this In-Reply-To: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> References: <812DC833994F45E29521DD392D7C867B@KEllisHKVP8K1> Message-ID: Ti Crossman schrieb: > Hello, all. I have a need to create application extensions for ESRI > ArcGIS geographic information system software. ArcGIS is built from > the ground up using COM technology. Supposedly, one can program > against the (absolutely enormous) ArcObjects object model with any > COM-compliant language. From what I understand, that includes Python > -- with the pywin32 extensions, of course. Now, the real trick here > is that the extension must be compiled into a DLL (and must implement > the IExension interface) for ArcGIS to recognize it as an extension. > > So, making the whopping assumption that I can pull off such a coding > feat with Python (2.5.1 in this case), I have one main question: is > there a way to compile my Python code into a DLL that will work for > me? When you implement a COM object in Python then it IS a DLL. If you use pywin32 then it is pythoncom.dll is it, if you use comtypes then _ctypes.pyd is it. These DLLs have the standard COM entry points DllGetClassObject and DllCanUnloadNow. > I did some reading up on py2exe and gather that it will compile > Pyhton modules to DLLs; however, I also saw a reference to COM DLLs > vs. C-type DLLs and whether or not they have random entry points. py2exe can create 'standalone' DLLs from Python COM servers; it can NOT create DLLs with custom entry points. -- Thanks, Thomas From paul.bilokon at citi.com Mon Nov 9 10:33:22 2009 From: paul.bilokon at citi.com (Bilokon, Paul ) Date: Mon, 9 Nov 2009 09:33:22 +0000 Subject: [python-win32] multiprocessing pickle problem in win32 In-Reply-To: <4AF4AAB5.5010401@skippinet.com.au> Message-ID: <527ECB9B96931D4EB1513B92C8950FC336DE2FCB@exlnmb02.eur.nsroot.net> Many thanks for your reply, Mark. I'll try your suggestion. Best wishes, Paul -----Original Message----- From: Mark Hammond [mailto:mhammond at skippinet.com.au] Sent: 06 November 2009 23:01 To: Bilokon, Paul [ICG-MKTS] Cc: 'python-win32 at python.org'; Moudry, Jiri George [ICG-MKTS]; Adams, Lyndon [ICG-IT] Subject: Re: [python-win32] multiprocessing pickle problem in win32 On 7/11/2009 4:05 AM, Bilokon, Paul wrote: > Hi Mark, > > I wonder if the EOFError in gencache.py described here > > http://mail.python.org/pipermail/python-win32/2009-February/008770.htm > l > > has been resolved in more recent revisions? It hasn't. > We are hitting exactly the same problem when we are running multiple python processes. > > Have you come up with any other workarounds? Try having a single "master" process do the generation bewfore starting the sub-processes? Cheers, Mark From skippy.hammond at gmail.com Mon Nov 9 11:41:53 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 09 Nov 2009 21:41:53 +1100 Subject: [python-win32] More win32com woes: Wrapping COM objects In-Reply-To: <244326748.20091106010929@gmx.net> References: <244326748.20091106010929@gmx.net> Message-ID: <4AF7F1F1.2080405@gmail.com> On 6/11/2009 11:09 AM, Celvin wrote: ... > class application(object): > def __init__(self): > self.__com_obj = DispatchWithEvents("{GUID}", event_handler) > self.__objects = [] > > def register(self, obj): > self.__objects.append(obj) > > Basically, I'm trying to manage a list of objects returned via a call > to a COM object, so that I can access them at later times in Python > code and to keep them referenced so that the event handler won't get > disconnected when Python determines the object is no longer in use. > (getevents() alone isn't an option here as it wouldn't solve the problem > of accessing the application object everywhere I need it). Can't you set an attribute on __com_obj after creation? > > The real application class is obviously more complex and contains data > I need in the event handler. First thing is, I can't think of a clean > way to provide event_handler with a reference to an application > instance without using globals (ugly), and second, even if I could access > an application instance in event_handler, I'm wondering if this wouldn't > create a circular reference (i.e. the event handler class would maintain > a reference to the COM object via application.__com_obj, while the COM > object maintains a reference to the event handler, established via > DispatchWithEvents - I don't know if the EventProxy class would > somehow prevent this). Yeah, circular refs are a bit of a problem - event handlers have a way of disconnecting though - you may need to dog into the source to best work out how to hook into that process. Cheers, Mark From skippy.hammond at gmail.com Mon Nov 9 11:49:04 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 09 Nov 2009 21:49:04 +1100 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <5b8d13220911030615g64ce9ce2r8a672615f148991e@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030615g64ce9ce2r8a672615f148991e@mail.gmail.com> Message-ID: <4AF7F3A0.1040203@gmail.com> On 4/11/2009 1:15 AM, David Cournapeau wrote: > (sorry for having forgotten to CC the list the first time) > >> On 2/11/2009 6:34 PM, David Cournapeau wrote: > >>> The way I did was similar to what we do in numpy, that is setup.py is >>> still using distutils by default, but if you call setupegg.py, you get >>> the setuptools feature set. The changes to pywin32 sources are minimal >>> (< 20 lines), and none of the changes should affect current users. > > I attached the patch to this email. > > The only test I have done is that python setupegg.py and setup.py > install generate the same tree (and that the produced egg is working). > I am not very familiar with pywin32, so if there is a formal test > suite to run, let me know, Sorry for the delay, Is it possible to just have 'setup.py bdist_egg' do the right thing without the new setupegg.py? Cheers, Mark From highcar at gmail.com Mon Nov 9 12:49:28 2009 From: highcar at gmail.com (elca) Date: Mon, 9 Nov 2009 03:49:28 -0800 (PST) Subject: [python-win32] closing not response win32 IE com interface Message-ID: <26265067.post@talk.nabble.com> hello All, these day im making some script that use win32 IE com interface. one of problem is , my internet line is very slow, so sometimes my IE.navigate("http://www.example.com") not response timely. it looks hang and open status, not complete status. so my IE.navigate function is not correctly working. anyone can help me? in that case ,how to close or restart my script from start. thanks in advance Paul -- View this message in context: http://old.nabble.com/closing-not-response-win32-IE-com-interface-tp26265067p26265067.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From cournape at gmail.com Mon Nov 9 13:16:45 2009 From: cournape at gmail.com (David Cournapeau) Date: Mon, 9 Nov 2009 21:16:45 +0900 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <4AF7F3A0.1040203@gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030615g64ce9ce2r8a672615f148991e@mail.gmail.com> <4AF7F3A0.1040203@gmail.com> Message-ID: <5b8d13220911090416pb7cdb60p5742c7067448b72@mail.gmail.com> Hi Mark, On Mon, Nov 9, 2009 at 7:49 PM, Mark Hammond wrote: > Sorry for the delay, No problem. > ?Is it possible to just have 'setup.py bdist_egg' do the right thing without > the new setupegg.py? It may be difficult. Avoiding the setupegg.py is no issue, but then it forces you to use setuptools in setup.py, which you may not want. A lot of things are changed, like how the sdist is generated from the VCS - I personally find this very annoying (this exact behavior can be bypassed through hacks, though). You would also need to check that all your distutils commands work correctly with setuptools. But if you prefer everything in setup.py despite those shortcomings, I can prepare a patch without setupegg.py David From mhammond at skippinet.com.au Mon Nov 9 13:19:14 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Mon, 09 Nov 2009 23:19:14 +1100 Subject: [python-win32] Interest for patch enabling building egg ? In-Reply-To: <5b8d13220911090416pb7cdb60p5742c7067448b72@mail.gmail.com> References: <5b8d13220911012334w143bf30jab834f744c53bc6e@mail.gmail.com> <4AEEB6B2.50508@gmail.com> <5b8d13220911030615g64ce9ce2r8a672615f148991e@mail.gmail.com> <4AF7F3A0.1040203@gmail.com> <5b8d13220911090416pb7cdb60p5742c7067448b72@mail.gmail.com> Message-ID: <4AF808C2.9040608@skippinet.com.au> On 9/11/2009 11:16 PM, David Cournapeau wrote: > Hi Mark, > > On Mon, Nov 9, 2009 at 7:49 PM, Mark Hammond wrote: > >> Sorry for the delay, > > No problem. > >> Is it possible to just have 'setup.py bdist_egg' do the right thing without >> the new setupegg.py? > > It may be difficult. Avoiding the setupegg.py is no issue, but then it > forces you to use setuptools in setup.py, which you may not want. A > lot of things are changed, like how the sdist is generated from the > VCS - I personally find this very annoying (this exact behavior can be > bypassed through hacks, though). You would also need to check that all > your distutils commands work correctly with setuptools. > > But if you prefer everything in setup.py despite those shortcomings, I > can prepare a patch without setupegg.py I'd be happy with something as hacky as: if 'bdist_egg' in sys.args: import setuptools ... but if this really does lead to more mess than it is worth, I'll accept it with the new file. Cheers, Mark From herzog at mpi-cbg.de Mon Nov 9 13:39:07 2009 From: herzog at mpi-cbg.de (Ronny Herzog) Date: Mon, 09 Nov 2009 13:39:07 +0100 Subject: [python-win32] completely removing python from windows Message-ID: <4AF80D6B.6050708@mpi-cbg.de> Dear users, I want to remove Python 2.5 from my Windows Vista in favor of Python 2.6. I installed 2.6 already and used the Python2.5 uninstaller to remove the old version. But when I type 'python' in the command line, the Python 2.5 shell is opened. What do I have to do to completely remove the old Python? It is important for my work. thank you and regards, Ronny -------------- next part -------------- A non-text attachment was scrubbed... Name: herzog.vcf Type: text/x-vcard Size: 467 bytes Desc: not available URL: From vernondcole at gmail.com Mon Nov 9 15:59:15 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 9 Nov 2009 07:59:15 -0700 Subject: [python-win32] completely removing python from windows In-Reply-To: <4AF80D6B.6050708@mpi-cbg.de> References: <4AF80D6B.6050708@mpi-cbg.de> Message-ID: I believe that if you re-install 2.6 you will find that the definition of "python" will be changed by the installer. I typically have four or five versions of python on my workstation, and I run in to this problem frequently. So I usually put a "python.bat" file in a utility folder (which is relatively early in my search path) so that it will point to which ever version I want to be my "default" python for the day. C:\Python26\python.exe %1 %2 %3 %4 %5 <\code> Python utilities which may be version dependent can benefit from similar treatment: C:\Python26\python.exe C:\Python26\tools\scripts\2to3.py %1 %2 %3 %4 %5 %6 %7 %8 %9 <\code> start C:\Python26\Lib\site-packages\pythonwin\pythonwin.exe %1 %2 %3 %4 %5 That way, if I type "ped myPythonScript.py" on the command line, I will get the correct IDE. On the other hand, if I right-click on "myPythonScript.py" and select "Edit", I will get the IDE for which ever version of Python I installed most recently, usually a 3.x version, which may make it rather difficult to debug a Python 2.x script. ;-) HTH Vernon Cole P.S.: I keep all of my imitation gnu command line tools (like "tail", "touch", "less", etc.) in that same utility folder. On Mon, Nov 9, 2009 at 5:39 AM, Ronny Herzog wrote: > Dear users, > > I want to remove Python 2.5 from my Windows Vista in favor of Python 2.6. I > installed 2.6 already and used the Python2.5 uninstaller to remove the old > version. But when I type 'python' in the command line, the Python 2.5 shell > is opened. > > What do I have to do to completely remove the old Python? It is important > for my work. > > thank you and regards, > Ronny > > _______________________________________________ > 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 mdriscoll at co.marshall.ia.us Mon Nov 9 16:20:30 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 09 Nov 2009 09:20:30 -0600 Subject: [python-win32] Unmuting the Microphone Message-ID: <4AF8333E.20201@co.marshall.ia.us> Hi, I received a request to un-mute the microphone on Windows XP. I've looked around online and all I've seen are people recommending ctypes, but no examples (in Python). I did find this C++ code, but I can't tell if if just toggles mute or allows the programmer to specify that they want the mic unmuted. Here's the link: http://www.associatedcontent.com/article/1171176/how_to_mute_or_unmute_the_system_volume.html?cat=59 I found an even longer piece of c# code, but it looks like it's mostly constants: http://blog.xploiter.com/c-and-aspnet/muting-audio-channels-mixer-control-api/ Does anyone have any tips or could point me in the right direction? I didn't find any obvious wrappers in the docs. Thanks, Mike From timr at probo.com Mon Nov 9 20:09:07 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 09 Nov 2009 11:09:07 -0800 Subject: [python-win32] Unmuting the Microphone In-Reply-To: <4AF8333E.20201@co.marshall.ia.us> References: <4AF8333E.20201@co.marshall.ia.us> Message-ID: <4AF868D3.9030302@probo.com> Mike Driscoll wrote: > > I received a request to un-mute the microphone on Windows XP. I've > looked around online and all I've seen are people recommending ctypes, > but no examples (in Python). I did find this C++ code, but I can't > tell if if just toggles mute or allows the programmer to specify that > they want the mic unmuted. Here's the link: > http://www.associatedcontent.com/article/1171176/how_to_mute_or_unmute_the_system_volume.html?cat=59 > That one only works in Vista and Win 7. XP doesn't support IMMDevice. > I found an even longer piece of c# code, but it looks like it's mostly > constants: > > http://blog.xploiter.com/c-and-aspnet/muting-audio-channels-mixer-control-api/ > That uses the WinMM APIs, which is the right way to go on XP. The constants are already defined in win32.mmsystem, but I don't think the APIs themselves are. That means falling back to ctypes. This C++ example is closer: http://stackoverflow.com/questions/1042423/how-do-i-get-the-mic-volume-of-all-audio-cards-in-windows-xp-using-c You'll call mixerOpen for your waveIn device (probably #0), call mixerGetLineInfo to make sure it's a microphone, then enumerate the controls to find the mute, and mixerSetControlDetails to clear the mute state. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From greg.ewing at canterbury.ac.nz Mon Nov 9 22:14:03 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 10 Nov 2009 10:14:03 +1300 Subject: [python-win32] Pywin32 GUI not working with pythonw Message-ID: <4AF8861B.1090608@canterbury.ac.nz> I have a bizarre problem. The following program: import win32ui app = win32ui.GetApp() app.Run() works fine when run from a command window using python.exe -- it happily sits there waiting for events until I kill it with the task manager. However, if I run it using pythonw.exe, the GetApp() call returns immediately with a value of 0. I've tried diverting stdout and stderr into a file to see if there are any error messages or tracebacks, but there is nothing. Anyone have any idea what might be wrong? I'm using Python 2.5.4 and Pywin32 build 213 on Windows 2000. -- Greg From dolf_michielsen at applied-maths.com Tue Nov 10 09:15:29 2009 From: dolf_michielsen at applied-maths.com (Dolf Michielsen) Date: Tue, 10 Nov 2009 09:15:29 +0100 Subject: [python-win32] WinINet Http*Request? Message-ID: <4AF92121.6040606@applied-maths.com> Hi, I am using win32inet for retreiving web pages via InternetOpenUrl / InternetReadFile. Now I would like to extend the functionality to also POST data. However, it seems the WinINet functions HttpOpenRequest, HttpAddRequestHeaders, HttpEndRequest and HttpSendRequest not available in win32inet? Is there a way to send HTTP POST messages through the WinINet API using pywin32? I would like to go through the WinINet API because it transparantly handles the proxy settings if set correctly in IE; without bothering with retreiving/setting the proxy handlers with e.g. urllib2 Thanks, Dolf Michielsen From theller at ctypes.org Tue Nov 10 15:03:57 2009 From: theller at ctypes.org (Thomas Heller) Date: Tue, 10 Nov 2009 15:03:57 +0100 Subject: [python-win32] WinINet Http*Request? In-Reply-To: <4AF92121.6040606@applied-maths.com> References: <4AF92121.6040606@applied-maths.com> Message-ID: Dolf Michielsen schrieb: > Hi, > > I am using win32inet for retreiving web pages via InternetOpenUrl / > InternetReadFile. Now I would like to extend the functionality to also > POST data. However, it seems the WinINet functions HttpOpenRequest, > HttpAddRequestHeaders, HttpEndRequest and HttpSendRequest not available > in win32inet? > > Is there a way to send HTTP POST messages through the WinINet API using > pywin32? > > I would like to go through the WinINet API because it transparantly > handles the proxy settings if set correctly in IE; without bothering > with retreiving/setting the proxy handlers with e.g. urllib2 You could try to use the WinHTTP.WinHTTPRequest.5.1 COM object, with pywin32 or comtypes. Thomas From skippy.hammond at gmail.com Wed Nov 11 02:39:26 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 11 Nov 2009 12:39:26 +1100 Subject: [python-win32] Pywin32 GUI not working with pythonw In-Reply-To: <4AF8861B.1090608@canterbury.ac.nz> References: <4AF8861B.1090608@canterbury.ac.nz> Message-ID: <4AFA15CE.9010802@gmail.com> On 10/11/2009 8:14 AM, Greg Ewing wrote: > I have a bizarre problem. The following program: > > import win32ui > app = win32ui.GetApp() > app.Run() > > works fine when run from a command window using > python.exe -- it happily sits there waiting for > events until I kill it with the task manager. > > However, if I run it using pythonw.exe, the > GetApp() call returns immediately with a value > of 0. > > I've tried diverting stdout and stderr into a > file to see if there are any error messages or > tracebacks, but there is nothing. > > Anyone have any idea what might be wrong? > > I'm using Python 2.5.4 and Pywin32 build 213 > on Windows 2000. No real clues, other than noting only a "default" app will be used - you generally need to provide your own app which does magic in InitInstance. The following script is the "correct" way of booting an MFC/win32ui app - the important bit is really the side-effect (boo!) of importing pywin.framework.intpyapp. Cheers, Mark import sys import win32ui # importing 'intpyapp' automatically registers an app object. from pywin.framework import intpyapp # Remove this script name from sys.argv, else Pythonwin will try and open it! sys.argv = sys.argv[:-1] # Get the MFC "app" object and boot it up. app = win32ui.GetApp() app.InitInstance() app.Run() app.ExitInstance() From gpaolano at servicemanagement.com Wed Nov 11 04:55:59 2009 From: gpaolano at servicemanagement.com (Guido Paolano) Date: Tue, 10 Nov 2009 21:55:59 -0600 Subject: [python-win32] embedded Excel data in PowerPoint Chart Message-ID: <89D1C9030590E84685138821777D32810C20DDE4@smg_exch01.servicemanagement.com> This may have been answered elsewhere, and if so I apologize. But I'm trying to change the data in the excel embedded in a powerpoint chart. I can get the chart data to open with this, but can't access the cell data: App = win32com.client.Dispatch("PowerPoint.Application") Presentation = App.Presentations.Open(x) Presentation.Slides[0].Shapes[0].Chart.ChartData.Activate() I have a template chart, so I just need to open it and change the data. Thanks ________________________________________________________________________ _________________________________ Guido Paolano, M.A. | Service Management Group | Research Analyst | gpaolano at servicemanagement.com | 816.841.5636 ##################################################################################### This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto. ##################################################################################### -------------- next part -------------- An HTML attachment was scrubbed... URL: From highcar at gmail.com Wed Nov 11 16:19:49 2009 From: highcar at gmail.com (elca) Date: Wed, 11 Nov 2009 07:19:49 -0800 (PST) Subject: [python-win32] IE interface PAMIE javascript click or win32 ie click Message-ID: <26302675.post@talk.nabble.com> Hello, these day im making some script. i have encounter some problem with my script work. problem is i want to click emulate javascript on following site. http://news.naver.com/main/presscenter/category.nhn this site is news site. and everyday news content also changed, but javascript is not changed. for example i want to click javascript every inside 'li' element . how can i make it work with Pamie or win32com IE interface? thanks in advance
  • http://www.bloter.net/wp-content/bloter_html/2009/11/11/19083.html ???? ??? ?? ?? ???????? MS vs. VM??,
  • http://www.bloter.net/wp-content/bloter_html/2009/11/11/19105.html http://static.naver.com/newscast/2009/1111/1615301154902609.jpg "??????? PLM ?? ??"
  • thanks -- View this message in context: http://old.nabble.com/IE-interface-PAMIE-javascript-click-or-win32-ie-click-tp26302675p26302675.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From timr at probo.com Wed Nov 11 19:51:33 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 11 Nov 2009 10:51:33 -0800 Subject: [python-win32] IE interface PAMIE javascript click or win32 ie click In-Reply-To: <26302675.post@talk.nabble.com> References: <26302675.post@talk.nabble.com> Message-ID: <4AFB07B5.7060105@probo.com> elca wrote: > these day im making some script. > > i have encounter some problem with my script work. > > problem is i want to click emulate javascript on following site. > > http://news.naver.com/main/presscenter/category.nhn > > this site is news site. and everyday news content also changed, but > javascript is not changed. > > for example i want to click javascript every inside 'li' element . > > how can i make it work with Pamie or win32com IE interface? > I guess I'm not sure what you're after. You can certainly read the HTML, find the links, and fetch the pages they point to, if you want to get the individual news items. You could do that with urllib2, without using IE at all. However, each section of that page points to a different provider, so you'll have quite a job analyzing each one separately. If you're trying to force a call to the "nds_tagging" or "clickcr" functions, you would have to use the IE object model to inject a new " ); There may be some COM tricks to play here. The Document object can be either IHTMLDocument or IHTMLDocument2 or IHTMLDocument3 or ...4 or ...5 or ...6. You'll need at least IHTMLDocument2 in order to use these methods. Plus, the "write" method actually takes a COM SAFEARRAY. I'm not exactly sure how that's exposed in Python. You're going to have to do some reading about this, both about the win32com toys, and about the InternetExplorer automation interface, and about the IHTMLDocument2 interface. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From highcar at gmail.com Sat Nov 14 00:47:48 2009 From: highcar at gmail.com (elca) Date: Fri, 13 Nov 2009 15:47:48 -0800 (PST) Subject: [python-win32] IE interface PAMIE javascript click or win32 ie click In-Reply-To: <4AFC4B24.3020004@probo.com> References: <26302675.post@talk.nabble.com> <4AFB07B5.7060105@probo.com> <26312374.post@talk.nabble.com> <4AFC4B24.3020004@probo.com> Message-ID: <26345290.post@talk.nabble.com> Tim Roberts wrote: > > elca wrote: >> Hello, >> ""clickcr" functions, you would have to use the IE object model to inject >> a >> new " ); > > There may be some COM tricks to play here. The Document object can be > either IHTMLDocument or IHTMLDocument2 or IHTMLDocument3 or ...4 or ...5 > or ...6. You'll need at least IHTMLDocument2 in order to use these > methods. Plus, the "write" method actually takes a COM SAFEARRAY. I'm > not exactly sure how that's exposed in Python. > > You're going to have to do some reading about this, both about the > win32com toys, and about the InternetExplorer automation interface, and > about the IHTMLDocument2 interface. > > -- > 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 > > hello, thanks for your help , maybe i need to study some more about many related with win32 and so on thanks again Paul -- View this message in context: http://old.nabble.com/IE-interface-PAMIE-javascript-click-or-win32-ie-click-tp26302675p26345290.html Sent from the Python - python-win32 mailing list archive at Nabble.com. From greg.ewing at canterbury.ac.nz Fri Nov 13 23:53:32 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sat, 14 Nov 2009 11:53:32 +1300 Subject: [python-win32] ANN: PyGUI 2.1 Message-ID: <4AFDE36C.2060901@canterbury.ac.nz> PyGUI 2.1 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Highlights of this version: * Win32: Fixed bug preventing PyGUI apps from working under pythonw Fixed incorrect mouse coordinates in ScrollableView Added more standard cursors * MacOSX: Application menu now has working Hide, Hide Others and Show All commands. Plus a few other bug fixes and improvements. What is PyGUI? -------------- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing greg.ewing at canterbury.ac.nz http://www.cosc.canterbury.ac.nz/greg.ewing/ From skippy.hammond at gmail.com Sat Nov 14 06:42:29 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Sat, 14 Nov 2009 16:42:29 +1100 Subject: [python-win32] Options for running Python under IIS? In-Reply-To: <4AFC4434.2040400@inteli-com.com> References: <796c415c0911111503i624835bcvecf3eb11f3a73f66@mail.gmail.com> <4AFC4434.2040400@inteli-com.com> Message-ID: <4AFE4345.9000108@gmail.com> On 13/11/2009 4:21 AM, Randy Syring wrote: > You may be able to use isapi-wsgi with a custom application pool to > achieve what you are looking for. If you can restrict the application > pool to only use one thread per process (which I am not sure how to do) > and then use multiple processes (properties -> performance -> maximum > number of worker processes), you may be able to achieve what you are > trying to do. You might want to ask more questions on the isapi-wsgi board. This sounds right - and you select a non-threaded implementation simply by way of the base class you inherit from in your Python implementation. Cheers, Mark From rsyring at inteli-com.com Sat Nov 14 07:44:52 2009 From: rsyring at inteli-com.com (Randy Syring) Date: Sat, 14 Nov 2009 01:44:52 -0500 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: <4eb0089f0906090651r40dc2c1ao8bc9791ded3f84b2@mail.gmail.com> References: <49F4278A.7010402@canterbury.ac.nz> <2d07a6f90904261510yd821f8aifc392e55674faae2@mail.gmail.com> <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> <4A2722F5.7020705@rcs-comp.com> <4A273073.4090500@canterbury.ac.nz> <4eb0089f0906090651r40dc2c1ao8bc9791ded3f84b2@mail.gmail.com> Message-ID: <4AFE51E4.5040108@inteli-com.com> Greg, I am still seeing the bug noted below in 2.1. Do you have plans to tackle it? Thanks. -------------------------------------- Randy Syring Intelicom 502-644-4776 "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 David Robinow wrote: > On Wed, Jun 3, 2009 at 10:24 PM, Greg Ewing wrote: > >> Randy Syring wrote: >> >>> I am wondering if the problems with build 213 have ever been resolved on >>> Windows. Or was I mistaken that build 213 was the problem? >>> >> I don't know. I haven't heard any more about it from >> anyone since then. >> >> Has anyone else out there that's having this problem >> successfully cured it by reverting to 212? >> >> If so, I could look into what's changed between 212 >> and 213 to see if it gives any clue to what's going >> on. >> >> > I have. The problem exists using Python 2.5.4 and Python 2.6.2 on > Windows XP Professional and Windows Vista Home Premium. > No problems with 212. See below for what happens using 213. Reverting > to 212 works fine. > > c:\home\PyGUI-2.0.5\Tests>\python26\python 12-scroll.py > Traceback (most recent call last): > File "12-scroll.py", line 38, in > win = TestWindow() > File "12-scroll.py", line 9, in __init__ > width = 300, height = 300, scrolling = 'hv') > File "c:\home\PyGUI-2.0.5\Tests\TestScrollableViews.py", line 16, in __init__ > ScrollableView.__init__(self, **kwds) > File "c:\home\PyGUI-2.0.5\GUI\Win32\ScrollableViews.py", ilne 31, in __init__ > GScrollableView.__init__(self, _win = win) > win32ui.error: The object has been destroyed. > > c:\home\PyGUI-2.0.5\Tests> > _______________________________________________ > 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 luis.kop at gmail.com Sat Nov 14 13:22:23 2009 From: luis.kop at gmail.com (Luis A. Bastiao Silva) Date: Sat, 14 Nov 2009 12:22:23 +0000 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4AFDE36C.2060901@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> Message-ID: <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> Hi, On Fri, Nov 13, 2009 at 10:53 PM, Greg Ewing wrote: > PyGUI 2.1 is available: > > http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > Highlights of this version: > > * Win32: > Fixed bug preventing PyGUI apps from working under pythonw > Fixed incorrect mouse coordinates in ScrollableView > Added more standard cursors > > * MacOSX: > Application menu now has working Hide, Hide Others and Show All > commands. > > Plus a few other bug fixes and improvements. > > > What is PyGUI? > -------------- > > PyGUI is a cross-platform GUI toolkit designed to be lightweight > and have a highly Pythonic API. > It seems a awesome project, wrapping others graphical interfaces. But it just works for application wroted from stratch, otherwise application wroted in pygtk need to be ported to work cross-platform. What are you wrapping in Win32? Windows API directly? > > -- > Gregory Ewing > greg.ewing at canterbury.ac.nz > http://www.cosc.canterbury.ac.nz/greg.ewing/ > _______________________________________________ > pygtk mailing list pygtk at daa.com.au > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://faq.pygtk.org/ > Anyway seems a good project, although it will be better have a pygtk cross platform :) Best Regards, -- Lu?s A. Basti?o Silva -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Sun Nov 15 06:42:43 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 15 Nov 2009 18:42:43 +1300 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: <4AFE51E4.5040108@inteli-com.com> References: <49F4278A.7010402@canterbury.ac.nz> <2d07a6f90904261510yd821f8aifc392e55674faae2@mail.gmail.com> <2d07a6f90904261516v37ee0e49r4c4d703ba575e79c@mail.gmail.com> <4A2722F5.7020705@rcs-comp.com> <4A273073.4090500@canterbury.ac.nz> <4eb0089f0906090651r40dc2c1ao8bc9791ded3f84b2@mail.gmail.com> <4AFE51E4.5040108@inteli-com.com> Message-ID: <4AFF94D3.9020401@canterbury.ac.nz> Randy Syring wrote: > I am still seeing the bug noted below in 2.1. Do you have plans to > tackle it? > >>win32ui.error: The object has been destroyed. Reportedly it can be worked around by reverting to build 212 of pywin32. I haven't had a chance to investigate what's causing it yet, sorry. -- Greg From greg.ewing at canterbury.ac.nz Sun Nov 15 06:52:55 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 15 Nov 2009 18:52:55 +1300 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> Message-ID: <4AFF9737.90407@canterbury.ac.nz> Luis A. Bastiao Silva wrote: > But it just works for application wroted from stratch, otherwise > application wroted in pygtk need to be ported to work cross-platform. It's already possible to run pygtk programs on all three platforms, if you're willing to install the required libraries. API compatibility with pygtk (or any other gui library) is not one of PyGUI's goals. > What are you wrapping in Win32? Windows API directly? Currently it uses the MFC layer of pywin32. I hope eventually to replace that with raw win32 via ctypes. > Anyway seems a good project, although it will be better have a pygtk > cross platform :) That's a matter of opinion. One of the major goals of PyGUI is to provide an API that doesn't suck. The pygtk API doesn't meet that requirement, IMO. -- Greg From greg.ewing at canterbury.ac.nz Sun Nov 15 22:17:11 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 16 Nov 2009 10:17:11 +1300 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4AFFB7B3.8080300@moeraki.com> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> Message-ID: <4B006FD7.40906@canterbury.ac.nz> John Finlay wrote: > Greg, > > Why do you post to mailing lists that are unrelated to your project? I > would appreciate it if in future you didn't post a message about your > project ot the PyGTK mailing list. I posted the announcement to the pyobjc, pygtk and pywin32 lists because PyGUI uses all of those libraries, and because I don't know of any single mailing list where people interested in Python GUIs in general can be found. However, if the consensus is that PyGUI announcements are not welcome on those lists, I will be happy to cease posting them there. What is the general feeling out there? Should I stop posting PyGUI messages to these lists? Is there another GUI-related list that would be more appropriate? -- Greg From vernondcole at gmail.com Sun Nov 15 22:47:30 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Sun, 15 Nov 2009 13:47:30 -0800 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 Message-ID: <4449817730188042653@unknownmsgid> Speaking for myself, I think your work is great and I have been planning to suggest that you enquire of Mark about inserting PyGUI into the pywin32 distribution. I feel that doing so was very good for adodbapi and would also make PyGUI much more accessible. I have been a wxpython user in the past. But find it too cumbersom and would prefer to use a simpler cross platform API, which is what PyGUI is all about. I tried the Windows version of PyGTK once, but finding all of the prerequisites for it was a nightmare. Of course, we would need to make sure PyGUI works with the current pywin32 first... -- Vernon Cole Sent from my Windows Mobile phone -----Original Message----- From: Greg Ewing Sent: Sunday, November 15, 2009 2:18 PM To: John Finlay Cc: PyObjC-Dev ; PyGtk ; python-win32 Subject: Re: [python-win32] [pygtk] ANN: PyGUI 2.1 John Finlay wrote: > Greg, > > Why do you post to mailing lists that are unrelated to your project? I > would appreciate it if in future you didn't post a message about your > project ot the PyGTK mailing list. I posted the announcement to the pyobjc, pygtk and pywin32 lists because PyGUI uses all of those libraries, and because I don't know of any single mailing list where people interested in Python GUIs in general can be found. However, if the consensus is that PyGUI announcements are not welcome on those lists, I will be happy to cease posting them there. What is the general feeling out there? Should I stop posting PyGUI messages to these lists? Is there another GUI-related list that would be more appropriate? -- Greg _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From aahz at pythoncraft.com Sun Nov 15 22:54:05 2009 From: aahz at pythoncraft.com (Aahz) Date: Sun, 15 Nov 2009 13:54:05 -0800 Subject: [python-win32] [Pyobjc-dev] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B006FD7.40906@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> Message-ID: <20091115215405.GA3895@panix.com> On Mon, Nov 16, 2009, Greg Ewing wrote: > John Finlay wrote: >> >> Why do you post to mailing lists that are unrelated to your project? I >> would appreciate it if in future you didn't post a message about your >> project ot the PyGTK mailing list. > > I posted the announcement to the pyobjc, pygtk and pywin32 > lists because PyGUI uses all of those libraries, and because > I don't know of any single mailing list where people interested > in Python GUIs in general can be found. I'm on both pyobjc and pywin32 lists, and I think PyGUI announcements are appropriate. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian W. Kernighan From finlay at moeraki.com Mon Nov 16 01:31:25 2009 From: finlay at moeraki.com (John Finlay) Date: Sun, 15 Nov 2009 16:31:25 -0800 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B006FD7.40906@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> Message-ID: <4B009D5D.6070702@moeraki.com> Greg Ewing wrote: > John Finlay wrote: > >> Greg, >> >> Why do you post to mailing lists that are unrelated to your project? I >> would appreciate it if in future you didn't post a message about your >> project ot the PyGTK mailing list. >> > > I posted the announcement to the pyobjc, pygtk and pywin32 > lists because PyGUI uses all of those libraries, and because > I don't know of any single mailing list where people interested > in Python GUIs in general can be found. > > However, if the consensus is that PyGUI announcements are > not welcome on those lists, I will be happy to cease posting > them there. > > What is the general feeling out there? Should I stop posting > PyGUI messages to these lists? Is there another GUI-related > list that would be more appropriate? > > Start your own list for the community that is interested in your project. John From rwupole at msn.com Mon Nov 16 08:57:48 2009 From: rwupole at msn.com (Roger Upole) Date: Mon, 16 Nov 2009 02:57:48 -0500 Subject: [python-win32] ANN: PyGUI 2.0.5 Message-ID: Greg Ewing wrote: > Randy Syring wrote: > >> I am still seeing the bug noted below in 2.1. Do you have plans to >> tackle it? > > >>>win32ui.error: The object has been destroyed. > > Reportedly it can be worked around by reverting to build > 212 of pywin32. I haven't had a chance to investigate > what's causing it yet, sorry. > > -- > Greg I looked at this a while ago, and have a good idea where the problem is. I'll try to get a fix in before the next build. BTW, posts about your project seem appropriate on the python-win32 mailing list to me, too. Roger From rsyring at inteli-com.com Mon Nov 16 14:46:24 2009 From: rsyring at inteli-com.com (Randy Syring) Date: Mon, 16 Nov 2009 08:46:24 -0500 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: References: Message-ID: <4B0157B0.9000503@inteli-com.com> Roger Upole wrote: > > I looked at this a while ago, and have a good idea where the > problem is. I'll try to get a fix in before the next build. > > BTW, posts about your project seem appropriate on the python-win32 > mailing list to me, too. > > Roger FWIW, I have also appreciated the posts about PyGUI to this list. -------------------------------------- Randy Syring Intelicom 502-644-4776 "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 From sturla at molden.no Mon Nov 16 15:13:12 2009 From: sturla at molden.no (Sturla Molden) Date: Mon, 16 Nov 2009 15:13:12 +0100 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4AFF9737.90407@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> Message-ID: <4B015DF8.8020002@molden.no> Greg Ewing skrev: > > That's a matter of opinion. One of the major goals of > PyGUI is to provide an API that doesn't suck. The > pygtk API doesn't meet that requirement, IMO. > The only GUI API that doesn't suck is no API at all. GUIs should be designed visually. What matters is the quality of the GUI designer. Sturla Molden From vernondcole at gmail.com Mon Nov 16 17:18:51 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 16 Nov 2009 08:18:51 -0800 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 Message-ID: <8614441363665379877@unknownmsgid> Strula: The GUI designer has to output code for some API or another. If it produces code for a cross platform GUI API then the resulting application will be cross platform. I would love to find one such that actually works and produces good code. Do you have any suggestions? -- Vernon Cole Sent from my Windows Mobile phone -----Original Message----- From: Sturla Molden Sent: Monday, November 16, 2009 7:13 AM To: python-win32 Subject: Re: [python-win32] [pygtk] ANN: PyGUI 2.1 Greg Ewing skrev: > > That's a matter of opinion. One of the major goals of > PyGUI is to provide an API that doesn't suck. The > pygtk API doesn't meet that requirement, IMO. > The only GUI API that doesn't suck is no API at all. GUIs should be designed visually. What matters is the quality of the GUI designer. Sturla Molden _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 From bp.tralfamadore at gmail.com Mon Nov 16 17:30:52 2009 From: bp.tralfamadore at gmail.com (billy pilgrim) Date: Mon, 16 Nov 2009 11:30:52 -0500 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <8614441363665379877@unknownmsgid> References: <8614441363665379877@unknownmsgid> Message-ID: <4B017E3C.6010209@gmail.com> Vernon, I am using wxFormBuilder and wxPython for a personal experimental project. They have just recently added Python code generation. So far, I'd recommend it -- the wx aspect is platform independent (I have used the C++ version of Windows/Linux) and am using it on Linux now. HTH. :bp: Vernon Cole wrote: > Strula: > The GUI designer has to output code for some API or another. If it > produces code for a cross platform GUI API then the resulting > application will be cross platform. I would love to find one such that > actually works and produces good code. > Do you have any suggestions? > -- > Vernon Cole > Sent from my Windows Mobile phone > > -----Original Message----- > From: Sturla Molden > Sent: Monday, November 16, 2009 7:13 AM > To: python-win32 > Subject: Re: [python-win32] [pygtk] ANN: PyGUI 2.1 > > > Greg Ewing skrev: > >> That's a matter of opinion. One of the major goals of >> PyGUI is to provide an API that doesn't suck. The >> pygtk API doesn't meet that requirement, IMO. >> >> > The only GUI API that doesn't suck is no API at all. > > GUIs should be designed visually. > > What matters is the quality of the GUI designer. > > > > > Sturla Molden > _______________________________________________ > 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 hwngnn at yahoo.com Mon Nov 16 19:27:55 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Mon, 16 Nov 2009 10:27:55 -0800 (PST) Subject: [python-win32] Python for Windows extensions In-Reply-To: References: Message-ID: <701579.64733.qm@web53410.mail.re2.yahoo.com> Hello, My name is Hung and have just joined this mailling list. I am currently working on a project involved Python and is evaluating whether or not we can use the Python for Windows extensions for our project. I would like to know if: 1) the extension works with Python 3k; how well what is the level of support of the extension for Python 3k, etc. Any known issues? 2) the extension works on Windows x64 platform. Any known issues running on this platform. I appreciate any comments and advices on the above questions. Thank you, Hung Nguyen. From timr at probo.com Mon Nov 16 19:46:23 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 16 Nov 2009 10:46:23 -0800 Subject: [python-win32] Python for Windows extensions In-Reply-To: <701579.64733.qm@web53410.mail.re2.yahoo.com> References: <701579.64733.qm@web53410.mail.re2.yahoo.com> Message-ID: <4B019DFF.2080403@probo.com> Hung Nguyen wrote: > My name is Hung and have just joined this mailling list. I am currently working on a project involved Python and is evaluating whether or not we can use the Python for Windows extensions for our project. I would like to know if: > > 1) the extension works with Python 3k; how well what is the level of support of the extension for Python 3k, etc. Any known issues? > > 2) the extension works on Windows x64 platform. Any known issues running on this platform. > Good questions. I can't address issue #1, but I can tell you that I've run both the 32-bit and 64-bit builds of Python 2 with the Win32 extensions on Vista 64 and Windows 7 64 without any problems. As a driver writer, I do many of my hardware diagnostics in Python, so it's something I rely on fairly heavily. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From vernondcole at gmail.com Mon Nov 16 19:49:14 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 16 Nov 2009 11:49:14 -0700 Subject: [python-win32] Python for Windows extensions In-Reply-To: <701579.64733.qm@web53410.mail.re2.yahoo.com> References: <701579.64733.qm@web53410.mail.re2.yahoo.com> Message-ID: Welcome, Hung: I tried answering this question on sourceforge, but your email address there does not work. :-( The short answer is: we think that it works for both python 3 and 64 bit. We test it on both. If you find a problem, report it here and we will try to help. -- Vernon Cole On Mon, Nov 16, 2009 at 11:27 AM, Hung Nguyen wrote: > Hello, > > My name is Hung and have just joined this mailling list. I am currently > working on a project involved Python and is evaluating whether or not we can > use the Python for Windows extensions for our project. I would like to know > if: > > 1) the extension works with Python 3k; how well what is the level of > support of the extension for Python 3k, etc. Any known issues? > > 2) the extension works on Windows x64 platform. Any known issues running on > this platform. > > I appreciate any comments and advices on the above questions. > > Thank you, > Hung Nguyen. > > > > > _______________________________________________ > 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 hwngnn at yahoo.com Mon Nov 16 20:04:18 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Mon, 16 Nov 2009 11:04:18 -0800 (PST) Subject: [python-win32] Python for Windows extensions In-Reply-To: References: <701579.64733.qm@web53410.mail.re2.yahoo.com> Message-ID: <447464.83042.qm@web53410.mail.re2.yahoo.com> Hi Vernon, Thank you for the prompt response. I am a little surprised that my email in sourceforge does not work. I will look at it. Back to the questions, again thank you for the short answer.?I am wondering if you have a "longer" answer? :) Another piece of information I am looking for is how mature the extension is in term of supporting python 3 and 64bit? Are you aware of any well known products that use the extension in general and on 64bit platform in particular? Hung. ________________________________ From: Vernon Cole To: Hung Nguyen Cc: python-win32 at python.org Sent: Mon, November 16, 2009 10:49:14 AM Subject: Re: [python-win32] Python for Windows extensions Welcome, Hung: ? I tried answering this question on sourceforge, but your email address there does not work. :-( The short answer is: we think that it works for both python 3 and 64 bit. We test it on both. If you find a problem, report it here and we will try to help. -- Vernon Cole On Mon, Nov 16, 2009 at 11:27 AM, Hung Nguyen wrote: Hello, > >My name is Hung and have just joined this mailling list. I am currently working on a project involved Python and is evaluating whether or not we can use the Python for Windows extensions for our project. I would like to know if: > >1) the extension works with Python 3k; how well what is the level of support of the extension for Python 3k, etc. Any known issues? > >2) the extension works on Windows x64 platform. Any known issues running on this platform. > >I appreciate any comments and advices on the above questions. > >Thank you, >Hung Nguyen. > > > > >_______________________________________________ >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 timr at probo.com Mon Nov 16 20:52:39 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 16 Nov 2009 11:52:39 -0800 Subject: [python-win32] Python for Windows extensions In-Reply-To: <447464.83042.qm@web53410.mail.re2.yahoo.com> References: <701579.64733.qm@web53410.mail.re2.yahoo.com> <447464.83042.qm@web53410.mail.re2.yahoo.com> Message-ID: <4B01AD87.3050809@probo.com> Hung Nguyen wrote: > > Back to the questions, again thank you for the short answer. I am > wondering if you have a "longer" answer? :) > > Another piece of information I am looking for is how mature the > extension is in term of supporting python 3 and 64bit? Are you aware > of any well known products that use the extension in general and on > 64bit platform in particular? Python itself has been running on 64-bit systems for quite a long time. There aren't likely to be issues there. And remember that the 64-bit Windows API is essentially identical to the 32-bit API. They're the same functions, in DLLs with the same names. As long as one has not done anything egregiously stupid, the conversion is mostly just a matter of recompiling with the cross-compiler. What I'm saying is that there really aren't any compelling reasons for it NOT to be solid. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cowdenj at gmail.com Mon Nov 16 18:59:43 2009 From: cowdenj at gmail.com (Jack Cowden) Date: Mon, 16 Nov 2009 11:59:43 -0600 Subject: [python-win32] IRTD Interface differences in Excel 2003 and Excel 2007 Message-ID: I am working with the RTD functions in excel using pythoncom and a some great sample code from Chris Nilsson. In Excel 2003 and 2007, I am able to create my python object via the IRTDServer com interface. Excel then passes a callback interface, IRTDServerEvents to my object. I hold on to that interface and callback using UpdateNotify to let Excel know that I have an update for it. Everything works fine in 2003, but the interface callback in 2007 fails with an obscure COM error.(below) Other than that it works fine 2007. IMO, if the typelib information were wrong, the IRTDServer interface would not work either. I have checked versions in the registry, typelibs, GUIDs, and security setting. All settings are correct. Even turned off multi-threaded calcs in 2007. Here are the code snippets that get the callback interface and hold on to it. I set up Excel and the COM Interfaces EXCEL_TLB_GUID = '{00020813-0000-0000-C000- 000000000046}' EXCEL_TLB_LCID = 0 EXCEL_TLB_MAJOR = 1 #EXCEL_TLB_MINOR = 4 #Excel 2003 EXCEL_TLB_MINOR = 6 #Excel 2007 via registry??? Is this correct? # Import the excel typelib to make sure we've got early-binding going on. gencache.EnsureModule(EXCEL_TLB_GUID, EXCEL_TLB_LCID, \ EXCEL_TLB_MAJOR, EXCEL_TLB_MINOR) logging.debug('Gencache') # Again, we feed in the Excel typelib as the source of these interfaces. universal.RegisterInterfaces(EXCEL_TLB_GUID, EXCEL_TLB_LCID, EXCEL_TLB_MAJOR, EXCEL_TLB_MINOR, ['IRtdServer','IRTDUpdateEvent']) ... _com_interfaces_ = ['IRtdServer'] _public_methods_ = ['ConnectData','DisconnectData','Heartbeat', 'RefreshData','ServerStart','ServerTerminate'] _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER ... >>>>>>>>>>>>>>>>>>>>>>>>>>> This gets called from excel to create the object def ServerStart(self, CallbackObject): """Excel has just created us... We take its callback for later, and set up shop.""" self.IsAlive = self.ALIVE if CallbackObject is None: raise COMException(desc='Excel did not provide a callback') #Check the uuid of IRTDServerEvent Interface rv = win32com.client.CLSIDToClass.HasClass('{A43788C1- D91B-11D3-8F39-00C04F3651B8}') logging.debug('Interface is good so far... %s', rv) logging.debug ('Callback is %s' % CallbackObject) #PyIDispatch object # Need to "cast" the raw PyIDispatch object to the IRTDUpdateEvent interface IRTDUpdateEventKlass = win32com.client.CLSIDToClass.GetClass ('{A43788C1-D91B-11D3-8F39-00C04F3651B8}') self.__callback = IRTDUpdateEventKlass(CallbackObject) self.__callbackRaw = CallbackObject ..... def SignalExcel(self): """Use the callback we were given to tell excel new data is available.""" logging.debug('Signalling Excel') if self.__callback is None: raise COMException(desc="Callback excel provided is Null") try: self.__callback.UpdateNotify() <-----------------------THIS IS WHERE IT FAILS IN Excel 2007 except Exception, why: logging.debug('Exception raised %s ' % Exception) raise COMException(desc=str(why)) finally: logging.debug('SignalExcel::Completed!!!!') ******************************************* With this error trace *********** Exception in thread Thread-471: Traceback (most recent call last): File "C:\Python26\Lib\threading.py", line 527, in __bootstrap_inner self.run() File "C:\Python26\Lib\threading.py", line 731, in run self.function(*self.args, **self.kwargs) File "C:\dev\python\ExcelRTD.py", line 391, in Update self.SignalExcel() File "C:\dev\python\ExcelRTD.py", line 151, in SignalExcel raise COMException(desc=str(why)) COMException: (None, "(-2147352567, 'Exception occurred.', (0, None, None, None, 0, 0), None)", None, -1) Thanks for your help. Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Nov 16 22:14:20 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 16 Nov 2009 13:14:20 -0800 Subject: [python-win32] IRTD Interface differences in Excel 2003 and Excel 2007 In-Reply-To: References: Message-ID: <4B01C0AC.1000606@probo.com> Jack Cowden wrote: > I am working with the RTD functions in excel using pythoncom and a > some great sample code from Chris Nilsson. In Excel 2003 and 2007, I > am able to create my python object via the IRTDServer com interface. > Excel then passes a callback interface, IRTDServerEvents to my > object. I hold on to that interface and callback using UpdateNotify > to let Excel know that I have an update for it. Everything works fine > in 2003, but the interface callback in 2007 fails with an obscure COM > error.(below) Other than that it works fine 2007. IMO, if the typelib > information were wrong, the IRTDServer interface would not work > either. > ... > Exception in thread Thread-471: > Traceback (most recent call last): > File "C:\Python26\Lib\threading.py", line 527, in __bootstrap_inner > self.run() > File "C:\Python26\Lib\threading.py", line 731, in run > self.function(*self.args, **self.kwargs) > File "C:\dev\python\ExcelRTD.py", line 391, in Update > self.SignalExcel() > File "C:\dev\python\ExcelRTD.py", line 151, in SignalExcel > raise COMException(desc=str(why)) > COMException: (None, "(-2147352567, 'Exception occurred.', (0, None, > None, None, 0, 0), None)", None, -1) For what it's worth, -2147352567 is 0x80020009 which is DISP_E_EXCEPTION. That could mean anything from a bad pointer to a math error to an unhandled C++ exception. Is your ServerStart returning a value greater than 0? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Mon Nov 16 22:29:12 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 17 Nov 2009 08:29:12 +1100 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B006FD7.40906@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> Message-ID: <4B01C428.3060304@gmail.com> On 16/11/2009 8:17 AM, Greg Ewing wrote: > John Finlay wrote: >> Greg, >> >> Why do you post to mailing lists that are unrelated to your project? I >> would appreciate it if in future you didn't post a message about your >> project ot the PyGTK mailing list. > > I posted the announcement to the pyobjc, pygtk and pywin32 > lists because PyGUI uses all of those libraries, and because > I don't know of any single mailing list where people interested > in Python GUIs in general can be found. > > However, if the consensus is that PyGUI announcements are > not welcome on those lists, I will be happy to cease posting > them there. > > What is the general feeling out there? Should I stop posting > PyGUI messages to these lists? Is there another GUI-related > list that would be more appropriate? FWIW, I've no objection to these posts on python-win32. Cheers, Mark From ronaldoussoren at mac.com Mon Nov 16 22:28:48 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 16 Nov 2009 22:28:48 +0100 Subject: [python-win32] [Pyobjc-dev] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B006FD7.40906@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> Message-ID: On 15 Nov, 2009, at 22:17, Greg Ewing wrote: > John Finlay wrote: >> Greg, >> >> Why do you post to mailing lists that are unrelated to your project? I >> would appreciate it if in future you didn't post a message about your >> project ot the PyGTK mailing list. > > I posted the announcement to the pyobjc, pygtk and pywin32 > lists because PyGUI uses all of those libraries, and because > I don't know of any single mailing list where people interested > in Python GUIs in general can be found. > > However, if the consensus is that PyGUI announcements are > not welcome on those lists, I will be happy to cease posting > them there. > > What is the general feeling out there? Should I stop posting > PyGUI messages to these lists? Is there another GUI-related > list that would be more appropriate? I (as the PyObjC maintainer) don't mind these announcements on the pyobjc list. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3567 bytes Desc: not available URL: From greg.ewing at canterbury.ac.nz Mon Nov 16 23:31:42 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Nov 2009 11:31:42 +1300 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B009D5D.6070702@moeraki.com> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> <4B009D5D.6070702@moeraki.com> Message-ID: <4B01D2CE.2050206@canterbury.ac.nz> John Finlay wrote: > Start your own list for the community that is interested in your project. That's not going to reach anyone who doesn't already know about it. It's probably a good idea for ongoing discussion, though. Any suggestions on the best way of going about it? I could start a Google Group, but I'd prefer a real mailing list server if possible. -- Greg From greg.ewing at canterbury.ac.nz Tue Nov 17 00:16:30 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Nov 2009 12:16:30 +1300 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <8614441363665379877@unknownmsgid> References: <8614441363665379877@unknownmsgid> Message-ID: <4B01DD4E.6000409@canterbury.ac.nz> Vernon Cole wrote: > If it > produces code for a cross platform GUI API then the resulting > application will be cross platform. I would love to find one such that > actually works and produces good code. Code produced by a GUI designer shouldn't be getting edited by humans, so the quality of the code is immaterial (as long as it works). -- Greg From greg.ewing at canterbury.ac.nz Tue Nov 17 00:41:27 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Nov 2009 12:41:27 +1300 Subject: [python-win32] ANN: PyGUI 2.0.5 In-Reply-To: References: Message-ID: <4B01E327.8010602@canterbury.ac.nz> Roger Upole wrote: > Greg Ewing wrote: >> Randy Syring wrote: >>> >>>> win32ui.error: The object has been destroyed. > > I looked at this a while ago, and have a good idea where the > problem is. I'll try to get a fix in before the next build. If it's because of the screwy things I'm doing to get a dummy PyCDocument, can I suggest that you fix it by providing a way to create a PyCScrollView without having to supply any PyCDocument at all? It seems to be entirely possible to do this at the MFC level, and in fact MFC doesn't even provide any way to supply a CDocument at creation time of a CScrollView. Pywin32 is currently going through unnatural contortions to support it. -- Greg From vernondcole at gmail.com Tue Nov 17 00:43:25 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 16 Nov 2009 16:43:25 -0700 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B01D2CE.2050206@canterbury.ac.nz> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4AFFB7B3.8080300@moeraki.com> <4B006FD7.40906@canterbury.ac.nz> <4B009D5D.6070702@moeraki.com> <4B01D2CE.2050206@canterbury.ac.nz> Message-ID: Often new version announcements (like the one Greg just sent) are cross posted to related groups. The traffic is not heavy and the service useful. As for ongoing discussions (good idea!), I would suggest http://www.python.org/community/lists/ from which I quote: To request a new list, send e-mail to postmaster @ python.org That's where the pywin32 group lives, and it works rather well. -- Vernon Cole On Mon, Nov 16, 2009 at 3:31 PM, Greg Ewing wrote: > > John Finlay wrote: > >> Start your own list for the community that is interested in your project. > > That's not going to reach anyone who doesn't already > know about it. > > It's probably a good idea for ongoing discussion, > though. Any suggestions on the best way of going > about it? I could start a Google Group, but I'd > prefer a real mailing list server if possible. > > -- > Greg > _______________________________________________ > 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 chris at slort.org Tue Nov 17 03:29:21 2009 From: chris at slort.org (Christopher Nilsson) Date: Tue, 17 Nov 2009 13:29:21 +1100 Subject: [python-win32] IRTD Interface differences in Excel 2003 and Excel 2007 In-Reply-To: References: Message-ID: <29a42920911161829u1b88326ode3d15b06e1004e9@mail.gmail.com> 2009/11/17 Jack Cowden : > I set up Excel and the COM Interfaces > > EXCEL_TLB_GUID = '{00020813-0000-0000-C000- > 000000000046}' > EXCEL_TLB_LCID = 0 > EXCEL_TLB_MAJOR = 1 > #EXCEL_TLB_MINOR = 4 #Excel 2003 > EXCEL_TLB_MINOR = 6 #Excel 2007 via registry??? Is this correct? > > # Import the excel typelib to make sure we've got early-binding going > on. Oh dear, I hard-coded those typelib version numbers, didn't I? Sorry. :) By the looks of the docs ([1] & [2]), the IRTDUpdateEvent.UpdateNotify hasn't changed -- wouldn't expect it to, though. It has been a while since I was able to play with this stuff, but you can confirm the version numbers with "makepy.py -i". There's probably a much nicer way for this to be done automatically via gencache now. > if self.__callback is None: > raise COMException(desc="Callback excel provided is Null") > try: > self.__callback.UpdateNotify() <-----------------------THIS > IS WHERE IT FAILS IN Excel 2007 > except Exception, why: Do you know if your RefreshData() routine gets called by Excel, before your UpdateNotify() returns? That would at least show UpdateNotify() is pointing at the right place. Unfortunately I don't have a copy of excel at the moment, so I can't check the order of events myself. - Chris. [1] Excel 2007 docs: http://msdn.microsoft.com/en-us/library/bb210024.aspx [2] Excel 2003 docs: http://msdn.microsoft.com/en-us/library/aa213639(office.11).aspx From greg.ewing at canterbury.ac.nz Tue Nov 17 00:10:27 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Nov 2009 12:10:27 +1300 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <4B015DF8.8020002@molden.no> References: <4AFDE36C.2060901@canterbury.ac.nz> <277c20420911140422g74ab5705u7b8ec130e4c46b9@mail.gmail.com> <4AFF9737.90407@canterbury.ac.nz> <4B015DF8.8020002@molden.no> Message-ID: <4B01DBE3.1040104@canterbury.ac.nz> Sturla Molden wrote: > The only GUI API that doesn't suck is no API at all. > > GUIs should be designed visually. There's a lot more to a GUI API than just specifying the layout. -- Greg From sturla at molden.no Tue Nov 17 13:16:09 2009 From: sturla at molden.no (Sturla Molden) Date: Tue, 17 Nov 2009 13:16:09 +0100 Subject: [python-win32] [pygtk] ANN: PyGUI 2.1 In-Reply-To: <8614441363665379877@unknownmsgid> References: <8614441363665379877@unknownmsgid> Message-ID: <4B029409.4060401@molden.no> Vernon Cole skrev: > Strula: > The GUI designer has to output code for some API or another. If it > produces code for a cross platform GUI API then the resulting > application will be cross platform. I would love to find one such that > actually works and produces good code. > Do you have any suggestions? > -- wxFormBuilder 3.1 beta (wxPython) or 3.0 (XRC + wxPython). My point is that the API doesn't really matter if it's automatically written using som sort of gui designer. Sturla From hwngnn at yahoo.com Tue Nov 17 17:24:24 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Tue, 17 Nov 2009 08:24:24 -0800 (PST) Subject: [python-win32] Python for Windows extensions In-Reply-To: <4B01AD87.3050809@probo.com> References: <701579.64733.qm@web53410.mail.re2.yahoo.com> <447464.83042.qm@web53410.mail.re2.yahoo.com> <4B01AD87.3050809@probo.com> Message-ID: <905887.17227.qm@web53406.mail.re2.yahoo.com> Sorry for the belated response. Your email somehow ended up in my Spam folder. My concern with 64bit platform derived from the fact that one software for 32bit might not work properly when recompile and run on 64bit system. There are work to be done to make sure that it work properly on 64bit and that might mean some code will need to be ported. Thanks?for your input. ________________________________ From: Tim Roberts To: Hung Nguyen ; Python-Win32 List Sent: Mon, November 16, 2009 11:52:39 AM Subject: Re: [python-win32] Python for Windows extensions Hung Nguyen wrote: > >Back to the questions, again thank you for the short answer.?I am wondering if you have a "longer" answer? :) > >Another piece of information I am looking for is how mature the extension is in term of supporting python 3 and 64bit? Are you aware of any well known products that use the extension in general and on 64bit platform in particular?? Python itself has been running on 64-bit systems for quite a long time.? There aren't likely to be issues there. And remember that the 64-bit Windows API is essentially identical to the 32-bit API.? They're the same functions, in DLLs with the same names.? As long as one has not done anything egregiously stupid, the conversion is mostly just a matter of recompiling with the cross-compiler. What I'm saying is that there really aren't any compelling reasons for it NOT to be solid. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hwngnn at yahoo.com Tue Nov 17 22:48:13 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Tue, 17 Nov 2009 13:48:13 -0800 (PST) Subject: [python-win32] Passing data to/from Python script Message-ID: <997105.47587.qm@web53404.mail.re2.yahoo.com> I am working on an application that has Python embeded into it to run Python scripts. Using the Python for Windows extension, what is the best way to pass data, potentially COM objects, back and?forth between the host application and the scripts. ? Any advices are welcomed. ? Thanks, Hung. -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Wed Nov 18 02:50:21 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 18 Nov 2009 12:50:21 +1100 Subject: [python-win32] Passing data to/from Python script In-Reply-To: <997105.47587.qm@web53404.mail.re2.yahoo.com> References: <997105.47587.qm@web53404.mail.re2.yahoo.com> Message-ID: <4B0352DD.4000103@gmail.com> On 18/11/2009 8:48 AM, Hung Nguyen wrote: > I am working on an application that has Python embeded into it to run > Python scripts. Using the Python for Windows extension, what is the best > way to pass data, potentially COM objects, back and forth between the > host application and the scripts. "Pass them as parameters?" Otherwise, you need to give more detail about the environment before I can answer more meaningfully. Cheers, Mark. From hwngnn at yahoo.com Wed Nov 18 03:05:19 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Tue, 17 Nov 2009 18:05:19 -0800 (PST) Subject: [python-win32] Passing data to/from Python script In-Reply-To: <4B0352DD.4000103@gmail.com> References: <997105.47587.qm@web53404.mail.re2.yahoo.com> <4B0352DD.4000103@gmail.com> Message-ID: <565248.3318.qm@web53405.mail.re2.yahoo.com> Hi Mark, To clarify the requirement: 1) The application is a C++, COM application that has CPython embeded in it. 2) There are some data elements, let say COM objects, in the application's process space 3) The application invoke a Python script that runs on the Python engine 4) The script needs to be able to operate upon the above COM objects, e.g. calling methods in the interfaces exposed by the COM objects. 5) The script needs to be able to instantiate COM objects and somehow pass them back to the application. Please let me know if you need further information. Thanks, Hung. ----- Original Message ---- From: Mark Hammond To: Hung Nguyen Cc: Python-Win32 List Sent: Tue, November 17, 2009 5:50:21 PM Subject: Re: [python-win32] Passing data to/from Python script On 18/11/2009 8:48 AM, Hung Nguyen wrote: > I am working on an application that has Python embeded into it to run > Python scripts. Using the Python for Windows extension, what is the best > way to pass data, potentially COM objects, back and forth between the > host application and the scripts. "Pass them as parameters?"? Otherwise, you need to give more detail about the environment before I can answer more meaningfully. Cheers, Mark. From mhammond at skippinet.com.au Wed Nov 18 03:13:23 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Wed, 18 Nov 2009 13:13:23 +1100 Subject: [python-win32] Passing data to/from Python script In-Reply-To: <565248.3318.qm@web53405.mail.re2.yahoo.com> References: <997105.47587.qm@web53404.mail.re2.yahoo.com> <4B0352DD.4000103@gmail.com> <565248.3318.qm@web53405.mail.re2.yahoo.com> Message-ID: <4B035843.4020501@skippinet.com.au> On 18/11/2009 1:05 PM, Hung Nguyen wrote: > Hi Mark, > > To clarify the requirement: > > 1) The application is a C++, COM application that has CPython embeded in it. > > 2) There are some data elements, let say COM objects, in the application's process space > > 3) The application invoke a Python script that runs on the Python engine > > 4) The script needs to be able to operate upon the above COM objects, e.g. calling methods in the interfaces exposed by the COM objects. > > 5) The script needs to be able to instantiate COM objects and somehow pass them back to the application. You are likely to need to link to (or load dynamically) some of the entry-points in pythoncomxx.dll - you will find functions for converting to and from COM objects via IDispatch etc pointers. For non COM objects you just use the CPython API. See pythoncom.h for more details... HTH, Mark > > Please let me know if you need further information. > > Thanks, > Hung. > > > > ----- Original Message ---- > From: Mark Hammond > To: Hung Nguyen > Cc: Python-Win32 List > Sent: Tue, November 17, 2009 5:50:21 PM > Subject: Re: [python-win32] Passing data to/from Python script > > On 18/11/2009 8:48 AM, Hung Nguyen wrote: >> I am working on an application that has Python embeded into it to run >> Python scripts. Using the Python for Windows extension, what is the best >> way to pass data, potentially COM objects, back and forth between the >> host application and the scripts. > > "Pass them as parameters?" Otherwise, you need to give more detail about the environment before I can answer more meaningfully. > > Cheers, > > Mark. > > > > From hwngnn at yahoo.com Wed Nov 18 19:13:31 2009 From: hwngnn at yahoo.com (Hung Nguyen) Date: Wed, 18 Nov 2009 10:13:31 -0800 (PST) Subject: [python-win32] Passing data to/from Python script In-Reply-To: <4B035843.4020501@skippinet.com.au> References: <997105.47587.qm@web53404.mail.re2.yahoo.com> <4B0352DD.4000103@gmail.com> <565248.3318.qm@web53405.mail.re2.yahoo.com> <4B035843.4020501@skippinet.com.au> Message-ID: <871018.45052.qm@web53406.mail.re2.yahoo.com> Thank you Mark. I will look at the .h file for more details as you suggested. However if you can elaborate a little bit more at a high level as how to pass a COM objects between host application and scripts, that would be of great help. Also, I am wondering if there's sample code doing stuff like that? Thanks, Hung. ----- Original Message ---- From: Mark Hammond To: Hung Nguyen Cc: Python-Win32 List Sent: Tue, November 17, 2009 6:13:23 PM Subject: Re: [python-win32] Passing data to/from Python script On 18/11/2009 1:05 PM, Hung Nguyen wrote: > Hi Mark, > > To clarify the requirement: > > 1) The application is a C++, COM application that has CPython embeded in it. > > 2) There are some data elements, let say COM objects, in the application's process space > > 3) The application invoke a Python script that runs on the Python engine > > 4) The script needs to be able to operate upon the above COM objects, e.g. calling methods in the interfaces exposed by the COM objects. > > 5) The script needs to be able to instantiate COM objects and somehow pass them back to the application. You are likely to need to link to (or load dynamically) some of the entry-points in pythoncomxx.dll - you will find functions for converting to and from COM objects via IDispatch etc pointers.? For non COM objects you just use the CPython API.? See pythoncom.h for more details... HTH, Mark > > Please let me know if you need further information. > > Thanks, > Hung. > > > > ----- Original Message ---- > From: Mark Hammond > To: Hung Nguyen > Cc: Python-Win32 List > Sent: Tue, November 17, 2009 5:50:21 PM > Subject: Re: [python-win32] Passing data to/from Python script > > On 18/11/2009 8:48 AM, Hung Nguyen wrote: >> I am working on an application that has Python embeded into it to run >> Python scripts. Using the Python for Windows extension, what is the best >> way to pass data, potentially COM objects, back and forth between the >> host application and the scripts. > > "Pass them as parameters?"? Otherwise, you need to give more detail about the environment before I can answer more meaningfully. > > Cheers, > > Mark. > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From arve.knudsen at gmail.com Wed Nov 18 21:56:48 2009 From: arve.knudsen at gmail.com (Arve Knudsen) Date: Wed, 18 Nov 2009 21:56:48 +0100 Subject: [python-win32] Unable to build against debug Python Message-ID: Hi I'm trying to install Python-Win32 from source in a debug-build of Python 2.6.4, by issuing this command: python_d .\setup.py install. It fails however, with this error: LINK : fatal error LNK1104: cannot open file 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? Thanks, Arve -------------- next part -------------- An HTML attachment was scrubbed... URL: From mhammond at skippinet.com.au Thu Nov 19 05:11:59 2009 From: mhammond at skippinet.com.au (Mark Hammond) Date: Thu, 19 Nov 2009 15:11:59 +1100 Subject: [python-win32] Passing data to/from Python script In-Reply-To: <871018.45052.qm@web53406.mail.re2.yahoo.com> References: <997105.47587.qm@web53404.mail.re2.yahoo.com> <4B0352DD.4000103@gmail.com> <565248.3318.qm@web53405.mail.re2.yahoo.com> <4B035843.4020501@skippinet.com.au> <871018.45052.qm@web53406.mail.re2.yahoo.com> Message-ID: <4B04C58F.3030108@skippinet.com.au> On 19/11/2009 5:13 AM, Hung Nguyen wrote: > Thank you Mark. I will look at the .h file for more details as you suggested. However if you can elaborate a little bit more at a high level as how to pass a COM objects between host application and scripts, that would be of great help. Also, I am wondering if there's sample code doing stuff like that? To pass one into Python you would do something like: PyObject *ob = PyCom_PyObjectFromIUnknown(pYourOb, IID_YOUR_OB, TRUE); PyObject *args = Py_BuildValue("iN", some_int, ob); // make the call with args. Note that if you are trying to use IDispatch, the object passed to the script will be a PyIDispatch - the script probably wants to wrap that using win32com.client.Dispatch to make it simple to use. And to get it back, something like: PyObject *ob; if (!PyArg_ParseTuple(args, "O", &ob)) return NULL; IYourInterface *pYourOb; if (!PyCom_InterfaceFromPyInstanceOrObject(ob, IID_YOUR_OB, (void **)&pYourOb)) return NULL; // pYourOb is ready to go with a *new* COM reference. HTH, Mark From theller at ctypes.org Thu Nov 19 08:01:17 2009 From: theller at ctypes.org (Thomas Heller) Date: Thu, 19 Nov 2009 08:01:17 +0100 Subject: [python-win32] Unable to build against debug Python In-Reply-To: References: Message-ID: Arve Knudsen schrieb: > Hi > > I'm trying to install Python-Win32 from source in a debug-build of Python > 2.6.4, by issuing this command: python_d .\setup.py install. It fails > however, with this error: LINK : fatal error LNK1104: cannot open file > 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? No. You must create a debug build by giving the '-g' or '--debug' flag to the build step, like this: python_d setup.py build -g install Thomas From ah.kode at gmail.com Thu Nov 19 08:58:12 2009 From: ah.kode at gmail.com (a h) Date: Thu, 19 Nov 2009 13:28:12 +0530 Subject: [python-win32] Passing c structure into Python script Message-ID: Hi all I want to know that how do I pass an C structure into python script. Actually my problem is 1. how do I call python script from C application ,in which I can pass C structure 2. how do I take that C structure into an python script actually i have to write an python script which take an C structure and using pyasn, it encode that structure and dump the encoded data. also please provide some code snippets. Thanks ah -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Thu Nov 19 09:03:23 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Thu, 19 Nov 2009 21:03:23 +1300 Subject: [python-win32] ANN: PyGUI 2.1.1 Message-ID: <4B04FBCB.6050704@canterbury.ac.nz> PyGUI 2.1.1 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ This is an emergency bugfix release to repair some major breakage in the gtk version. Also corrects some other problems. What is PyGUI? -------------- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing greg.ewing at canterbury.ac.nz http://www.cosc.canterbury.ac.nz/greg.ewing/ From gerdusvanzyl at gmail.com Thu Nov 19 12:46:09 2009 From: gerdusvanzyl at gmail.com (Gerdus van Zyl) Date: Thu, 19 Nov 2009 13:46:09 +0200 Subject: [python-win32] Passing c structure into Python script In-Reply-To: References: Message-ID: <91882ea90911190346s77c762b3y86eb588ee068caad@mail.gmail.com> Never done it myself but I would suggest writing the c struct to a temp file. Then call the python script using normal system call in C (http://en.wikipedia.org/wiki/System_%28C_standard_library%29) and read the temp file using struct module from python http://docs.python.org/library/struct.html Maybe somebody else has code snippet they can share? or better approach. On Thu, Nov 19, 2009 at 9:58 AM, a h wrote: > Hi all > > I want to know that how do I pass an C structure into python script. > Actually my problem is > 1. how do I call python script from C application ,in which I can pass C > structure > 2. how do I take that C structure into an python script > > actually i have to write an python script which take an C structure and > using pyasn, it encode that structure and dump the encoded data. > also please provide some code snippets. > > Thanks > ah > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From arve.knudsen at gmail.com Thu Nov 19 17:59:23 2009 From: arve.knudsen at gmail.com (Arve Knudsen) Date: Thu, 19 Nov 2009 17:59:23 +0100 Subject: [python-win32] Unable to build against debug Python In-Reply-To: References: Message-ID: On Thu, Nov 19, 2009 at 8:01 AM, Thomas Heller wrote: > Arve Knudsen schrieb: > > Hi > > > > I'm trying to install Python-Win32 from source in a debug-build of Python > > 2.6.4, by issuing this command: python_d .\setup.py install. It fails > > however, with this error: LINK : fatal error LNK1104: cannot open file > > 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? > > No. You must create a debug build by giving the '-g' or '--debug' > flag to the build step, like this: > > python_d setup.py build -g install > Thanks. Now I get another type of error: mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "build\lib.win32-2.6-pydebug\win32\odbc_d.pyd". The process cannot access the file because it is being used by another process. Arve -------------- next part -------------- An HTML attachment was scrubbed... URL: From arve.knudsen at gmail.com Thu Nov 19 18:00:18 2009 From: arve.knudsen at gmail.com (Arve Knudsen) Date: Thu, 19 Nov 2009 18:00:18 +0100 Subject: [python-win32] Unable to build against debug Python In-Reply-To: References: Message-ID: On Thu, Nov 19, 2009 at 5:59 PM, Arve Knudsen wrote: > On Thu, Nov 19, 2009 at 8:01 AM, Thomas Heller wrote: > >> Arve Knudsen schrieb: >> > Hi >> > >> > I'm trying to install Python-Win32 from source in a debug-build of >> Python >> > 2.6.4, by issuing this command: python_d .\setup.py install. It fails >> > however, with this error: LINK : fatal error LNK1104: cannot open file >> > 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? >> >> No. You must create a debug build by giving the '-g' or '--debug' >> flag to the build step, like this: >> >> python_d setup.py build -g install >> > > Thanks. Now I get another type of error: > > mt.exe : general error c101008d: Failed to write the updated manifest to > the resource of file "build\lib.win32-2.6-pydebug\win32\odbc_d.pyd". The > process cannot access the file because it is being used by another process. > I am building with Visual C++ 2008 on Windows 7 x64 btw. Arve -------------- next part -------------- An HTML attachment was scrubbed... URL: From theller at ctypes.org Thu Nov 19 18:30:17 2009 From: theller at ctypes.org (Thomas Heller) Date: Thu, 19 Nov 2009 18:30:17 +0100 Subject: [python-win32] Unable to build against debug Python In-Reply-To: References: Message-ID: Arve Knudsen schrieb: > On Thu, Nov 19, 2009 at 8:01 AM, Thomas Heller wrote: > >> Arve Knudsen schrieb: >> > Hi >> > >> > I'm trying to install Python-Win32 from source in a debug-build of Python >> > 2.6.4, by issuing this command: python_d .\setup.py install. It fails >> > however, with this error: LINK : fatal error LNK1104: cannot open file >> > 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? >> >> No. You must create a debug build by giving the '-g' or '--debug' >> flag to the build step, like this: >> >> python_d setup.py build -g install >> > > Thanks. Now I get another type of error: > > mt.exe : general error c101008d: Failed to write the updated manifest to the > resource of file "build\lib.win32-2.6-pydebug\win32\odbc_d.pyd". The process > cannot access the file because it is being used by another process. I cannot help with this error since I don't build pywin32 myself from source anymore. Thomas From timr at probo.com Thu Nov 19 18:40:51 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 19 Nov 2009 09:40:51 -0800 Subject: [python-win32] Passing c structure into Python script In-Reply-To: References: Message-ID: <4B058323.4010307@probo.com> a h wrote: > > I want to know that how do I pass an C structure into python script. > Actually my problem is > 1. how do I call python script from C application ,in which I can pass > C structure > 2. how do I take that C structure into an python script > > actually i have to write an python script which take an C structure > and using pyasn, it encode that structure and dump the encoded data. > also please provide some code snippets. The Python documentation actually covers this fairly well, and there are good samples on the web. It's not as complicated as you might think. Start here: http://www.python.org/doc/ and check the "Extending and Embedding" links. Basically, you end up creating an instance of the interpreter inside your application by calling Py_Initialize, then you pass it Python statements almost as if you were typing them at a command-line prompt. You'll have to do a certain amount of tedious work to convert the data in C structure into a Python object or list, but there are examples. Also, you can just pass your structure as a raw set of bytes, and use the "struct" module to parse the individual fields. If you are using C++, the Boost libraries contain a Python wrapper that make this almost painless. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From arve.knudsen at gmail.com Thu Nov 19 21:48:45 2009 From: arve.knudsen at gmail.com (Arve Knudsen) Date: Thu, 19 Nov 2009 21:48:45 +0100 Subject: [python-win32] Unable to build against debug Python In-Reply-To: References: Message-ID: On Thu, Nov 19, 2009 at 6:30 PM, Thomas Heller wrote: > Arve Knudsen schrieb: > > On Thu, Nov 19, 2009 at 8:01 AM, Thomas Heller > wrote: > > > >> Arve Knudsen schrieb: > >> > Hi > >> > > >> > I'm trying to install Python-Win32 from source in a debug-build of > Python > >> > 2.6.4, by issuing this command: python_d .\setup.py install. It fails > >> > however, with this error: LINK : fatal error LNK1104: cannot open file > >> > 'python26.lib'. Is this due to a bug in the Python-Win32 distribution? > >> > >> No. You must create a debug build by giving the '-g' or '--debug' > >> flag to the build step, like this: > >> > >> python_d setup.py build -g install > >> > > > > Thanks. Now I get another type of error: > > > > mt.exe : general error c101008d: Failed to write the updated manifest to > the > > resource of file "build\lib.win32-2.6-pydebug\win32\odbc_d.pyd". The > process > > cannot access the file because it is being used by another process. > > I cannot help with this error since I don't build pywin32 myself > from source anymore. Turns out it was due to my antivirus's (ESET) filesystem monitoring .. Arve -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Sat Nov 21 01:26:57 2009 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Sat, 21 Nov 2009 13:26:57 +1300 Subject: [python-win32] ANN: PyGUI Mailing List Message-ID: <4B0733D1.1030208@canterbury.ac.nz> There is now a mailing list for discussion of PyGUI: http://mail.python.org/mailman/listinfo/pygui What is PyGUI? -------------- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ -- Gregory Ewing greg.ewing at canterbury.ac.nz http://www.cosc.canterbury.ac.nz/greg.ewing/ This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. From theller at ctypes.org Sat Nov 21 13:28:30 2009 From: theller at ctypes.org (Thomas Heller) Date: Sat, 21 Nov 2009 13:28:30 +0100 Subject: [python-win32] ANN: PyGUI Mailing List In-Reply-To: <4B0733D1.1030208@canterbury.ac.nz> References: <4B0733D1.1030208@canterbury.ac.nz> Message-ID: Gregory Ewing schrieb: > There is now a mailing list for discussion of PyGUI: > > http://mail.python.org/mailman/listinfo/pygui Is the list available on gmane? -- Thanks, Thomas From greg.ewing at canterbury.ac.nz Sat Nov 21 22:19:58 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 22 Nov 2009 10:19:58 +1300 Subject: [python-win32] ANN: PyGUI Mailing List In-Reply-To: References: <4B0733D1.1030208@canterbury.ac.nz> Message-ID: <4B08597E.5070504@canterbury.ac.nz> Thomas Heller wrote: > Is the list available on gmane? Not yet, but I'll look into making it so. -- Greg From ahz001 at gmail.com Sun Nov 22 02:07:14 2009 From: ahz001 at gmail.com (Andrew Ziem) Date: Sat, 21 Nov 2009 18:07:14 -0700 Subject: [python-win32] SHEmptyRecycleBin error on Vista/7 Message-ID: Using Python 2.5.4 on Vista and Windows 7, I get a catastrophic failure with the same code that works on XP SP3 from win32com.shell import shell shell.SHEmptyRecycleBin(None, None, 0) com_error: (-2147418113, 'Catastrophic failure', None, None) In hex, this error is 8000ffff. I tried drive="c:\\" and running as admin. Best regards, Andrew From sharpblade1 at gmail.com Sun Nov 22 17:12:06 2009 From: sharpblade1 at gmail.com (sharpblade) Date: Sun, 22 Nov 2009 16:12:06 +0000 Subject: [python-win32] SHEmptyRecycleBin error on Vista/7 In-Reply-To: References: Message-ID: I think this error appears when you empty a recycle bin that is empty. I tried that code snippet and it gave me the same error, but when I actually put something in the recycle bin and then ran it again it went through fine without raising an exception. Tom On Sun, Nov 22, 2009 at 1:07 AM, Andrew Ziem wrote: > Using Python 2.5.4 on Vista and Windows 7, I get a catastrophic > failure with the same code that works on XP SP3 > > from win32com.shell import shell > shell.SHEmptyRecycleBin(None, None, 0) > > com_error: (-2147418113, 'Catastrophic failure', None, None) > In hex, this error is 8000ffff. > > I tried drive="c:\\" and running as admin. > > > Best regards, > Andrew > _______________________________________________ > 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 aahz at pythoncraft.com Mon Nov 23 23:51:28 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 23 Nov 2009 14:51:28 -0800 Subject: [python-win32] Open files, round 2 Message-ID: <20091123225128.GA22800@panix.com> I'm having some problems with Tim Golden's file_handles.py [*] (details below), and it occurs to me that perhaps I should start over and express my requirement more broadly and see if someone has a more "Windows appropriate" solution: all I really care about is, given a specific filepath, whether any other program is currently using the file. This would work: h = win32file.CreateFile(fname, win32file.GENERIC_READ, 0, None, win32file.OPEN_EXISTING, win32file.FILE_FLAG_NO_BUFFERING, None) but I would prefer not to create an exclusive lock, even temporarily. Suggestions? There are two problems I'm having with file_handles.py: * It's not returning all open files; for example, it doesn't list this: >>> f = open(r'\tmp\x.txt') * The threading code is not set up for re-use (i.e. each call to main() creates 20 threads and never releases any) In trying to fix the second problem, changing the threading setup gives zero "File" results. In looking over our old open file handle .EXE, I realized that it uses a special driver called "ListOpenedFileDrv.sys" and that's the source of AVG flagging our .EXE as malware. I have no idea what calls the .SYS uses to get open files. [*] http://winsys.googlecode.com/svn/trunk/random/file_handles.py -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. From greg.ewing at canterbury.ac.nz Tue Nov 24 00:13:38 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 24 Nov 2009 12:13:38 +1300 Subject: [python-win32] RichEditCtrl scrolling doesn't work properly Message-ID: <4B0B1722.3040702@canterbury.ac.nz> I'm trying to create a PyRichEditCtrl with scroll bars. I can get scroll bars to appear using the appropriate style flags in CreateWindow, but they don't entirely work. Clicking on the scrolling arrows causes the text to scroll, but the position of the thumb doesn't get updated to match. Can anyone point me to a piece of example code that shows the minimum necessary steps to get this to work? I've looked at the editor example that comes with pywin32, but the details are hidden under several layers of abstraction, making it hard to tell what's essential. Also, it seems to use a RichEditView/RichEditDoc combination instead of a RichEditCtrl. Does this make a difference? Is it possible to get a plain RichEditCtrl to scroll properly, or do I need to use a RichEditView? The code I'm currently using looks like this: import win32con as wc, win32ui as ui win_style = wc.ES_MULTILINE | wc.ES_WANTRETURN win = ui.CreateRichEditCtrl() win.CreateWindow(win_style, (0, 0, 100, 100), parent_win, 0) flags = 0 if 'h' in scrolling: flags |= wc.WS_HSCROLL if 'v' in scrolling: flags |= wc.WS_VSCROLL win.ModifyStyle(0, flags) win.ShowWindow() -- Greg From jsunnya at gmail.com Tue Nov 24 01:16:01 2009 From: jsunnya at gmail.com (Jisun lee) Date: Tue, 24 Nov 2009 09:16:01 +0900 Subject: [python-win32] com object in python Message-ID: <1c9328050911231616m3cd7e908k972a537f11b2e694@mail.gmail.com> Hello, all I tested a python script using win32com and VC++, but I have some problem to use interfaces from my python code to VC++. -mypython code- import pythoncom ? IID_IShowMeDoDemo = pythoncom.MakeIID("{5104D21B-5756-4ABA-8632-B386C283CCC3}") _reg_clsid_ = "{12AECA5C-C50A-4f01-8CFB-CE5FC9FE16C1}" _reg_libname = "ShowMeDoDemo Typelib" class ShowMeDoDemo: _public_methods_ = ['SFactorial','SHello'] _reg_progid_ = "ShowMeDo.Demo1" _reg_clsid_ = "{5BA13EC0-8FCC-4d1b-ABED-AE52B2C8DBE3}" def SHello(self): "say Hello" return "Hello World" def SFactorial(self,n): "calculate n!" result = 1 for value in range(2,n+1): result = result * value return result if __name__ == "__main__": print "Registering COM server..." import win32com.server.register win32com.server.register.UseCommandLine(ShowMeDoDemo) and I succeed Registering of this COM object and found its information with OLE/VIEW ? named ShowMeDo.Demo1 under python COM Server folder(object classes) I read a posted message from bbs regarding ?Typelib python COM Server? so, I wrote a .IDL file in hand as the instruction. import "oaidl.idl"; import "ocidl.idl"; [ //below uuid is for type library COMTESTLib uuid(12AECA5C-C50A-4f01-8CFB-CE5FC9FE16C1), version(1.0), helpstring("showMeDoDemo Typelib") ] library ShowmeDoLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); //dispinterface IShowMeDoDemo; [ object, // below uuid is for Interface uuid(5104D21B-5756-4ABA-8632-B386C283CCC3), dual, helpstring("IClient Interface"), pointer_default(unique) ] //methods of Client class //interface IShowMeDoDemo : IDispatch interface IShowMeDoDemo : IUnknown { // import "UNKNWN.IDL"; //[out] BSTR cmd [id(1100), helpstring("method Hello")] HRESULT SHello([out, retval] BSTR* message); //([in] BSTR cmd); [id(1101), helpstring("method Factorial")] HRESULT SFactorial([in] int fn, [retval,out] int* rfn); }; [ //below uuid is CLISD of Search.dll uuid(5BA13EC0-8FCC-4d1b-ABED-AE52B2C8DBE3), helpstring("ShowMeDoDemo Class") ] // class of Search.dll coclass ShowMeDoDemo { // interfaces of class Client generated by Search.dll [default] interface IShowMeDoDemo; }; }; Then I executed ?MILD? in VC98 and got some files names ?xx.h? and ?xx_i.c?and tlb etc. So, I generated a VC++ project to call the instance with those. Even I succeed to compile but when I execute the result, it shows ?interface error? which called by hr==E_NOINSTANCE after queryinterface(). Do I miss anything or did something wrong? Why can't I access interfaces of my python code from VC++? Is there any way to call and use the ?xxx.dll? file in python to VC. I?d like to use my python methods with only ?dll? in C/C++ (Not Extending python code to C since my purpose is providing my module to VC user without exposing my code) I expect any advice or a breakthrough from you all. I really appreciate with your attention and help. Best, Ji -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Nov 24 01:49:12 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 23 Nov 2009 16:49:12 -0800 Subject: [python-win32] com object in python In-Reply-To: <1c9328050911231616m3cd7e908k972a537f11b2e694@mail.gmail.com> References: <1c9328050911231616m3cd7e908k972a537f11b2e694@mail.gmail.com> Message-ID: <4B0B2D88.6030607@probo.com> Jisun lee wrote: > > > > Then I executed ?MILD? in VC98 and got some files names ?xx.h? and > ?xx_i.c? and tlb etc. > > So, I generated a VC++ project to call the instance with those. > > Even I succeed to compile but when I execute the result, it shows > ?interface error? which called by hr==E_NOINSTANCE after queryinterface(). > Right. The issue here is early vs late binding. Did you notice that nowhere, in your code, did you ever say that it should USE the interface ID you created? Your code doesn't actually implement your interface. Pythoncom uses "late" binding, which means it only implements IDispatch. Applications use the IDispatch interface to call the services that you provide. Pythoncom does not actually create a complete C++ object that implements all of your interfaces -- that would be too hard. Applications like Excel and VB expect to use late binding to access objects, so they would work. With C++, you have to write specific code to use IDispatch. What you expected can be done, using a lower-level interface like "comtypes", but it's a lot more work. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From aahz at pythoncraft.com Tue Nov 24 03:00:24 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 23 Nov 2009 18:00:24 -0800 Subject: [python-win32] Open files, round 2 In-Reply-To: <20091123225128.GA22800@panix.com> References: <20091123225128.GA22800@panix.com> Message-ID: <20091124020024.GA23531@panix.com> On Mon, Nov 23, 2009, Aahz wrote: > > I'm having some problems with Tim Golden's file_handles.py [*] (details > below), and it occurs to me that perhaps I should start over and express > my requirement more broadly and see if someone has a more "Windows > appropriate" solution: all I really care about is, given a specific > filepath, whether any other program is currently using the file. > > This would work: > > h = win32file.CreateFile(fname, win32file.GENERIC_READ, 0, None, > win32file.OPEN_EXISTING, win32file.FILE_FLAG_NO_BUFFERING, None) > > but I would prefer not to create an exclusive lock, even temporarily. > Suggestions? Okay, because of the following page (plus supporting material found elsewhere), it seems clear that in order to find open files, you need a device driver to access kernel structures, so I just switched to using CreateFile() and so far that seems to be working. http://www.codeproject.com/KB/shell/OpenedFileFinder.aspx -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. From niki at vintech.bg Tue Nov 24 12:17:21 2009 From: niki at vintech.bg (niki) Date: Tue, 24 Nov 2009 13:17:21 +0200 Subject: [python-win32] Open files, round 2 In-Reply-To: <20091124020024.GA23531@panix.com> References: <20091123225128.GA22800@panix.com> <20091124020024.GA23531@panix.com> Message-ID: <4B0BC0C1.1020706@vintech.bg> Aahz wrote: >> h = win32file.CreateFile(fname, win32file.GENERIC_READ, 0, None, >> win32file.OPEN_EXISTING, win32file.FILE_FLAG_NO_BUFFERING, None) >> I used OPEN_FOR_DELETE to do similar test. regards, Niki From newsuser at stacom-software.de Tue Nov 24 16:05:55 2009 From: newsuser at stacom-software.de (Alexander Eisenhuth) Date: Tue, 24 Nov 2009 16:05:55 +0100 Subject: [python-win32] pywintypes.com_error: -2147417846 "Application busy" Message-ID: <4B0BF653.1090806@stacom-software.de> Hello list, I'm having a problem with a python COM Excel client that rarely gets the exception pywintypes.com_error with the error code -2147417846. (means Excel is busy) Here the python code of the exception handling: [...] try: # write a excel cell [...] except pywintypes.com_error, ex: if ex[0] == -2147417846: time.sleep(1.0) # retry write? [...] My first approach was to retry the writing to the excel cell. But that ends in a hanging Excel application (probably a deadlock). After a little research I found this post: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/70ef972b-51b6-4ece-a4af-d6b4e111eea5 "[...] If you don't register a MessageFilter yourself (by calling CoRegisterMessageFilter), you will get default behavior which will be to fail the call if it gets rejected. .Net converts the failure HRESULT to an exception. To deal with the possibility of the server being busy when you try to call, you need to implement IMessageFilter::RetryRejectedCall in your client code and also register the message filter. In most cases, you will just need to wait for a few seconds and then retry the call--generally that will be sufficient time to enable Word to finish whatever it is doing so it can handle your call. However, if the instance of Word that you are controlling could possibly visible, you might want to add additional logic to display the OLEUIBUSY dialog after some amount of time has passed to notify the user that you are waiting on Word to do something and give them the opportunity to help the process. For example, as Misha mentions, Word will reject all incoming calls if a modal dialog box is up. Therefore, in that situation, you would be blocked indefinitely until the dialog is dismissed. [...]" As this part of the COM API (IMessageFilter, CoRegisterMessageFilter) isn't included in pywin32 I don't see a possibility to do that, or? Did anybody else have to deal with that problem? Any hints are very welcome. Regards Alexander From theller at ctypes.org Wed Nov 25 16:38:27 2009 From: theller at ctypes.org (Thomas Heller) Date: Wed, 25 Nov 2009 16:38:27 +0100 Subject: [python-win32] pywintypes.com_error: -2147417846 "Application busy" In-Reply-To: <4B0BF653.1090806@stacom-software.de> References: <4B0BF653.1090806@stacom-software.de> Message-ID: Alexander Eisenhuth schrieb: > Hello list, > > I'm having a problem with a python COM Excel client that rarely gets the > exception pywintypes.com_error with the error code -2147417846. (means Excel is > busy) Here the python code of the exception handling: > > [...] > try: > # write a excel cell > [...] > except pywintypes.com_error, ex: > if ex[0] == -2147417846: > time.sleep(1.0) > # retry write? > [...] > > My first approach was to retry the writing to the excel cell. But that ends in a > hanging Excel application (probably a deadlock). > > After a little research I found this post: > > http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/70ef972b-51b6-4ece-a4af-d6b4e111eea5 > > "[...] If you don't register a MessageFilter yourself (by calling > CoRegisterMessageFilter), you will get default behavior which will be to fail > the call if it gets rejected. .Net converts the failure HRESULT to an > exception. To deal with the possibility of the server being busy when you try > to call, you need to implement IMessageFilter::RetryRejectedCall in your client > code and also register the message filter. In most cases, you will just need to > wait for a few seconds and then retry the call--generally that will be > sufficient time to enable Word to finish whatever it is doing so it can handle > your call. However, if the instance of Word that you are controlling could > possibly visible, you might want to add additional logic to display the > OLEUIBUSY dialog after some amount of time has passed to notify the user that > you are waiting on Word to do something and give them the opportunity to help > the process. For example, as Misha mentions, Word will reject all incoming > calls if a modal dialog box is up. Therefore, in that situation, you would be > blocked indefinitely until the dialog is dismissed. [...]" > > As this part of the COM API (IMessageFilter, CoRegisterMessageFilter) isn't > included in pywin32 I don't see a possibility to do that, or? If it is really possible to do this on the client side, you can try to implement the message filter and call CoRegisterMessageFilter with comtypes. > Did anybody else have to deal with that problem? Yes, we had this in our company with MFC applications. Fortunately, these were our own and we 'fixed' them by implementing a message filter inside the applications, on the server side. -- Thomas From aahz at pythoncraft.com Wed Nov 25 22:51:34 2009 From: aahz at pythoncraft.com (Aahz) Date: Wed, 25 Nov 2009 13:51:34 -0800 Subject: [python-win32] Open files, round 2 In-Reply-To: <4B0BC0C1.1020706@vintech.bg> References: <20091123225128.GA22800@panix.com> <20091124020024.GA23531@panix.com> <4B0BC0C1.1020706@vintech.bg> Message-ID: <20091125215134.GA1767@panix.com> On Tue, Nov 24, 2009, niki wrote: > Aahz wrote: > >>> h = win32file.CreateFile(fname, win32file.GENERIC_READ, 0, None, >>> win32file.OPEN_EXISTING, win32file.FILE_FLAG_NO_BUFFERING, None) > > I used OPEN_FOR_DELETE to do similar test. Thanks! Made note. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The best way to get information on Usenet is not to ask a question, but to post the wrong information. From tim.fulcher at bt.com Thu Nov 26 09:18:20 2009 From: tim.fulcher at bt.com (tim.fulcher at bt.com) Date: Thu, 26 Nov 2009 08:18:20 +0000 Subject: [python-win32] recording GUI events for playback (Java application) Message-ID: <5FA553D9DA3AAF40B6915427286B27B5F59EA04D23@RDW083V001RVA1.domain1.systemhost.net> Hi I'm looking to automate driving a sequence of steps of an application running on windows. I'm looking at pywinauto as a possible mechanism which maybe can do what I need. But what I'd really like is a record facility that could capture the events so I can glean how to write the necessary steps. Is there such a thing out there? Here's the kicker though - the app I want to drive is java based. I'm actually wondering if this approach will work at all - for example despite connecting to the process with a pywinauto script I couldn't seem to get to the menu structure. Beause its running in a JVM does it make all the UI interaction opaque from windows ? Thanks Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Sun Nov 29 00:13:51 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 29 Nov 2009 12:13:51 +1300 Subject: [python-win32] ANN: PyGUI Mailing List In-Reply-To: References: <4B0733D1.1030208@canterbury.ac.nz> Message-ID: <4B11AEAF.4080508@canterbury.ac.nz> Thomas Heller wrote: > Is the list available on gmane? I have received a reply from gmane saying that a subscription request has been sent and that the gmane group would be created when the first message arrives. I'm not a gmane user myself, so someone may want to take a look over there and see if it's working. -- Greg From greg.ewing at canterbury.ac.nz Sun Nov 29 00:15:02 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Sun, 29 Nov 2009 12:15:02 +1300 Subject: [python-win32] ANN: PyGUI Mailing List In-Reply-To: References: <4B0733D1.1030208@canterbury.ac.nz> Message-ID: <4B11AEF6.9090203@canterbury.ac.nz> Thomas Heller wrote: > Is the list available on gmane? I have received a reply from gmane saying that a subscription request has been sent and that the gmane group would be created when the first message arrives. I'm not a gmane user myself, so someone may want to take a look over there and see if it's working. -- Greg From vernondcole at gmail.com Sun Nov 29 03:34:48 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Sat, 28 Nov 2009 19:34:48 -0700 Subject: [python-win32] Poll: split of adodbapi.py into two modules? (django support) Message-ID: This is a feature poll. It will be cross posted on both the IronPython and pyWin32 groups. Please answer if you have strong feelings either way on this.... Introduction: I am now working on a new version (2.3.0) of adodbapi which is intended to have all of the features needed to interoperate with django. This should be a significant step forward to two projects: 1) MS SQL database support for django. 2) running django on IronPython. As the old saying goes: "Killing two birds with one stone." I order to accomplish this, I am taking some of the significant changes made to an earlier (non-IronPython) version of adodbapi and merging them into the current (IronPython compatible) version. This includes the changes needed to make adodbapi work with 'format' paramstyle, which django expects, as an option to the native 'qmark' paramstyle. In performing this Hurculan labor, Adam Vandenberg made some badly needed cleanups to the code. His work makes the module much more readable and easier to understand. Thank you, Adam! One of the changes Adam made was to remove dozens of lines defining various ADO constants from adodbapi.py and place them in another file, ado_consts.py. I really like the change, both because it takes the bloat out of adodbapi, and it makes the constants accessible to other uses: >>> ado_consts.adLongVarWChar 203 >>> ado_consts.ado_type_name(203) 'adLongVarWChar' >>> This will break code which expects some of these constants to be attributes of adodbapi, such as 'adUseClient' and 'adXactBrowse'. Question: Should I proceed to use the separate version of ado_consts, even though it might break some existing programs? -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From gradoj at gmail.com Fri Nov 27 21:34:11 2009 From: gradoj at gmail.com (Joe Grado) Date: Fri, 27 Nov 2009 13:34:11 -0700 Subject: [python-win32] Write to address on PhysicalDisk Message-ID: <3b8ceb5a0911271234k2dd7b5aeif0f381a049a33871@mail.gmail.com> I am trying to zero an entire usb drive including the boot sector. The code below works perfect but if I try to open the drive in write mode(wb) then I get this error message: IOError: [Errno 2] No such file or directory: u'\\\\.\\PHYSICALDRIVE1' Code: Select all import binascii import wmi c = wmi.WMI () for physical_disk in c.Win32_DiskDrive (InterfaceType='USB'): for partition in physical_disk.associators ("Win32_DiskDriveToDiskPartition"): for logical_disk in partition.associators ("Win32_LogicalDiskToPartition"): print physical_disk.Caption, partition.Caption, logical_disk.Caption f = open(physical_disk.DeviceID, 'rb') f.seek(0) mbr = f.read(512) f.close() Any ideas? Thanks. From timr at probo.com Sun Nov 29 06:55:08 2009 From: timr at probo.com (Tim Roberts) Date: Sat, 28 Nov 2009 21:55:08 -0800 Subject: [python-win32] Write to address on PhysicalDisk Message-ID: <200911290555.nAT5t8O04928@probo.probo.com> You wrote: > >I am trying to zero an entire usb drive including the boot sector. The >code below works perfect but if I try to open the drive in write >mode(wb) then I get this error message: > >IOError: [Errno 2] No such file or directory: u'\\\\.\\PHYSICALDRIVE1' Are you running as administrator? And which operating system? On Windows 7, Microsoft has changed the rules so that you can no longer write to a physical drive at all from user mode. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nytrokiss at gmail.com Sun Nov 29 07:56:18 2009 From: nytrokiss at gmail.com (James Matthews) Date: Sun, 29 Nov 2009 01:56:18 -0500 Subject: [python-win32] ANN: PyGUI Mailing List In-Reply-To: <4B11AEF6.9090203@canterbury.ac.nz> References: <4B0733D1.1030208@canterbury.ac.nz> <4B11AEF6.9090203@canterbury.ac.nz> Message-ID: <8a6b8e350911282256h6851cfdr34edfe4ff61ac2a2@mail.gmail.com> There are quite a few people that use Gmane. I am a bit of a user (slowly getting used to it) and it shouldn't be much of an issue. On Sat, Nov 28, 2009 at 6:15 PM, Greg Ewing wrote: > Thomas Heller wrote: > > Is the list available on gmane? >> > > I have received a reply from gmane saying that a subscription > request has been sent and that the gmane group would be > created when the first message arrives. > > I'm not a gmane user myself, so someone may want to take a > look over there and see if it's working. > > -- > Greg > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -- http://www.goldwatches.com -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From chef at ghum.de Sun Nov 29 10:40:03 2009 From: chef at ghum.de (Massa, Harald Armin) Date: Sun, 29 Nov 2009 10:40:03 +0100 Subject: [python-win32] Poll: split of adodbapi.py into two modules? (django support) In-Reply-To: References: Message-ID: Vernon, > > accessible to other uses: > ?? >>> ado_consts.adLongVarWChar > ?? 203 > ?? >>> ado_consts.ado_type_name(203) > ?? 'adLongVarWChar' > ?? >>> > > This will break code which expects some of these constants to be attributes > of adodbapi, such as 'adUseClient' and 'adXactBrowse'. that does not have to be this way. a) You can import those consts into the adodbapi-namespace per default, and they will be available from that module adodbapi.py: ... import * from ado_consts or b) anybody who needs it can put this line into adodbapi.py ... I am sure there are more ways to provide a smooth transition. BEst wishes, Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - %s is too gigantic of an industry to bend to the whims of reality From greg.ewing at canterbury.ac.nz Mon Nov 30 09:08:53 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 30 Nov 2009 21:08:53 +1300 Subject: [python-win32] PyCPrintDialog - Is it any use? Message-ID: <4B137D95.4000205@canterbury.ac.nz> The PyCPrintDialog in pywin32 doesn't seem to have any methods or attributes. How are you supposed to get information out of it? -- Greg From greg.ewing at canterbury.ac.nz Mon Nov 30 10:03:27 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 30 Nov 2009 22:03:27 +1300 Subject: [python-win32] PyCPrintDialog - Is it any use? Message-ID: <4B138A5F.4090401@canterbury.ac.nz> The PyCPrintDialog in pywin32 doesn't seem to have any methods or attributes. How are you supposed to get information out of it? -- Greg From timr at probo.com Mon Nov 30 19:58:46 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 30 Nov 2009 10:58:46 -0800 Subject: [python-win32] recording GUI events for playback (Java application) In-Reply-To: <5FA553D9DA3AAF40B6915427286B27B5F59EA04D23@RDW083V001RVA1.domain1.systemhost.net> References: <5FA553D9DA3AAF40B6915427286B27B5F59EA04D23@RDW083V001RVA1.domain1.systemhost.net> Message-ID: <4B1415E6.5020506@probo.com> tim.fulcher at bt.com wrote: > > I?m looking to automate driving a sequence of steps of an application > running on windows. I?m looking at pywinauto as a possible mechanism > which maybe can do what I need. But what I?d really like is a record > facility that could capture the events so I can glean how to write the > necessary steps. Is there such a thing out there? Not in Python. In order to record window events, you need to "hook" the window procedure for the window you want to monitor. Hooking is low-level code that requires you to inject a DLL into another processes memory space. Do you have the Windows Platform SDK? It includes a tool called "spyxx" that lets you monitor all of the window messages destined for a particular window or process. Very handy for this kind of thing. Borland had their own version called "winspector"; I see there is a shareware tool of the same now, although I couldn't get to their web site to check it out. > Here?s the kicker though ? the app I want to drive is java based. I?m > actually wondering if this approach will work at all ? for example > despite connecting to the process with a pywinauto script I couldn?t > seem to get to the menu structure. Beause its running in a JVM does it > make all the UI interaction opaque from windows ? That depends. At the root of whatever UI framework might be piled on top, they're all just windows, and they handle standard window messages. However, some applications re-invent the standard Windows UI components using their own custom implementations. For example, if you bring up Microsoft Word and poke at it with "spyxx", you'll see that, even though it looks like tool bars and status bars and a rich text control with a standard scrollbar, all you see externally is an empty canvas. Word draws all of the UI components by hand. I do not know whether the Java UI toolkits do the same thing or not. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gradoj at gmail.com Mon Nov 30 20:00:02 2009 From: gradoj at gmail.com (Joe Grado) Date: Mon, 30 Nov 2009 12:00:02 -0700 Subject: [python-win32] Write to address on PhysicalDisk In-Reply-To: <200911290555.nAT5t8O04928@probo.probo.com> References: <200911290555.nAT5t8O04928@probo.probo.com> Message-ID: <3b8ceb5a0911301100s660a332mcf9967dd850ab62b@mail.gmail.com> It appears you need to use the win32 interface for write access to physical drives. CAUTION: This code writes over the first sector of a USB drive. for physical_disk in c.Win32_DiskDrive (Index=1,InterfaceType='USB'): sector_size = int(physical_disk.BytesPerSector) total_sectors = int(physical_disk.TotalSectors) fill_value = 0 # create an array of bytes used to write to the drive fill = array.array('B') for num in xrange(sector_size): fill.append(fill_value) h = win32file.CreateFile(physical_disk.DeviceID, win32con.GENERIC_WRITE, 0, None, win32file.OPEN_EXISTING, win32file.FILE_ATTRIBUTE_NORMAL, None) err_code, num_written = win32file.WriteFile(h, fill, None) # close the file for clean exit win32file.CloseHandle(h) Thanks for the help. From planders at gmail.com Mon Nov 30 23:13:57 2009 From: planders at gmail.com (Preston Landers) Date: Mon, 30 Nov 2009 16:13:57 -0600 Subject: [python-win32] Options for running Python under IIS? In-Reply-To: <796c415c0911111503i624835bcvecf3eb11f3a73f66@mail.gmail.com> References: <796c415c0911111503i624835bcvecf3eb11f3a73f66@mail.gmail.com> Message-ID: <796c415c0911301413m17ceaac3vd8140b2c9c576e09@mail.gmail.com> > On 13/11/2009 4:21 AM, Randy Syring wrote: > > You may be able to use isapi-wsgi with a custom application pool to > > achieve what you are looking for. If you can restrict the application > > pool to only use one thread per process (which I am not sure how to do) > > and then use multiple processes (properties -> performance -> maximum > > number of worker processes), you may be able to achieve what you are > > trying to do. You might want to ask more questions on the isapi-wsgi board. > > This sounds right - and you select a non-threaded implementation simply > by way of the base class you inherit from in your Python implementation. > > Cheers, > > Mark Hello, I just thought I'd follow up on my original post about IIS. We decided to go ahead and use isapi-wsgi and so far the results are very good. It won't go into official production for a while but it looks very promising. In order to avoid the threading issue (we do in fact use mutable module level variables) we are using the "simple" (non-threaded) base class. To achieve concurrency we're using the IIS "web garden" feature, which is the config setting Randy mentioned to allow multiple worker processes per application pool. We're configuring the app pool through ADSI, the same way Python-ISAPI configures itself. Speaking of which - it seems like the ADSI stuff for IIS might be deprecated? I only say that because it's not installed by default in newer versions of Windows and must be selected as "IIS Metabase and IIS 6 configuration compatibility" in the Windows feature selection. That's not a problem for my app - the installer detects the lack of this component. But calling it "IIS 6 configuration compatibility" seems to suggest ADSI might eventually go away. Or maybe it doesn't - does anyone know? I'm just wondering if Python-ISAPI might eventually have to be updated to use WMI for configuration instead. Links like this which compare ADSI and WMI don't say anything about ADSI being deprecated. It's just not installed by default for IIS 7+. http://msdn.microsoft.com/en-us/library/ms525885.aspx thanks, Preston