Skip to content

Commit

Permalink
If error in decoding replace it.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBelcour committed Oct 8, 2020
1 parent 03b042a commit dae2c46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mpwt/pwt_wrapper.py
Expand Up @@ -134,7 +134,7 @@ def run_pwt(species_input_folder_path, patho_hole_filler, patho_operon_predictor
with open(pwt_log, 'w') as pwt_writer:
for patho_line in iter(patho_subprocess.stdout.readline, b''):
encoding = chardet.detect(patho_line)['encoding']
patho_line = patho_line.decode(encoding)
patho_line = patho_line.decode(encoding, errors='replace')
pwt_writer.write(patho_line)
if any(error in patho_line for error in errors):
logger.info('Error possibly with the genbank file.')
Expand Down Expand Up @@ -198,7 +198,7 @@ def run_pwt_dat(species_input_folder_path):
with open(dat_log, 'w') as dat_file_writer:
for load_line in iter(load_subprocess.stdout.readline, b''):
encoding = chardet.detect(load_line)['encoding']
load_line = load_line.decode(encoding)
load_line = load_line.decode(encoding, errors='replace')
dat_file_writer.write(load_line)
if any(dat_end in load_line for dat_end in dat_creation_ends):
load_subprocess.stdout.close()
Expand Down

0 comments on commit dae2c46

Please sign in to comment.