Re: [Zope] Creating files on server
Read the "Using External Methods" bit of:
What do I put in the "Function Name" field?
I have nothing like "def" in my script ...
I suspect you were using the item from the drop downlist name "script (python)", ie. "internal" python scripts. That's wrong. You'll have to use a real python method and you should really read above mentioned chapter. And also perhaps http://www.zope.org/Documentation/How-To/ExternalMethods cheers, oliver
On 24 Apr 2001 14:57:26 +0200, Oliver Bleutgen wrote:
Read the "Using External Methods" bit of:
What do I put in the "Function Name" field?
I have nothing like "def" in my script ...
I suspect you were using the item from the drop downlist name "script (python)", ie. "internal" python scripts. That's wrong. You'll have to use a real python method and you should really read above mentioned chapter. And also perhaps http://www.zope.org/Documentation/How-To/ExternalMethods
cheers, oliver
Sorry ... this didn't tell me anything new :-) I'll try post the script again, it looks like this: ****************** writesmil.py ********************* from sys import argv if len(argv)-1 != 6: print str(len(argv)-1) + " args resived. Need 6!" else: server, mediafile, tcin, tcout, id, clipname = argv[1], argv[2], argv[3], argv[4], argv[5], argv[6] fil = open("/root/Real/Content/" + id + clipname + ".smil", 'w') #Open file text = "<smil>\n\t<body>\n\t\t<audio src=\"rtsp:" + server + "/" + mediafile + ".rm\" clip-begin=\"" + tcin + "\" clip-end=\"" + tcout + "\">\n\t</body>\n</smil>\n" fil.write(text) fil.close() ***************** /writesmil.py ********************** Okay ... I can figure out from the documentation that I need to have somekind of def in the beginning of the script - but how and where? Regards, Gitte
Sorry ... this didn't tell me anything new :-) I'll try post the script again, it looks like this:
****************** writesmil.py *********************
from sys import argv
if len(argv)-1 != 6: print str(len(argv)-1) + " args resived. Need 6!" else: server, mediafile, tcin, tcout, id, clipname = argv[1], argv[2], argv[3], argv[4], argv[5], argv[6] fil = open("/root/Real/Content/" + id + clipname + ".smil", 'w') #Open file text = "<smil>\n\t<body>\n\t\t<audio src=\"rtsp:" + server + "/" + mediafile + ".rm\" clip-begin=\"" + tcin + "\" clip-end=\"" + tcout + "\">\n\t</body>\n</smil>\n" fil.write(text) fil.close()
***************** /writesmil.py **********************
Your dtml will be sending the argv values, so your def will look something like: def smil(self, server, mediafile, tcin, tcout, id, clipname): then you can probably omit the if loop, since your method will be sending the data, and you won't need to test for completeness of the input data. when you set up your external method, you will create a method name (it can be the same as the function you are calling) tell it what function you are calling (smil), and the name of the python script containing it (writesmil) -- you do not need to include the .py in this part. so, your field might look like: hth. ciao! greg. Gregory Haley DBA/Web Programmer Venaca, LLC.
participants (3)
-
ghaley@mail.venaca.com -
Gitte Wange -
Oliver Bleutgen