Python pexpect timeout issues

Discussion in 'Mac Programming' started by msjones, Jan 11, 2013.

  1. macrumors 6502

    msjones

    Joined:
    Oct 18, 2007
    Location:
    Nottinghamshire, UK
    #1
    Hi,

    Hoping someone here can give me some advice with a script I'm working on. To start with here is the function I am having a problem with:

    Code:
    for file in os.listdir(bkpdir):
            child = pexpect.spawn('scp %s/%s USER@IPADDRESS:/folder/path/%s' % (bkpdir, file, date))
            child.expect("password: ")
            child.sendline("password")
            data = child.read()
            child.close()
    As you can see from the above code snippet I am trying to scp all the files (one by one) in a backup dir to another location on the local LAN.

    My issues begins when the script reaches a file > 100MB. Pexpect seems to be timing out before the file has successfully copied. Some files that will be going over are > 1.5GB, so if possible I would like to find a resolution to this issue.

    Thanks
     
  2. thread starter macrumors 6502

    msjones

    Joined:
    Oct 18, 2007
    Location:
    Nottinghamshire, UK
    #2
    Problems solved. I just needed timeout=None.

    Code:
    child = pexpect.spawn('scp %s/%s USER@IPADDRESS:/folder/path/%s' % (bkpdir, file, date), timeout=None)
    Sorry for the wasted post, please close.
     

Share This Page