Hi,

I have created an external method that is called when I upload a file. This external 
method will execute the validate_file function from my python file in the Extensions 
directory. 

The script creates a file and tries to see if it contains a virus. It does run, but 
after creating the file, the os.system and os.remove commands do not seem to do 
anything. When I copy the relevant code from the script to a python file and run it on 
the server directly, the code works. 

Does anyone know what could be wrong? Thanks in advance!


p.s. I am running Zope 2.6.1 with CMF 1.3 on a Linux box.

=============
import os

def validate_file(file):
    '''
    Check is file contains a virus.
    '''

    filename = "/usr/local/Zope/temp/temp.bin"

    # Write the file to the local filesystem
    temp = open(filename, "wb")
    temp.write(file.read())
    temp.flush

    # Call virus checker
    error_level = os.system("f-prot " + filename)

    # Delete temp file
    os.remove(filename)

    return error_level;

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

Reply via email to