Managing python import dependencies in SublimeText2 plugin. in particular unicodedata lib

I am trying to fix a small SublimeText2 plugin . it seems the problem (from SublimeText python console) was an import error:

Traceback (most recent call last): File ".\sublime_plugin.py", line 62, in reload_plugin File ".\rtl.py", line 4, in <module> from algorithm import get_display File "lang\algorithm.py", line 20, in <module> from unicodedata import bidirectional, mirrored ImportError: No module named unicodedata 

since unicodedata is a standard python library, I tried to import it directly into the console and got the same import error. I realized that this is due to the fact that sublimetext does not use the python version installed by the system (I use python2.7 on a Windows computer), but it has a 2.6 python bundled which does not link the entire standard library.

when i try to import from my regular python interpreter everything works fine.

I tried adding a .pth file that points to "c: \ python27 \ lib" and site packages, etc., which did not help. adding directly to the following path:

 sys.path.append(c:\\Python27\\lib) 

also did not help. also tried to configure the user settings file to include:

 { "PATH": "C:\\Python27;c:\\Python27\\Scripts", "PYTHONPATH": "C:\\Python27\\Lib;C:\\Python27\\Lib\\site-packages;C:\\Python27\\DLLs" } 

my question is divided into two:

  • how to solve this problem specifically on my developer's computer
  • What is the right way to solve this problem for people trying to install a plugin. which makes the plugin dynamically aware of installing python by default and adding it to the path.

In addition, the strangest thing: the main SublimeText folder in the program files actually contains the unicodedata.pyd file. so I can’t understand what the problem is!

+6
source share
1 answer

It looks like this might be a ST2 error, and not what you are doing wrong: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=3462

+2
source

Source: https://habr.com/ru/post/928116/


All Articles