Skip to content

Commit

Permalink
fixes py2/py3 inconsistency opening taxdump.tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
jhcepas committed Aug 19, 2018
1 parent a01383d commit 91d1ece
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ete3/ncbi_taxonomy/ncbiquery.py
Expand Up @@ -744,13 +744,14 @@ def update_db(dbfile, targz_file=None):
md5_check = md5_file.readline().split()[0]
targz_file = "taxdump.tar.gz"
do_download = False
try:

if os.path.exists("taxdump.tar.gz"):
local_md5 = md5(open("taxdump.tar.gz", "rb").read()).hexdigest()
if local_md5 != md5_check:
do_download = True
else:
print('Local taxdump.tar.gz seems up-to-date', file=sys.stderr)
except FileNotFoundError:
else:
do_download = True
print('Downloading taxdump.tar.gz from NCBI FTP site (via HTTP)...', file=sys.stderr)
urlretrieve("http://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz", targz_file)
Expand Down

0 comments on commit 91d1ece

Please sign in to comment.