Problem with win32, ActivePython2.1, ASP

Jim Abrams jim at publishingresources.com
Sat Jul 21 00:23:55 CEST 2001


Help?

PythonWin 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond (MarkH at ActiveState.com) - see 
'Help/About PythonWin' for further copyright information.
>>> import win32com.client
>>> pptc = win32com.client.Dispatch("Powerpoint.Application")
>>> ppt = pptc.Presentations.Add(WithWindow=0)
>>> slide = ppt.Slides.Add(1, 12)
>>> shapes = slide.Shapes
>>> shapes.AddOLEObject(ClassName=u'ShockwaveFlash.ShockwaveFlash.1')
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Shape>
>>> pptc
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library._Application>
>>> ppt
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Presentation>
>>> slide
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Slide>
>>> shapes
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Shapes>
>>> shapes.AddOLEObject
<method Shapes.AddOLEObject of Shapes instance at 019D099C>
>>> 

All is cool.
But, try this same thing inside an ASP page...

<%@LANGUAGE="Python"%>
<%
def w(o):
	Response.Write(Server.HTMLencode(repr(o)) + "<br>")

import win32com.client
pptc = win32com.client.Dispatch("Powerpoint.Application")
w(pptc)

ppt = pptc.Presentations.Add(WithWindow=0)
w(ppt)

slide = ppt.Slides.Add(1, 12)
w(slide)

shapes = slide.Shapes
w(shapes)

w(shapes.AddOLEObject)

shapes.AddOLEObject(ClassName=u'ShockwaveFlash.ShockwaveFlash.1')
w(shape)
%>


gets me:

<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library._Application>
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Presentation>
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Slide>
<win32com.gen_py.Microsoft PowerPoint 9.0 Object Library.Shapes>
<method Shapes.AddOLEObject of Shapes instance at 00762B4C>

Python ActiveX Scripting Engine error '80020009' 

Traceback (innermost last): File "<Script Block >", line 13, in ? 
shapes.AddOLEObject(ClassName=u'ShockwaveFlash.ShockwaveFlash.1') File "d:
\python21\win32com\gen_py\91493440-5A91-11CF-8700-00AA0060263Bx0x2x6.py", 
line 4692, in AddOLEObject return self._ApplyTypes_(0x7d8, 1, (9, 32), ((4, 
49), (4, 49), (4, 49), (4, 49), (8, 49), (8, 49), (3, 49), (8, 49), (3, 49), 
(8, 49), (3, 49)), 'AddOLEObject', '{91493479-5A91-11CF-8700-
00AA0060263B}',Left, Top, Width, Height, ClassName, FileName, DisplayAsIcon, 
IconFileName, IconIndex, IconLabel, Link) File "d:\python21\win32com\client
\__init__.py", line 334, in _ApplyTypes_ return self._get_good_object_(apply
(self._oleobj_.InvokeTypes, (dispid, 0, wFlags, retType, argTypes) + args), 
user, resultCLSID) COM Error: Shapes.AddOLEObject : An error occurred during 
creation of an ActiveX Control. 

? 

return self._get_good_object_(apply(self._oleobj_.InvokeTypes, (dispid, 0, 
wFlags, retType, argTypes) + args), user, resultCLSID


Any ideas?






More information about the Python-list mailing list