Read / Write image file

Maciej Dziardziel fiedzia at fiedzia.prv.pl
Tue May 3 14:44:26 EDT 2005


codecraig wrote:

> I have a image file on my pc, say a .jpg.  Basically I want to setup a
> client/server socket, and I want the client to read in the jpg and send
> it to the server, where the server can write that data into a new file
> on the server.
> 
> I tried just doing something like..
> 
> x = open("abc.jpg")
> y = x.read()
> tmp = open("newFile.jpg", "w")
> tmp.write(y)
> tmp.close()
> x.close()
> 
> ...but that doesn't give me a copy of abc.jpg
> 
> any ideas?  Thanks

Give us more details. The code above works well for me. (python2.3).

-- 
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl



More information about the Python-list mailing list