child.before taking almost 1 minute to execute
greg.ewing at canterbury.ac.nz
Wed Feb 24 16:09:52 EST 2016
> The following snippet alone is taking 1 minute to execute. is there any best way to find 'No such file' other than using child.before
> if not scrutinFile.startswith('/') :
> scrutinFile = '/'+ scrutinFile
> scrutinFileFtp = directory + scrutinFile
> filePath, file = os.path.split(scrutinFileFtp)
> p.sendline('cd %s'%(filePath))
> if 'No such file' in p.before:
> print "No such directory exists!!"
If you're talking to an ftp client here, you might like
to consider using the ftplib module in the standard
library. It ought to take care of the messy details
of error detection for you.
More information about the Python-list