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

add_type always fails #70

Open
TheMaddScientist opened this issue Jul 3, 2020 · 1 comment
Open

add_type always fails #70

TheMaddScientist opened this issue Jul 3, 2020 · 1 comment

Comments

@TheMaddScientist
Copy link

If you attempt to do an add_type with a subclass of Type, you always get the "instance must inherit from filetype.types.Type". This appears to be because isinstance only returns true for actual instances and not for subclasses. You need to use issubclass to check for subclasses. I am using Python 3.8, so this may be new behavior.

If I fix this error, I get a further buffer error. Attached is a zip file with my example code. You will need to change the file locations.
detect_file_type.zip

@dosas
Copy link

dosas commented Dec 20, 2020

@TheMaddScientist No, isintance is the correct call but you need to add an instance of your tLilyPond class!

ft.add_type(tLilyPond())

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

2 participants