Workaround: Failed to import unicodedata in Sublime Text 2 under Windows

It’s weird, while importing some .pyd modules, like pyexpat, unicodedata in Windows version of Sublime Text 2, you will get ImportError, for example:

1
import unicodedata

Will result in:

1
Import Error: No module named unicodedata

However, since standard pyd modules are not missing, reside correctly in the same folder as sublime_text.exe, we can add that folder to sys.path in order to allow embedded python interpreter to load these modules:

1
sys.path.insert(os.path.dirname(sys.executable))

After that, you can import these standard python modules without pain, I hope it’s useful for Sublime Text 2 packages developers who met the same problem before.