[ANN] PYNOSPAM 0.1 (and some Embedded-Python-Questions)
Gerson Kurz
gerson.kurz at t-online.de
Fri Mar 29 14:12:46 EST 2002
pynospam is a Python-Powered extension for Microsoft Outlook, that
will
- filter spam mail i.e. tag the subject line with [SPAM!] if it thinks
it is spam.
- Because the spam detection is based on an at-runtime-interpreted
python-script, you can easily add your own spam detection algorithms
using regexs and whatnot.
- and, ..., TADA: even more usefull, convert incoming HTML mails to
plaintext and thus be saved from those bad javascript mails ;)
(Note: This is for Outlook, not OutlookExpress (OE); or rather: I
don't know if it works with OE, it works with Outlook 2000).
More info and download incl. source:
http://p-nand-q.com/pynospam.htm
OK, onto the questions. The code consists of a C++ - written "Exchange
Extension" for Outlook, that embedds the Python interpreter and, for
new incoming mails calls the python script using PyRun_SimpleFile. I
have a few problems:
- the script is installed in PYNOSPAM project directory. I seem to be
unable to put other scripts there and import them successfully -
probably because the directory is not on the python path. Can a python
script change the import path at runtime?
- Having run in that problem, I tried the "poor-mans-import" approach,
which is basically
exec(open(filename).read())
That didn't work, but I got no error message?! I redirected sys.stderr
before that, and other error messages seem to appear in the logfile,
but when I add that nothing gets written, and PyRun_SimpleFile returns
-1.
More information about the Python-list
mailing list