[Tutor] HTTP upload- Second try

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 23 Feb 2001 17:11:59 -0800 (PST)

On Fri, 23 Feb 2001, Sharriff Aina wrote:

> Hi Guys, I=B4m sorry to be a bore, but could someone tell my why my code
> fails?

You might want to tell us a little more about what it means to "fail";
otherwise, we'll have to flail about a bit.  *grin*

I did catch one thing, though:

>        tempthumb =3D open('.\medintouch\images\testimage.txt', 'w')

Python treats the sequence:


as the Tab character, so that's definitely going to interfere with the
file opening.  To prevent that from happening, try this:

    tempthumb =3D open('.\\medintouch\\images\\testimage.txt', 'w')


    tempthumb =3D open(r'.\medintouch\images\testimage.txt', 'w')

instead; both tell Python to avoid treating the backslash as the start of
an escape character.  The second is the nicer approach: it's called a
"raw" string, and it's useful whenever you want to have backslashes in
your string.

Good luck!