Sublime Forum

Import xml.parsers.expat

#1

Hello everybody.

When importing xml.parsers.expat from within sublime plugin I get an error:

File "./PluginRT.py", line 1, in <module> import xml.parsers.expat File ".\xml\parsers\expat.py", line 4, in <module> ImportError: No module named pyexpat
The bundled ST python seems to have this module, zipped inside python26.zip

Is there a way I could fix this and use xml.parsers.expat? Maybe the error is platform-specific (I’m on Linux)?

0 Likes

#2

I think this might be platform specific I will have to check my linux box at home, but I just tried tried to import xml.parsers.expat on a windows box here at work, and it was included without error.

0 Likes

#3

Yeah, I was able to check it myself too — expat is loadable in windows version, but not in linux version (checked with fresh profile just in case).

Btw., select python module is missing altogether, unfortunately, though it seems to be the part of standard Python bundle.

0 Likes

#4

The linux package does not distribute the pyd files; I believe that is why. Windows package includes pyexpat.pyd, select.pyd, and others, while linux has none.

expat cannot be loaded without pyexpat.pyd

0 Likes

#5

And how to fix it for Linux?

Any ideas?

Interesting package github.com/a-sk/sublime-css-colors also generates this error. :cry:

0 Likes

#6

in my ubuntu with default python 2.7 for some packages I did next trick:

import sys
sys.path.append("/usr/lib/python2.6/lib-dynload/")

/usr/lib/python2.6/lib-dynload - in that folder is pyexpat on the local machine.

0 Likes