Mercurial > repos > greg > gene_family_integrator
comparison utils.py @ 16:27c0651f04e3 draft
Uploaded
author | greg |
---|---|
date | Fri, 05 May 2017 10:30:33 -0400 |
parents | 0dd84595cf37 |
children | 3e5b6faed522 |
comparison
equal
deleted
inserted
replaced
15:31042dc87180 | 16:27c0651f04e3 |
---|---|
22 def get_response_buffers(): | 22 def get_response_buffers(): |
23 fstderr = os.path.join(os.getcwd(), FSTDERR) | 23 fstderr = os.path.join(os.getcwd(), FSTDERR) |
24 fherr = open(fstderr, 'wb') | 24 fherr = open(fstderr, 'wb') |
25 fstdout = os.path.join(os.getcwd(), FSTDOUT) | 25 fstdout = os.path.join(os.getcwd(), FSTDOUT) |
26 fhout = open(fstdout, 'wb') | 26 fhout = open(fstdout, 'wb') |
27 return fherr, fhout | 27 return fstderr, fherr, fstdout, fhout |
28 | 28 |
29 | 29 |
30 def move_directory_files(source_dir, destination_dir): | 30 def move_directory_files(source_dir, destination_dir): |
31 source_directory = os.path.abspath(source_dir) | 31 source_directory = os.path.abspath(source_dir) |
32 destination_directory = os.path.abspath(destination_dir) | 32 destination_directory = os.path.abspath(destination_dir) |
36 source_entry = os.path.join(source_directory, dir_entry) | 36 source_entry = os.path.join(source_directory, dir_entry) |
37 shutil.move(source_entry, destination_directory) | 37 shutil.move(source_entry, destination_directory) |
38 | 38 |
39 | 39 |
40 def run_command(cmd): | 40 def run_command(cmd): |
41 fherr, fhout = get_response_buffers() | 41 fstderr, fherr, fstdout, fhout = get_response_buffers() |
42 proc = subprocess.Popen(args=cmd, stderr=fherr, stdout=fhout, shell=True) | 42 proc = subprocess.Popen(args=cmd, stderr=fherr, stdout=fhout, shell=True) |
43 rc = proc.wait() | 43 rc = proc.wait() |
44 # Check results. | 44 # Check results. |
45 fherr.close() | 45 fherr.close() |
46 fhout.close() | 46 fhout.close() |