COM/IIS permissions question

A

Andrew Burton

Anyone know where else I can find instructions for "Launching OLE Servers from
ISAPI Extensions"(1). I followed those instructions, even went so far as to
give a few other accounts permission, but my Python -- that's Python 2.2 --
script keeps given me the following error:

[error]

Traceback (most recent call last):
File "D:\JAROD\programming\python\pycgitunes\pycgitunes.py", line 12, in ?
iTunes = win32com.client.Dispatch("iTunes.Application")
File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 92, in
Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line 81, in
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line 72, in
_GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2146959355, 'Server execution failed', None, None)

[/error]

Here's the code I'm using, in case anyone's curious -- this is my first, REAL
Python program, so maybe it's just a glitch. Hoever, a thread from
mail.python.org's archives(2) and the fact that it works from an Interactive
shell makes me think that the ISAPI/COM security problem is the key. Anyway,
code...

Code:
# Libraries
import cgi
import cgitb
import win32com.client

# COM stuff
iTunes = win32com.client.Dispatch("iTunes.Application")

# global variables
form = cgi.FieldStorage()

#####
# Subroutines

# main code
cgitb.enable()

print "Content-type: text/html\n\n"
print "Hello, world"

Any help would be appreciated -- any IIS/Python tips especially. Thanks!

---

1. http://support.microsoft.com/kb/q156223/

2. http://mail.python.org/pipermail/python-list/1999-November/015411.html

Andrew Burton - tuglyraisin at aol dot com
Felecia Station on Harvestgain - Jarod Godel in Second Life
 
L

Lawrence Hudson

Andrew said:
Anyone know where else I can find instructions for "Launching OLE Servers
from ISAPI Extensions"(1). I followed those instructions, even went so far
as to give a few other accounts permission, but my Python -- that's Python
2.2 -- script keeps given me the following error:

[error]

Traceback (most recent call last):
File "D:\JAROD\programming\python\pycgitunes\pycgitunes.py", line 12, in
?
iTunes = win32com.client.Dispatch("iTunes.Application")
File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line
92, in
Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line
81, in
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line
72, in
_GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2146959355, 'Server execution failed', None, None)

[/error]

Here's the code I'm using, in case anyone's curious -- this is my first,
REAL Python program, so maybe it's just a glitch. Hoever, a thread from
mail.python.org's archives(2) and the fact that it works from an
Interactive shell makes me think that the ISAPI/COM security problem is
the key. Anyway, code...

Code:
# Libraries
import cgi
import cgitb
import win32com.client

# COM stuff
iTunes = win32com.client.Dispatch("iTunes.Application")

# global variables
form = cgi.FieldStorage()

#####
# Subroutines

# main code
cgitb.enable()

print "Content-type: text/html\n\n"
print "Hello, world"

Any help would be appreciated -- any IIS/Python tips especially. Thanks!

---

1. http://support.microsoft.com/kb/q156223/

2. http://mail.python.org/pipermail/python-list/1999-November/015411.html

Andrew Burton - tuglyraisin at aol dot com
Felecia Station on Harvestgain - Jarod Godel in Second Life
Its been a while since I did this sort of stuff but you need initialise COM
before using any COM facilities. Something like:

import pythoncom
pythoncom.OleInitialize()

Lawrence
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top