[Zope-dev] os.system problem

Andreas Jung Andreas Jung <andreas@andreas-jung.com>
Thu, 19 Jun 2003 12:27:35 +0200


Ensure that the binaries being called through os.system() are in the 
program search
path.

-aj

P.S. Use the zope mailinglist next time

--On Donnerstag, 19. Juni 2003 12:12 Uhr +0200 Arjan Huizer 
<a.huizer@kennisnet.org> wrote:

> 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  -  Zope-Dev@zope.org
> 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 )