Problems running python from procmail

Alain TESIO alain at onesite.org
Sun Aug 6 12:06:10 EDT 2000


Hello,

I can't run a python script from procmail.

It is a server where I have no admin rights, I installed python locally and it's working
fine from a shell.

>From procmail, I have to set LD_LIBRARY_PATH to the mysql library.

When I'm piping a message to python from procmail, I get an error because it doesn't find
the library libmysqlclient.so.6, so I have created this file :

-rwxr-xr-x   1 onesite  onesiteg       81 Aug  6 10:56 /home/onesite/bin/mypython*
==============
export LD_LIBRARY_PATH=/home/onesite/src/mysql_lib/
/home/onesite/bin/python $*
==============

My script is :
==============
#!/home/onesite/bin/mypython

programdir="/home/onesite/observer/"

execfile(programdir+"observer.py")
execfile(programdir+"allpress.py")
...
==============

When I'm executing "mypython < message" from a shell, it works fine.
When it's launched from procmail, I get the following error :

procmail: Executing "/home/onesite/observer/receivemail.py"
/home/onesite/observer/receivemail.py: syntax error near unexpected token
`execfile(programdir+"observer.py")'
/home/onesite/observer/receivemail.py: /home/onesite/observer/receivemail.py: line 5:
`execfile(programdir+"observer.py")'

It looks like a shell error, as if it was not parsed from python.

Any idea ?

Thanks
Alain



More information about the Python-list mailing list