Mercurial > repos > greg > gene_family_classifier
comparison utils.py @ 144:5b1873b55da5 draft
Uploaded
| author | greg |
|---|---|
| date | Fri, 05 May 2017 10:30:15 -0400 |
| parents | 9fdc9793f9d3 |
| children | 238b555c57b5 |
comparison
equal
deleted
inserted
replaced
| 143:ed98449ee8a9 | 144:5b1873b55da5 |
|---|---|
| 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() |
