ORA-03113: End of file for communication channel-perfect solution

Source: Internet
Author: User

Download directory with FTP server
ImportOs,sys fromFtplibImportFTP fromMimetypesImportguess_typenonpassive= False#passive FTP By defaultRemotesite ='192.168.191.1'Remotedir='.'                                                            #Path to FTPRemoteUser = ()#because I didn't set the password, so it's emptyLocaldir='.'                                                             #Local PathClean_all= Input ('Clean Local directory first?') [: 1]inch['y','Y']#whether to clear all local directory files#Connection PftpPrint('Connecting ...') Connection=FTP (remotesite) Connection.login (*RemoteUser) connection.cwd (remotedir)ifNONPASSIVE:CONNECTION.SET_PASV (False)#Most servers do passive#ClearifClean_all: forLocalNameinchOs.listdir (localdir):Try:            Print('deleting local', LocalName) os.remove (Os.path.join (remotedir,localname))except:            Print('Cannot delete', LocalName) Count=0remotefiles=Connection.nlst ()#only files in the directory can be downloaded and directories in the directory cannot be downloaded forRemoteNameinchRemotefiles[:5]:    ifRemoteNameinch('.','..')or  not '.' inchRemoteName:Continue             #determine whether the directory, here according to the actual situation changesMimetype,encoding =Guess_type (remotename) mimetype= MimeTypeor '?/?'mimetype= Mimetype.split ('/') [0] LocalPath=Os.path.join (localdir,remotename)Print('Downing', RemoteName,' to', localpath,end=' ')    Print(' as', mimetype,encodingor "')    #Save File    ifMimeType = ='text'  andencoding = =None:localfile= Open (LocalPath,'W', encoding=connection.encoding) Callback=LambdaLine:localfile.write (line +'\ n') Connection.retrlines ('RETR'+remotename,callback)Else: LocalFile= Open (LocalPath,'WB') Connection.retrbinary ('RETR'+remotename,localfile.write) localfile.close () Count+ = 1connection.quit ()Print('Done :', Count,'file download.')

Uploading a directory with an FTP server
ImportOs,sys fromFtplibImportFTP fromMimetypesImportguess_typenonpassive= False#passive FTP By defaultRemotesite ='192.168.191.1'Remotedir='RRR'                                                            #Path to FTPRemoteUser = ()#because I didn't set the password, so it's emptyLocaldir='TTT'                                                             #Local PathClean_all= Input ('Clean Local directory first?') [: 1]inch['y','Y']#whether to clear all files from remote directory#Connection PftpPrint('Connecting ...') Connection=FTP (remotesite) Connection.login (*RemoteUser) connection.cwd (remotedir)ifNONPASSIVE:CONNECTION.SET_PASV (False)#Most servers do passive#ClearifClean_all: forRemoteNameinchconnection.nlst ():Try:            Print('deleting local', RemoteName) connection.delete (remotename)except:            Print('Cannot delete', RemoteName) Count=0localfiles=Os.listdir (Localdir)#only files in the directory can be downloaded and directories in the directory cannot be downloaded forLocalNameinchLocalfiles[:5]: mimetype,encoding=Guess_type (localname) mimetype= MimeTypeor '?/?'mimetype= Mimetype.split ('/') [0] LocalPath=Os.path.join (localdir,localname)Print('Downing', LocalName,' to', localpath,end=' ')    Print(' as', mimetype,encodingor "')    #Save File    ifMimeType = ='text'  andencoding = =None:localfile= Open (LocalPath,'RB') Connection.storlines ('RETR'+localname,localfile)Else: LocalFile= Open (LocalPath,'RB') Connection.storbinary ('RETR'+localname,localfile) localfile.close () Count+ = 1connection.quit ()Print('Done :', Count,'file uploaded.')

ORA-03113: End of file for communication channel-perfect solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.