because there was no separate bytes type\ was expanded to \ \ opening the local file in binary mode for ftplib to read also means no unicode decoding will occurthe text is sent over sockets as byte string in already encoded form all of which isof coursea prime lesson on the impacts of unicode encodingsconsult the module ftplib py in the python source library directory for more details for binary mode transfersthings are simpler--we open the local file in rb binary mode to suppress unicode decoding and automatic mapping everywhereand return the bytes strings expected by ftplib on read binary data is not unicode textand we don' want bytes in an audio file that happen to have the same value as \ to magically disappear when read on windows as for the mirror download scriptthis program simply iterates over all files to be transferred (files in the local directory listing this time)and transfers each in turn--in either text or binary modedepending on the filesnames here is the command use to upload my entire website from my laptop windows pc to remote linux server at my ispin single stepc:\pp \internet\ftp\mirroruploadflat py test password for lutz on learning-python comclean remote directory firsty connecting deleting remote cannot delete remote deleting remote cannot delete remote deleting remote -longmont-classes html deleting remote -longmont-classes html deleting remote -longmont-classes html deleting remote about-lp html deleting remote about-lp html deleting remote about-lp html deleting remote about-lp html lines omitted uploading test\ -longmont-classes html to -longmont-classes html as text uploading test\ -longmont-classes html to -longmont-classes html as text uploading test\ -longmont-classes html to -longmont-classes html as text uploading test\about-lp html to about-lp html as text uploading test\about-lp html to about-lp html as text uploading test\about-lp html to about-lp html as text uploading test\about-lp html to about-lp html as text uploading test\about-pp-japan html to about-pp-japan html as text lines omitted uploading test\whatsnew html to whatsnew html as text uploading test\whatsold html to whatsold html as text uploading test\wxpython doc tgz to wxpython doc tgz as application gzip uploading test\xlate-lp html to xlate-lp html as text transferring directories with ftplib