how to send a form html by email ?

Gerhard Häring gerhard.haering at opus-gmbh.net
Tue Mar 18 05:17:32 EST 2003


Gerard Breiner <gerard.breiner at ias.u-psud.fr> wrote:
> Mod_python error: "PythonHandler tmail"
> 
> Traceback (most recent call last):
> 
>   File "C:\Python22\Lib\mod_python\apache.py", line 181, in Dispatch
>     module = import_module(module_name, _req)
> 
>   File "C:\Python22\Lib\mod_python\apache.py", line 335, in import_module
>     module = imp.load_module(mname, f, p, d)
> 
>   File "c:/program files/apache group/apache/htdocs/python\tmail.py", line
> 10, in ?
>     # Create a text/plain message
> 
> IOError: [Errno 2] No such file or directory: 'c:\tt'
> ---------------------------------------------------
> however,  'c:\tt' exist  and i defined as :
> f1='c:\tt'
> fp = open(f1, 'rb')
> I wonder whereis the problem ?

Stranger and stranger ...

Note that if you do

    f1='c:\tt'

you're inserting a tab character (\t) after the colon. On Windows to build
filenames, I'd use one of 

    a) f1 = r'c:\tt'
    b) f1 = 'c:\\tt'
    c) f1 = 'c:/tt'

The variant in a is called a "raw string". In a raw string, the backslash
doesn't have any special meaning, while in normal strings, \t, \n, \l and
maybe other combinations have special meaning (tab, linefeed, page break).

I'm not sure if that's your problem, though.

-- Gerhard




More information about the Python-list mailing list