[Zope] Integrating Zope with Excel.

Jean-Francois.Doyon at CCRS.NRCan.gc.ca Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Thu Aug 26 13:07:36 EDT 2004


Joe,

Hmmm, well yes, Zope is multi-threaded ... But this only means that one
thread does one piece of work at a time ...

In a production environment, there's nothing preventing 2 threads from
processing 2 similar requests for an Excel conversion,
in which ase you'd run into the issues I mentionned.

Apart from that I can't help much more ...

Your best bet would be with ActiveState support or the win32all mailing
lists, if any ...

J.F.

-----Original Message-----
From: zope-bounces+jean-francois.doyon=ccrs.nrcan.gc.ca at zope.org
[mailto:zope-bounces+jean-francois.doyon=ccrs.nrcan.gc.ca at zope.org]On
Behalf Of Joe Goldthwaite
Sent: August 25, 2004 6:25 PM
To: zope at zope.org
Subject: RE: [Zope] Integrating Zope with Excel.


Thanks for the reply J.F.  I can use all the input I cat get.

Although I might run into problems with re-entrancy when this goes into
production, I don't think that's the case here.  I'm the only one using the
machine and I'm not submitting concurrent requests.   I also thought Zope
was multi-threaded so it has to finish a request before it can start another
one.  I could be wrong on that though.

Joe Goldthwaite


-----Original Message-----
From: Jean-Francois.Doyon at CCRS.NRCan.gc.ca
[mailto:Jean-Francois.Doyon at CCRS.NRCan.gc.ca]
Sent: Wednesday, August 25, 2004 3:06 PM
To: joe at goldthwaites.com; zope at zope.org
Subject: RE: [Zope] Integrating Zope with Excel.


I don't know much of anything about coding on windows, but I had looked at
doing something smiliar once ... To convert PPT's on demand to HTML in my
case, but I looked at using Python's COM features to do it (Regular Python +
win32all, not ActiveState's).

One thing that stopped me dead in my tracks was many comments form Microsoft
that all the Office related COM objects are NOT re-entrant.  Therefore
Excel.Application can only exist once and so on, and you have to take care
with such issues ... This is why nonbody's written an MS Office based Web
Service :)  You're not really using it as a web service, but the same
concecpt applies I think?

Basically, I'd look at object re-entrancy and concurency issues on the MS
Office side.

I ended up never needing mine, but I think I'd had it down to the fact that
the best was to have the Application instance running and use Document
instances to do the work ... Thing is I really didn't want to have
PowerPoint instanciated permanently on the server.

Anyways, just some thoughts, though I'm not sure they're of any help :)
J.F.

-----Original Message-----
From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
Joe Goldthwaite
Sent: August 25, 2004 5:40 PM
To: zope at zope.org
Subject: [Zope] Integrating Zope with Excel.


Hello Again,

I've been working on a Zope application and one of the tasks is to integrate
the web reports with Excel.  I've got some financial reports that the user
can browse through using a web interface.  What I'm trying to do is have a
link on the page that will download the report they're viewing into a local
Excel worksheet.

I decided to use com because I want the worksheet to have colors, print
settings, formatting, etc. I already have working code in VB.  I've looked
into XML and Pyxlwriter but it looks like a new learning curve compared to
just translating my VB com commands into Python.

I'm using Visual Studio .Net 2003 with Active Python as my development
environment.  When I submit the URL that creates the XL worksheet in
development, it works like a top.  In testing, I've generated 50 different
worksheets without any problems.

When I try to run the same code in Zope I have problems. Under Zope, I take
the submitted URL and create a worksheet that I save to a file.  Then I
return a meta command to redirect the browser to the newly created file
which is downloaded to the users computer. The good news is that it works
perfectly - sometimes. Other times I get this error message;

     Module ExcelReport, line 48, in __init__
     Module win32com.client, line 95, in Dispatch
     Module win32com.client.dynamic, line 91, in _GetGoodDispatchAndUserName
     Module win32com.client.dynamic, line 79, in _GetGoodDispatch
     com_error: (-2147221008, 'CoInitialize has not been called.', None,
None)

The error message is coming back from the line; XLApp =
Dispatch("Excel.Application").

The really strange thing is that the error seems to be random.  Sometimes it
works, sometimes it doesn't.  I haven't been able to determine any rhyme or
reason to it.  When I restart Zope, it will work one to as many as 10 times.
Then I'll get the error message.  If I keep trying the same URL, it might
eventually work or I may have to restart Zope to get it working again.

Does anyone have any idea as to what's going on here?


Thanks,

Joe Goldthwaite


_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list