facelessuser / sublime-coloraide

ColorAide dependency for Sublime Text
MIT License
1 stars 0 forks source link

Can't import typing module on Python 3.3 #2

Closed jwortmann closed 2 years ago

jwortmann commented 2 years ago
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text\Lib\python33\sublime_plugin.py", line 308, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Users\jwortmann\AppData\Roaming\Sublime Text\Packages\QuickView\quick_view.py", line 12, in <module>
    from coloraide import Color
  File "C:\Users\JWORTM~1\AppData\Roaming\SUBLIM~3\Packages\COLORA~1\st3\coloraide\__init__.py", line 3, in <module>
    from .color import Color, ColorMatch
  File "C:\Users\JWORTM~1\AppData\Roaming\SUBLIM~3\Packages\COLORA~1\st3\coloraide\color.py", line 5, in <module>
    from . import distance
  File "C:\Users\JWORTM~1\AppData\Roaming\SUBLIM~3\Packages\COLORA~1\st3\coloraide\distance\__init__.py", line 4, in <module>
    from .. import algebra as alg
  File "C:\Users\JWORTM~1\AppData\Roaming\SUBLIM~3\Packages\COLORA~1\st3\coloraide\algebra.py", line 28, in <module>
    from .types import ArrayLike, MatrixLike, VectorLike, Array, Matrix, Vector, SupportsFloatOrInt
  File "C:\Users\JWORTM~1\AppData\Roaming\SUBLIM~3\Packages\COLORA~1\st3\coloraide\types.py", line 2, in <module>
    from typing import Union, Any, Mapping, Sequence, List, TypeVar, TYPE_CHECKING
ImportError: No module named 'typing'

A possible way how LSP solves it: https://github.com/sublimelsp/LSP/blob/main/plugin/core/typing.py

jwortmann commented 2 years ago

In case you use other code in coloraide 1.0 which is not compatible with Python 3.3 you would probably need to downgrade to an older version which is still compatible :confused:

facelessuser commented 2 years ago

No, you just need the typing dependency too. I should have put that on the readme.

jwortmann commented 2 years ago

Ah, good idea. I will update my package with that.

facelessuser commented 2 years ago

It's too much of a pain to backport all of that stuff out. Once ST allows Py 3.8 dependencies (hopefully before I grow old and die), we can drop that dependency.