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

AttributeError: 'function' object has no attribute 'archive' #60

Closed
fili opened this issue Mar 26, 2020 · 2 comments
Closed

AttributeError: 'function' object has no attribute 'archive' #60

fili opened this issue Mar 26, 2020 · 2 comments

Comments

@fili
Copy link

fili commented Mar 26, 2020

FYI

import filetype
import gzip

>>> filetype.helpers.is_archive(gzip.compress(b'test'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/filetype/helpers.py", line 74, in is_archive
    return match.archive(obj) is not None
AttributeError: 'function' object has no attribute 'archive'

Seems there is a naming conflict when using helpers directly with the filetype.match.match and filetype.match.archive

Going around the helpers works though:

import gzip
from filetype.match import archive

>>> bool(archive(gzip.compress(b'test')))
True
@DanielSwain
Copy link
Contributor

I can confirm this problem:

from filetype import helpers
helpers.is_audio('/path/to/file.txt')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/opt/virtualenvs/venv/lib/python3.6/site-packages/filetype/helpers.py", line 90, in is_audio
    return match.audio(obj) is not None
AttributeError: 'function' object has no attribute 'audio'

DanielSwain added a commit to DanielSwain/filetype.py that referenced this issue Apr 28, 2020
h2non added a commit that referenced this issue Apr 28, 2020
Fix helper functions not working - issue #60
@DanielSwain
Copy link
Contributor

@h2non Reminder to close this issue

@h2non h2non closed this as completed Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants