[Zope] Zope lockups using an External Method

Adam Warner lists@consulting.net.nz
09 Sep 2001 20:20:55 +1200


Hi all,

I've been learning Zope for a while but I'm now so completely stuck that
I thought it would be a good time to join the mailing list :-)

My platform is Debian GNU/Linux unstable x86 running the 2.4.9 kernel.
w/Zope 2.3.3 (source release, python 1.5.2, linux2) 

Running a particular External Method (clicking on the DTML Document and
then clicking the View tab) leads to Zope locking up and the computer
system going very sluggish. A reboot fixes everything.

I can rewrite the script so it runs separately from the command line.
However once it is called as an external method it misbehaves.

The specifics:

I execute this DTML Document:

<dtml-var "Doc2PDF(Karl_Le_Quesne)">

(Karl_Le_Quesne is the id of the Word Document in the Zope Database. For
some reason I need to remove the .doc extension. It seems that objects
can't have a full stop in them?)


Which calls this External Method:

def Doc2PDF(self, inputdoc):
	import os
	import tempfile
	import sys
	import random
	import StringIO

	#For some reason this stopped working below
	#And now returns "None"
	#temp_path=tempfile.tempdir
	
	temp_path='/var/tmp'
	random_dir=str(random.randrange(100000000,999999999))
	full_dir=temp_path+'/'+random_dir
	
	os.chdir(temp_path)
	os.mkdir(random_dir)
	os.chdir(full_dir)

	#Put the file onto the hard disk
	
	thefile=open('aaa123','w')
	thefile.write(inputdoc.data)
	thefile.close

	# Run wvPDF on the document
	os.system('wvPDF aaa123 aaa123.pdf')

	return


aaa123 is a word document. Can anyone see what has gone wrong?

Note that the External Method properties are id = Module Name = Function
Name = Doc2PDF

Before the external command wvPDF is run I can confirm that the word
document (named aaa123) is sitting in the directory /var/tmp/xxxxxxxxx/.
I can manually run wvPDF as user www-data.

Many thanks,
Adam