Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: support pathlib objects #8

Open
armijnhemel opened this issue Aug 25, 2021 · 1 comment
Open

request: support pathlib objects #8

armijnhemel opened this issue Aug 25, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@armijnhemel
Copy link
Contributor

Currently telfhash doesn't support pathlib objects https://docs.python.org/3/library/pathlib.html and gives an error:

>>> import telfhash
>>> import pathlib
>>> a = pathlib.Path('/bin/ls')
>>> type(a)
<class 'pathlib.PosixPath'>
>>> telfhash.telfhash(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/g4a5izmyv29k6jibzmwa9a8yv2gyj1nw-python3-3.9.6-env/lib/python3.9/site-packages/telfhash/telfhash.py", line 487, in telfhash
    files_list += expand_filepath(path, recursive=recursive)
  File "/nix/store/g4a5izmyv29k6jibzmwa9a8yv2gyj1nw-python3-3.9.6-env/lib/python3.9/site-packages/telfhash/telfhash.py", line 353, in expand_filepath
    for filepath in glob.glob(input_filepath):
  File "/nix/store/81lwy2hfqj4c1943b1x8a0qsivjhdhw9-python3-3.9.6/lib/python3.9/glob.py", line 22, in glob
    return list(iglob(pathname, recursive=recursive))
  File "/nix/store/81lwy2hfqj4c1943b1x8a0qsivjhdhw9-python3-3.9.6/lib/python3.9/glob.py", line 44, in _iglob
    if not has_magic(pathname):
  File "/nix/store/81lwy2hfqj4c1943b1x8a0qsivjhdhw9-python3-3.9.6/lib/python3.9/glob.py", line 156, in has_magic
    match = magic_check.search(s)
TypeError: expected string or bytes-like object

It would be nice if pathlib could be supported in the future.

@merces merces self-assigned this Feb 9, 2022
@merces merces added the enhancement New feature or request label Feb 9, 2022
@merces
Copy link
Member

merces commented Feb 9, 2022

Thanks for your suggestion. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants