FTP Offset larger than file.

Hrvoje Niksic hniksic at xemacs.org
Tue Jul 28 17:22:38 CEST 2009


Bakes <bakes at ymail.com> writes:

>> > As a quick fix, you can add a file.flush() line after the
>> > file.write(...) line, and the problem should go away.
>>
>> Thank you very much, that worked perfectly.
>
> Actually, no it didn't. That fix works seamlessly in Linux, but gave
> the same error in a Windows environment. Is that expected?

Consider opening the file in binary mode, by passing the 'wb' and 'ab'
modes to open instead of 'w' and 'a' respectively.  On Windows, python
(and other languages) will convert '\n' to '\r\n' on write.



More information about the Python-list mailing list