![]() |
|
|
|
#1 |
|
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 zaheer.agadi@gmail.com |
|
|
|
|
#2 |
|
Posts: n/a
|
On Feb 28, 4:17*pm, zaheer.ag...@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 | >>> John Machin |
|
|
|
#3 |
|
Posts: n/a
|
On Feb 28, 10:50 am, "Rhodri James" <rho...@wildebst.demon.co.uk>
wrote: > On Sat, 28 Feb 2009 05:17:41 -0000, <zaheer.ag...@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 rest of the traceback and enough of your code to make sense of > it would have helped. Without context, my best guess is that > "localFileName" isn't actually a string. > > -- > Rhodri James *-* Wildebeeste Herder to the Masses Ohh thats my bad, I was actually passing a file type instead of string,thanks a lot . One question off the topic., How to create a .pyz file. I have python project that has some modules in it , I want to create a zip file so that I can use it as we use java jar file Like I want to do a mypyFiles.pyz --sendFile C:\\testFile I currently have a module that does this when run as single python module, but I want to do same this using a zip file which will have some other modules within it. Any help..? Thanks zaheer.agadi@gmail.com |
|
|
|
#4 |
|
Posts: n/a
|
En Sat, 28 Feb 2009 04:44:28 -0200, <> escribió:
> One question off the topic., Usually it's better to post a separate message. > How to create a .pyz file. I have python project that has some modules > in it , I want to create a zip file so that I can use it as we use > java jar file > Like I want to do a > mypyFiles.pyz --sendFile C:\\testFile > I currently have a module that does this when run as single python > module, but I want to do same this using a zip file which will have > some other modules within it. Just put all your modules inside the zip, and create a __main__.py file. Execute it using: python foo.zip See http://docs.python.org/using/cmdline.html#command-line -- Gabriel Genellina Gabriel Genellina |
|
|
|
#5 |
|
Posts: n/a
|
On Feb 28, 1:50 pm, Ben Finney <bignose+hates-s...@benfinney.id.au>
wrote: > "Gabriel Genellina" <gagsl-...@yahoo.com.ar> writes: > > En Sat, 28 Feb 2009 04:44:28 -0200, <zaheer.ag...@gmail.com> escribió: > > > > One question off the topic., > > > Usually it's better to post a separate message. > > More specifically (and I only say this because many people seem not to > observe the distinction), when starting an entirely new topic of > discussion, you should not reply to an existing message since it's > then confusingly related with the same thread; instead, compose a > *new* message with the appropriate subject. > > -- > \ “Either he's dead or my watch has stopped.” —Groucho Marx | > `\ | > _o__) | > Ben Finney I agree I should have posted a new topic, Point taken.. Thanks Gabriel ,I will try this if could not get this to work will post a new thread. zaheer.agadi@gmail.com |
|