Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103461

Re: child.before taking almost 1 minute to execute

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: child.before taking almost 1 minute to execute
Date Thu, 25 Feb 2016 10:09:52 +1300
Lines 20
Message-ID <dj6kh2FddcnU1@mid.individual.net> (permalink)
References <ae3896fc-10e2-436f-aaac-bfb201f83c81@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 2uNtWbmT0vsY2ODqwFlXRQFD+mxuUJ4S5mw9T6YJ2jLNRpy4mX
Cancel-Lock sha1:bNbazKctWc+Q0SjdZBCaljLHbqg=
User-Agent Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
X-Accept-Language en-us, en
In-Reply-To <ae3896fc-10e2-436f-aaac-bfb201f83c81@googlegroups.com>
Xref csiph.com comp.lang.python:103461

Show key headers only | View raw


pyfreek wrote:
> 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))
>                 p.expect([pexpect.EOF,pexpect.TIMEOUT])
>                 if 'No such file' in p.before:
>                         print "No such directory exists!!"
>                         sys.exit(1)

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.

-- 
Greg

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

child.before taking almost 1 minute to execute pyfreek <sruthi223@gmail.com> - 2016-02-24 07:42 -0800
  Re: child.before taking almost 1 minute to execute Emile van Sebille <emile@fenx.com> - 2016-02-24 12:57 -0800
    Re: child.before taking almost 1 minute to execute sruthi223@gmail.com - 2016-02-25 07:12 -0800
  Re: child.before taking almost 1 minute to execute Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-25 10:09 +1300
    Re: child.before taking almost 1 minute to execute sruthi223@gmail.com - 2016-02-25 07:12 -0800

csiph-web