0

I'm trying to read in a list of account numbers, then have my program do a search in the appropriate directory for each account number. I want to capture the information from this search, to then split out the file name, date, and time as the output from my program. Currently I'm receiving this error: TypeError: bufsize must be an integer

Here is my code:

def app_files(level):
    piv_list_file = raw_input(r"Please enter the full path of the file containing the Pivot ID's you would like to check: ")
    piv_id_list = []
    proc_out_list = []
    input_dir = ''

    try:
        with open(piv_list_file, 'rbU') as infile:
            for line in infile:
                line = line.rstrip('\r\n')
                piv_id_list.append(line)
    except IOError as e:
        print 'Unable to open the account number file: %s' % e.strerror

    if level == 'p':
        input_dir = '[redacted]'
    else:
        input_dir = '[redacted]'    

    subprocess.call('cd', input_dir)
    for i, e in enumerate(piv_id_list):
        proc_out = subprocess.check_output('ls', '-lh', '*CSV*APP*{0}.zip'.format(e))
        proc_out_list.append(proc_out)
        print(proc_out)
2
  • 1
    In which line are you getting that error? Commented Jul 31, 2015 at 0:29
  • what is bufsize set as and where is it referenced? Commented Jul 31, 2015 at 2:21

1 Answer 1

1

Your subprocess.check_output() function call is wrong. You should provide the complete command as a list (as the first argument). Example -

subprocess.check_output(['ls', '-lh', '*CSV*APP*{0}.zip'.format(e)])

Similar issue with subprocess.call in your code .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.