WARNING: Application raises traceback error when used with certain Python versions
Closed this issue · 0 comments
The Issue
Hello!
So during development, after extensively testing V2Mp3, no problems were found when running the application locally in a dev environment.
However, when testing the application in a typical user environment, the following exception was returned upon running V2Mp3, causing the program to immediately close:
- AttributeError: module 'typing' has no attribute '_ClassVar'. Did you mean: 'ClassVar'?
Full Traceback
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import V2Mp3
File "C:\Python\lib\site-packages\V2Mp3\__init__.py", line 1, in <module>
from .main import main as v2mp3
File "C:\Python\lib\site-packages\V2Mp3\main.pyw", line 12, in <module>
from V2Mp3.appEvents.events import _event_loop
File "C:\Python\lib\site-packages\V2Mp3\appEvents\events.py", line 5, in <module>
import moviepy.editor as mv
File "C:\Python\lib\site-packages\moviepy\editor.py", line 24, in <module>
import imageio
File "C:\Python\lib\site-packages\imageio\__init__.py", line 24, in <module>
from .core import FormatManager, RETURN_BYTES
File "C:\Python\lib\site-packages\imageio\core\__init__.py", line 16, in <module>
from .format import Format, FormatManager
File "C:\Python\lib\site-packages\imageio\core\format.py", line 40, in <module>
from ..config import known_plugins, known_extensions, PluginConfig, FileExtension
File "C:\Python\lib\site-packages\imageio\config\__init__.py", line 7, in <module>
from .plugins import known_plugins, PluginConfig
File "C:\Python\lib\site-packages\imageio\config\plugins.py", line 3, in <module>
from ..core.legacy_plugin_wrapper import LegacyPlugin
File "C:\Python\lib\site-packages\imageio\core\legacy_plugin_wrapper.py", line 5, in <module>
from .v3_plugin_api import PluginV3, ImageProperties
File "C:\Python\lib\site-packages\imageio\core\v3_plugin_api.py", line 9, in <module>
class ImageProperties:
File "C:\Python\lib\site-packages\dataclasses.py", line 958, in dataclass
return wrap(_cls)
File "C:\Python\lib\site-packages\dataclasses.py", line 950, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
File "C:\Python\lib\site-packages\dataclasses.py", line 800, in _process_class
cls_fields = [_get_field(cls, name, type)
File "C:\Python\lib\site-packages\dataclasses.py", line 800, in <listcomp>
cls_fields = [_get_field(cls, name, type)
File "C:\Python\lib\site-packages\dataclasses.py", line 659, in _get_field
if (_is_classvar(a_type, typing)
File "C:\Python\lib\site-packages\dataclasses.py", line 550, in _is_classvar
return type(a_type) is typing._ClassVar
AttributeError: module 'typing' has no attribute '_ClassVar'. Did you mean: 'ClassVar'?
Cause of Issue
-
This is apparently caused by an incompatibility with the
dataclasses
module and certain Python versions, such asPython 3.6>
as first referenced here. -
While never appearing in the V2Mp3 source code, the
dataclasses
module appears to be accessed by one of V2Mp3's dependencies,moviepy
, which may explain why the exception occurs.
Workaround/Fix
Currently, the solution to this issue is to simply uninstall the dataclasses
module if you are using Python 3.6 or above, as explained in this reply, and also here.
-
To fix this issue, enter the following command in your terminal/CLI:
pip uninstall dataclasses -y
-
Once the workaround is applied, there should be no issues when running V2Mp3.
-
If any other workarounds or permanent fixes are found, I will update and list them accordingly.