|
From: Kent J. <ke...@td...> - 2005-02-17 15:29:58
|
Lauri Lehtinen wrote:
> Hi,
>
> I just noticed this, when I have this kind of code:
> ---
> def copyFile(filename):
> bi = open(filename)
> bo = open(filename+'.copy', 'w')
> b = 1000000
> while 1:
> l = bi.read(b)
> if len(l) == 0:
> break
> bo.write(l)
> bo.close()
> bi.close()
> return 1
> i = raw_input("Give file:")
> copyFile(i)
> ---
> and e.g. copy mp3 file with it the .copy mp3 file is somehow mixed and
> not working as it should, but when I run this with plain python it works
> just as it should. How to fix or workaround this? Is thus known bug?
Maybe you need to use binary mode?
bi = open(filename, 'b')
bo = open(filename+'.copy', 'wb')
How do the two files differ?
Kent
>
> I have tried to make the same using java's FileInputStream and
> FileOutputStream but then the performance is then very bad (about
> 500kB/s). Is that also known issue?
>
> Sincerely,
> Lauri Lehtinen
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
|