Closed Toilal closed 10 years ago
Can you create a unittest that reproduces this in babelfish? Currently the tests are passing: https://travis-ci.org/Diaoul/babelfish
I'll try to debug directly from guessit to fix the problem, but i think it may be a problem with entry points loading ... Wait and see :-)
Or resources loading
I found the cause of the problem.
hasattr(language.alpha2) with Python2 returns None, but raise LanguageConverterError on Python.
From python doc, it's the attended behavior :+1:
Python2: hasattr(object, name)¶ The arguments are an object and a string. The result is True if the string is the name of one of the object’s attributes, False if not. (This is implemented by calling getattr(object, name) and seeing whether it raises an exception or not.)
Python3: hasattr(object, name) The arguments are an object and a string. The result is True if the string is the name of one of the object’s attributes, False if not. (This is implemented by calling getattr(object, name) and seeing whether it raises an AttributeError or not.)
To be Python3 compatible, the __getattr__
method should raise AttributeError in this case, instead of LanguageConverterError
I have an error in guessit with Python3 (3.3.3 x86 on windows). It runs without any problem on Python 2.7.