Skip to content

Commit

Permalink
cli: fix py3.9 importlib usage
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 27, 2022
1 parent c1e7ace commit 6426c55
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tqdm/cli.py
Expand Up @@ -254,8 +254,11 @@ def write(_):

def cp(name, dst):
"""copy resource `name` to `dst`"""
with resources.path('tqdm', name) as src:
copyfile(str(src), dst)
if hasattr(resources, 'files'):
copyfile(str(resources.files('tqdm') / name), dst)
else: # py<3.9
with resources.path('tqdm', name) as src:
copyfile(str(src), dst)
log.info("written:%s", dst)
if manpath is not None:
cp('tqdm.1', path.join(manpath, 'tqdm.1'))
Expand Down

0 comments on commit 6426c55

Please sign in to comment.