From Mario.Ruggier@softplumbers.com Thu Oct 4 11:11:14 2001 From: Mario.Ruggier@softplumbers.com (Ruggier, Mario) Date: Thu, 4 Oct 2001 12:11:14 +0200 Subject: [python-win32] ASP Error 0115 Message-ID: <7FDE48022CEFA544878EA148687723DF0FDA3D@mqgenevaex01.myqube.com> Hi, I have an Active Server Page using Python as Script Language, running on IIS 5.0, Win2000, ActivePython 2.1. In the ASP, I import a python module (which is a DLL generated=20 with SWIG wrap of a C++ module). The module imports OK, but when=20 I try to call any method of this module, I consistently get=20 the ASP error:=20 Error Type: Active Server Pages, ASP 0115 (0x80004005) A trappable error (C0000005) occurred in an external object.=20 The script cannot continue running. /asp/test.asp When I run the same identical python code that uses this module=20 out of ASP, both as a stand-alone script and as a module called from another web application (not ASP), the code and the=20 imported module give perfectly correct rsults. The ASP error is generated even if the method call that triggers it is inside of a python try/except block. Does anyone any ideas what may be causing this, or even=20 how I may go about to debug this?=20 Mario Ruggier -- SoftPlumbers SA, 26 rue Maunoir, CH-1207 Gen=E8ve Mobile +41.79.240.8636 | Office +41.22.849.1002 From jens.jorgensen@tallan.com Fri Oct 5 19:27:44 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Fri, 05 Oct 2001 13:27:44 -0500 Subject: [python-win32] ASP Error 0115 References: <7FDE48022CEFA544878EA148687723DF0FDA3D@mqgenevaex01.myqube.com> Message-ID: <3BBDFBA0.60704@tallan.com> The main problem I've run into with ASPs is that the user they are run as, IUSR_MACHINE, is pretty lacking in privileges (which is a good thing of course). I'm not sure how that would translate into your C0000005 error, which is a memory error, caused by trying to read from or write to an invalid memory address. A python try: won't catch this because it isn't set up to catch this error. You can catch it in C++ though with a catch (...) {} block. I'd put this in strategic areas in the code and log when it occurs and you ought to be able to figure out where it's occurring. Ruggier, Mario wrote: >Hi, > >I have an Active Server Page using Python as Script Language, >running on IIS 5.0, Win2000, ActivePython 2.1. > >In the ASP, I import a python module (which is a DLL generated >with SWIG wrap of a C++ module). The module imports OK, but when >I try to call any method of this module, I consistently get >the ASP error: > >Error Type: >Active Server Pages, ASP 0115 (0x80004005) >A trappable error (C0000005) occurred in an external object. >The script cannot continue running. >/asp/test.asp > >When I run the same identical python code that uses this module >out of ASP, both as a stand-alone script and as a module called >from another web application (not ASP), the code and the >imported module give perfectly correct rsults. > >The ASP error is generated even if the method call that triggers >it is inside of a python try/except block. > >Does anyone any ideas what may be causing this, or even >how I may go about to debug this? > > >Mario Ruggier >-- >SoftPlumbers SA, 26 rue Maunoir, CH-1207 Gen鑦e >Mobile +41.79.240.8636 | Office +41.22.849.1002 > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > -- Jens B. Jorgensen jens.jorgensen@tallan.com From zhao_zi_long@etang.com Wed Oct 10 14:05:40 2001 From: zhao_zi_long@etang.com (zy) Date: Wed, 10 Oct 2001 21:05:40 +0800 Subject: [python-win32] range function problem Message-ID: <006801c1518c$4423e940$634ffea9@zy> 这是 MIME 格式的具有很多部分消息。 ------=_NextPart_000_0063_01C151CF.514808C0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 SSBhbSBhIG5ldyB1c2VyIG9mIHB5dGhvbiBsYW5ndWFnZS4NCkkgdGVzdGVkIGEgc21hbGwgcHJv Z3JhbSB3aGljaCBsaWtlcyB0aGUgZm9sbG93aW5nOg0KKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioNCiogIG4gPSAxOTk5OTk5OSANCiogIGZvciB4IGluIHJhbmdl KDIsIG4vMisxKToNCiogICAgICAgaWYgbiAlIHggPT0gMDoNCiogICAgICAgICAgICBwcmludCBu LCAnZXF1YWxzJywgeCwgJyonLCBuL3gNCiogICAgICAgICAgICBicmVhaw0KKiAgZWxzZToNCiog ICAgICAgcHJpbnQgbiwgJ2lzIGEgcHJpbWUgbnVtYmVyJw0KKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKg0KSSBmb3VuZ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ciBOZXciIHNpemU9Mj48L0ZPTlQ+Jm5ic3A7PC9ESVY+DQo8RElWPjxGT05UIGZhY2U9IkNvdXJp ZXIgTmV3IiBzaXplPTI+U28gSSBqdXN0IHJhbiB0aGUgZXhwcmVzc2lvbiAncmFuZ2UoMiwgDQpu LzIrMSknKG49MTk5OTk5OTkpLGFuZCBpIGZvdW5kPC9GT05UPjwvRElWPg0KPERJVj48Rk9OVCBm YWNlPSJDb3VyaWVyIE5ldyIgc2l6ZT0yPnRoZSBzYW1lIHNpdHVhdGlvbiBsaWtlIHRoZSBmcm9u dCANCjwvRk9OVD48Rk9OVCBmYWNlPSJDb3VyaWVyIE5ldyIgc2l6ZT0yPmhhcHBlbmVkLjwvRk9O VD48L0RJVj4NCjxESVY+PEZPTlQgZmFjZT0iQ291cmllciBOZXciIHNpemU9Mj48L0ZPTlQ+Jm5i c3A7PC9ESVY+DQo8RElWPjxGT05UIGZhY2U9IkNvdXJpZXIgTmV3IiBzaXplPTI+U28gSSB3YW50 IHRvIGtub3cgaWYgaXQgaXMgYSBidWcgb2YgdGhlIA0KcmFuZ2UgZnVuY3Rpb24uPC9GT05UPjwv RElWPg0KPERJVj48Rk9OVCBmYWNlPSJDb3VyaWVyIE5ldyIgc2l6ZT0yPjwvRk9OVD4mbmJzcDs8 L0RJVj4NCjxESVY+PEZPTlQgZmFjZT0iQ291cmllciBOZXciIHNpemU9Mj5UaGFua3MgDQombmJz cDtmaXJzdC48L0ZPTlQ+PC9ESVY+PC9CT0RZPjwvSFRNTD4NCg== ------=_NextPart_000_0063_01C151CF.514808C0-- From Chris.Ingram@Synchrologic.com Wed Oct 10 14:54:15 2001 From: Chris.Ingram@Synchrologic.com (Chris Ingram) Date: Wed, 10 Oct 2001 09:54:15 -0400 Subject: [python-win32] range function problem Message-ID: This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C15193.0C4DC430 Content-Type: text/plain; charset="gb2312" Instead of using "range (2, 19999999)", try using "xrange (2, 19999999)". The former actually builds a list in memory containing 19999998 elements whereas the latter computes the value of each element on the fly, thus not consuming much memory. -- Chris Ingram, Synchrologic, Inc. Email: Chris.Ingram@synchrologic.com -----Original Message----- From: zy [mailto:zhao_zi_long@etang.com] Sent: Wednesday, October 10, 2001 9:06 AM To: python-win32@python.org Subject: [python-win32] range function problem I am a new user of python language. I tested a small program which likes the following: ******************************************** * n = 19999999 * for x in range(2, n/2+1): * if n % x == 0: * print n, 'equals', x, '*', n/x * break * else: * print n, 'is a prime number' ********************************************** I found something interesting when the variable 'n' equals 19999999 that my computer seemed crazy because it began to eat my memory at a surprising speed ,the memory amount used just rose from 131M to 258M and the process had no response. But when the variable 'n' equals 1999999, the program works well. So I just ran the expression 'range(2, n/2+1)'(n=19999999),and i found the same situation like the front happened. So I want to know if it is a bug of the range function. Thanks first. ------_=_NextPart_001_01C15193.0C4DC430 Content-Type: text/html; charset="gb2312"
Instead of using "range (2, 19999999)", try using "xrange (2, 19999999)".  The former actually builds a list in memory containing 19999998 elements whereas the latter computes the value of each element on the fly, thus not consuming much memory.
 

--
Chris Ingram, Synchrologic, Inc.
Email: Chris.Ingram@synchrologic.com
 

-----Original Message-----
From: zy [mailto:zhao_zi_long@etang.com]
Sent: Wednesday, October 10, 2001 9:06 AM
To: python-win32@python.org
Subject: [python-win32] range function problem

I am a new user of python language.
I tested a small program which likes the following:
********************************************
*  n = 19999999 
*  for x in range(2, n/2+1):
*       if n % x == 0:
*            print n, 'equals', x, '*', n/x
*            break
*  else:
*       print n, 'is a prime number'
**********************************************
I found something interesting when the variable 'n' equals 19999999
that my computer seemed crazy because it began to eat my memory
at a surprising speed ,the memory amount used just rose from 131M to 258M
and the process had no response. 
 
But when the variable 'n' equals 1999999, the program works well.
 
So I just ran the expression 'range(2, n/2+1)'(n=19999999),and i found
the same situation like the front happened.
 
So I want to know if it is a bug of the range function.
 
Thanks  first.
------_=_NextPart_001_01C15193.0C4DC430-- From jens.jorgensen@tallan.com Wed Oct 10 15:08:06 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Wed, 10 Oct 2001 09:08:06 -0500 Subject: [python-win32] range function problem References: <006801c1518c$4423e940$634ffea9@zy> Message-ID: <3BC45646.6090409@tallan.com> No bug. range() builds a list of the numbers in the sequence. You can do the math. If each item in the list only takes 8 bytes of memory you get 76MB. Each list item probably takes a bit more. You might want to use xrange instead which doesn't create the list but rather returns an object that creates each int as it is asked for. zy wrote: > I am a new user of python language. > > I tested a small program which likes the following: > > ******************************************** > * n = 19999999 > * for x in range(2, n/2+1): > * if n % x == 0: > * print n, 'equals', x, '*', n/x > * break > * else: > * print n, 'is a prime number' > > ********************************************** > > I found something interesting when the variable 'n' equals 19999999 > > that my computer seemed crazy because it began to eat my memory > > at a surprising speed , the memory amount used just rose from 131M to > 258M > > and the process had no response. > > But when the variable 'n' equals 1999999, the program works well. > > So I just ran the expression 'range(2, n/2+1)'(n=19999999),and i found > > the same situation like the front happened. > > So I want to know if it is a bug of the range function. > > Thanks first. > -- Jens B. Jorgensen jens.jorgensen@tallan.com From Richard.Cooper@youmeus.com Wed Oct 10 18:04:48 2001 From: Richard.Cooper@youmeus.com (Richard Cooper) Date: Wed, 10 Oct 2001 18:04:48 +0100 Subject: [python-win32] os.execv Message-ID: <49CCE87D4A3BD511B1C500D0B7B69C0685D88D@EXCHANGE> Hi, Is the a known issue with the os.execxxx function on win32? Because, I can't get them to work. This is my test. 1) Create a batch file called test.bat containing the single line: echo hello 2) Running this from the command line works fine 3) Open python win and type >>> import os >>> os.execv(r"d:\test.bat",["foo"]) This kills the pythonwin process Rich From jens.jorgensen@tallan.com Wed Oct 10 19:46:03 2001 From: jens.jorgensen@tallan.com (Jorgensen, Jens) Date: Wed, 10 Oct 2001 13:46:03 -0500 Subject: [python-win32] os.execv References: <49CCE87D4A3BD511B1C500D0B7B69C0685D88D@EXCHANGE> Message-ID: <3BC4976B.8090203@tallan.com> You didn't expect it to kill the pythonwin process? That's what exec is supposed to do: overlay the process with a new process and start executing that one, replacing the running process. Maybe you'd really like it to fork? Or maybe you just want the system() call instead so the calling process isn't wiped out. Richard Cooper wrote: >Hi, > >Is the a known issue with the os.execxxx function on win32? Because, I can't >get them to work. > >This is my test. > >1) Create a batch file called test.bat containing the single line: >echo hello > >2) Running this from the command line works fine > >3) Open python win and type > >>>>import os >>>>os.execv(r"d:\test.bat",["foo"]) >>>> > >This kills the pythonwin process > >Rich > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > -- Jens B. Jorgensen jens.jorgensen@tallan.com From Chris.Ingram@Synchrologic.com Wed Oct 10 19:56:44 2001 From: Chris.Ingram@Synchrologic.com (Chris Ingram) Date: Wed, 10 Oct 2001 14:56:44 -0400 Subject: [python-win32] os.execv Message-ID: As fork doesn't exist on win32, you'd probably want to do spawn (specifically os.spawnv). os.system() will simply call out to the external program and upon completion, the Python script continues. os.spawnv(), on the other hand, actually creates another concurrently running process (similar to doing a fork then an exec on Unix) such that your Python script continues to run while the program it spawned is also running. -- Chris Ingram, Synchrologic, Inc. Email: Chris.Ingram@synchrologic.com -----Original Message----- From: Jorgensen, Jens [mailto:jens.jorgensen@tallan.com] Sent: Wednesday, October 10, 2001 2:46 PM To: Richard Cooper Cc: python-win32@python.org Subject: Re: [python-win32] os.execv You didn't expect it to kill the pythonwin process? That's what exec is supposed to do: overlay the process with a new process and start executing that one, replacing the running process. Maybe you'd really like it to fork? Or maybe you just want the system() call instead so the calling process isn't wiped out. Richard Cooper wrote: >Hi, > >Is the a known issue with the os.execxxx function on win32? Because, I can't >get them to work. > >This is my test. > >1) Create a batch file called test.bat containing the single line: >echo hello > >2) Running this from the command line works fine > >3) Open python win and type > >>>>import os >>>>os.execv(r"d:\test.bat",["foo"]) >>>> > >This kills the pythonwin process > >Rich > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > -- Jens B. Jorgensen jens.jorgensen@tallan.com _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From ankur@BPA.Arizona.EDU Wed Oct 17 18:57:05 2001 From: ankur@BPA.Arizona.EDU (Ankur Jain) Date: Wed, 17 Oct 2001 10:57:05 -0700 (MST) Subject: [python-win32] problem with Microsoft Word Message-ID: Hi, We are working on a project to capture various events like cut, copy, paste, insert, delete, etc. in Microsoft Word. We are using Python 21 and are successful in launching Word. But, we are not able to capture the events. We also want to capture the cursor position, range of selection that user performs to cut, copy or paste. Please help with any code snippet, if available. Any help would be appreciated. Thanks in advance. Ankur Jain Eric Jiang From msdin@home.com Thu Oct 18 00:33:31 2001 From: msdin@home.com (Shah) Date: Wed, 17 Oct 2001 16:33:31 -0700 Subject: [python-win32] byref variant parameter problem Message-ID: <3BCE154B.1010308@home.com> Hi, I am writing a script that creates and calls functions on a custom COM object. The object is used for error handling. Basically, the caller dim's a variant and passes it around. If an error occurs, this object takes the variant, creates a disconnected ADOR.Recordset, populates it with the error info, and assigns it to the variant. For example (in VB code): Public Function MyFunc() as Long Dim errors as Variant MyFunc2(errors, foo, bar) if IsObject(errors) then 'log the errors end if end Function Public Function MyFunc2(ByRef errors as Variant, _ ByVal foo, ByVal bar) as Long 'Create the error handler object Dim errObj as New ErrHandler On Error Goto ErrorHandler 'Do stuff ErrorHandler: 'After this, errors will be a ADOR.Recordset errObj.AddError(errors, desc) MyFunc2 = 0 End Function I'm basically trying to call MyFunc2 in Python. If I call it like this: retval = myObj.MyFunc2(None, foo, bar) and an error is raised, I get an error message 'Object required' reported by the the error object (errObj). I've tried passing it an ADOR.Recordset instead, but then I get errors regarding the state of the Recordset. The errObj is supposed to create the recordset on the fly. Everything works fine in VB, but I get nowhere in Python. Any ideas? Shah msdin_NO@SPAM_home.com From MarkH@ActiveState.com Thu Oct 18 01:06:55 2001 From: MarkH@ActiveState.com (Mark Hammond) Date: Thu, 18 Oct 2001 10:06:55 +1000 Subject: [python-win32] byref variant parameter problem In-Reply-To: <3BCE154B.1010308@home.com> Message-ID: Try passing pythoncom.Empty in place of None. Mark. > -----Original Message----- > From: python-win32-admin@python.org > [mailto:python-win32-admin@python.org]On Behalf Of Shah > Sent: Thursday, 18 October 2001 9:34 AM > To: python-win32@python.org > Subject: [python-win32] byref variant parameter problem > > > Hi, > > I am writing a script that creates and calls functions > on a custom COM object. The object is used for error > handling. Basically, the caller dim's a variant and > passes it around. If an error occurs, this object takes > the variant, creates a disconnected ADOR.Recordset, > populates it with the error info, and assigns it to the > variant. For example (in VB code): > > Public Function MyFunc() as Long > > Dim errors as Variant > > MyFunc2(errors, foo, bar) > > if IsObject(errors) then > 'log the errors > end if > > end Function > > Public Function MyFunc2(ByRef errors as Variant, _ > ByVal foo, ByVal bar) as Long > > 'Create the error handler object > Dim errObj as New ErrHandler > > On Error Goto ErrorHandler > > 'Do stuff > > ErrorHandler: > > 'After this, errors will be a ADOR.Recordset > errObj.AddError(errors, desc) > MyFunc2 = 0 > > End Function > > I'm basically trying to call MyFunc2 in Python. > If I call it like this: > > retval = myObj.MyFunc2(None, foo, bar) > > and an error is raised, I get an error message > 'Object required' reported by the the error > object (errObj). I've tried passing it an > ADOR.Recordset instead, but then I get errors > regarding the state of the Recordset. The > errObj is supposed to create the recordset on > the fly. Everything works fine in VB, but > I get nowhere in Python. Any ideas? > > Shah > msdin_NO@SPAM_home.com > > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From msdin@home.com Thu Oct 18 01:41:55 2001 From: msdin@home.com (Shah) Date: Wed, 17 Oct 2001 17:41:55 -0700 Subject: [python-win32] byref variant parameter problem References: Message-ID: <3BCE2553.5010405@home.com> No go...I still get 'Object Required'. It seems like it should work though. Maybe I'm barking up the wrong tree... Thanks, Shah Mark Hammond wrote: > Try passing pythoncom.Empty in place of None. > > Mark. > > >>-----Original Message----- >>From: python-win32-admin@python.org >>[mailto:python-win32-admin@python.org]On Behalf Of Shah >>Sent: Thursday, 18 October 2001 9:34 AM >>To: python-win32@python.org >>Subject: [python-win32] byref variant parameter problem >> >> >>Hi, >> >>I am writing a script that creates and calls functions >>on a custom COM object. The object is used for error >>handling. Basically, the caller dim's a variant and >>passes it around. If an error occurs, this object takes >>the variant, creates a disconnected ADOR.Recordset, >>populates it with the error info, and assigns it to the >>variant. For example (in VB code): >> >>Public Function MyFunc() as Long >> >>Dim errors as Variant >> >>MyFunc2(errors, foo, bar) >> >>if IsObject(errors) then >> 'log the errors >>end if >> >>end Function >> >>Public Function MyFunc2(ByRef errors as Variant, _ >> ByVal foo, ByVal bar) as Long >> >>'Create the error handler object >>Dim errObj as New ErrHandler >> >>On Error Goto ErrorHandler >> >>'Do stuff >> >>ErrorHandler: >> >> 'After this, errors will be a ADOR.Recordset >> errObj.AddError(errors, desc) >> MyFunc2 = 0 >> >>End Function >> >>I'm basically trying to call MyFunc2 in Python. >>If I call it like this: >> >> retval = myObj.MyFunc2(None, foo, bar) >> >>and an error is raised, I get an error message >>'Object required' reported by the the error >>object (errObj). I've tried passing it an >>ADOR.Recordset instead, but then I get errors >>regarding the state of the Recordset. The >>errObj is supposed to create the recordset on >>the fly. Everything works fine in VB, but >>I get nowhere in Python. Any ideas? >> >>Shah >>msdin_NO@SPAM_home.com >> >> >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 >> > From pythonwin32@infopackaging.com Wed Oct 31 22:25:45 2001 From: pythonwin32@infopackaging.com (Troy Sorzano) Date: Wed, 31 Oct 2001 17:25:45 EST Subject: [python-win32] Monitoring a running Windows program In-Reply-To: References: Message-ID: Hi All, I am new to python and trying to create a simple EXE monitor. As you know windows programs are not very stable. I have one such app that I would like to have a python script monitor. If it is not running then my script will start it up using ShellExecute. If it is running then do nothing. I am trying to use some info I found on the Microsoft technet web site. It suggests: "Using the Windows API function GetModuleUsage, your program can monitor the status of a shelled process. The return value from Shell, can be used to call GetModuleUsage continuously within a loop to poll whether or not the shelled program has finished executing." Problem is I can't find GetModuleUsage in the Win32. Is there another way to monitor Windows executables? Thanks, Troy Sorzano