what does this mean....?

John Machin sjmachin at lexicon.net
Sat Feb 28 00:50:27 EST 2009


On Feb 28, 4:17 pm, zaheer.ag... at gmail.com wrote:
> I am trying to download a file from the server, I am getting this
> error,what does this mean
>
>    localFile = open(localFileName, 'wb')
> TypeError: coercing to Unicode: need string or buffer, type found

the name localFileName is bound to a type ... and of course it's
expecting a string.

You must have done something weird with localFileName, like this:

| >>> fname = type(2)
| >>> fname
| <type 'int'>
| >>> f = open(fname)
| Traceback (most recent call last):
|   File "<stdin>", line 1, in <module>
| TypeError: coercing to Unicode: need string or buffer, type found
| >>>



More information about the Python-list mailing list