List Info

Thread: PID of a process created by win32com.client.Dispatch()




PID of a process created by win32com.client.Dispatch()
country flaguser name
United States
2007-03-05 20:01:13
I've written a program which automates the running of
Business Objects (a query generator and reporting tool). The
command which creates the process (and the corresponding
Python object) is:

boApp =
win32com.client.Dispatch('BusinessObjects.Application')

This works fine, and I have successfully run the
application. However, sometimes the Business Objects process
hangs (perhaps because the query takes too long or perhaps
due to some error in my code) and I would like to kill the
process in Task Manager. If I am running this on my PC, it's
easy to identify the process to kill. If, however, I'm
running this on a server and there are other Business
Objects processes running I cannot tell which process to
end.

Upon calling Dispatch() I would like to log the PID of the
process, so if I have to kill, I would know which one.

Is there a way to do this? (I have looked through the Python
for Windows documentation and searched on the web, but have
not found any answers.) Thanks.

--
Bruce Webber
brucebrucewebber.us
http://brucewebber.us

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32

Re: PID of a process created by win32com.client.Dispatch()
country flaguser name
United States
2007-03-06 12:23:18
Bruce Webber wrote:
> I've written a program which automates the running of
Business Objects (a query generator and reporting tool). The
command which creates the process (and the corresponding
Python object) is:
>
> boApp =
win32com.client.Dispatch('BusinessObjects.Application')
>
> This works fine, and I have successfully run the
application. However, sometimes the Business Objects process
hangs (perhaps because the query takes too long or perhaps
due to some error in my code) and I would like to kill the
process in Task Manager. If I am running this on my PC, it's
easy to identify the process to kill. If, however, I'm
running this on a server and there are other Business
Objects processes running I cannot tell which process to
end.
>
> Upon calling Dispatch() I would like to log the PID of
the process, so if I have to kill, I would know which one.
>
> Is there a way to do this? (I have looked through the
Python for Windows documentation and searched on the web,
but have not found any answers.)

This is tricky.  Remember that win32com.client.Dispatch
doesn't actually
know whether the COM server is in-process (meaning a DLL
within the
current process) or out-of-process (meaning a separate
executable). 
That's all hidden by COM.  When you talk to the boApp
object, you're
just calling into an object in your address space.  The fact
that the
object is just a proxy that calls into another process is a
COM detail
that is hidden from view.

Do you have the object model for BusinessObjects?  If you
are lucky,
perhaps their object model includes a "get process
ID" property.  If
not, I'm not convinced there is a way to map a COM object to
a process
ID, and some Google searching did not come up with an
answer.

-- 
Tim Roberts, timrprobo.com
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32

Re: PID of a process created by win32com.client.Dispatch()
country flaguser name
United States
2007-03-07 14:59:35
--Tim Roberts <timrprobo.com> wrote:

> Bruce Webber wrote:
>> I've written a program which automates the running
of Business Objects
>> (a query generator and reporting tool). The command
which creates the
>> process (and the corresponding Python object) is:
>>
>> boApp =
win32com.client.Dispatch('BusinessObjects.Application')
>>
>> This works fine, and I have successfully run the
application. However,
>> sometimes the Business Objects process hangs
(perhaps because the query
>> takes too long or perhaps due to some error in my
code) and I would like
>> to kill the process in Task Manager. If I am
running this on my PC, it's
>> easy to identify the process to kill. If, however,
I'm running this on a
>> server and there are other Business Objects
processes running I cannot
>> tell which process to end.
>>
>> Upon calling Dispatch() I would like to log the PID
of the process, so
>> if I have to kill, I would know which one.
>>
>> Is there a way to do this? (I have looked through
the Python for Windows
>> documentation and searched on the web, but have not
found any answers.)
>
> This is tricky.  Remember that win32com.client.Dispatch
doesn't actually
> know whether the COM server is in-process (meaning a
DLL within the
> current process) or out-of-process (meaning a separate
executable).
> That's all hidden by COM.  When you talk to the boApp
object, you're
> just calling into an object in your address space.  The
fact that the
> object is just a proxy that calls into another process
is a COM detail
> that is hidden from view.
>
> Do you have the object model for BusinessObjects?  If
you are lucky,
> perhaps their object model includes a "get process
ID" property.  If
> not, I'm not convinced there is a way to map a COM
object to a process
> ID, and some Google searching did not come up with an
answer.

Tim,

Thanks for the response.

I do have the object model for BusinessObjects but there is
no property or 
method that provides the process ID. Since my company has a
support 
contract with them, and since they do provide the object
model as part of 
their SDK, I will contact them and ask if there is some
undocumented way of 
doing it.

-- 
Bruce Webber
brucebrucewebber.us
http://brucewebber.us
_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )