Home Download Buy Blog Forum Support

import xml.parsers.expat

import xml.parsers.expat

Postby DSHugo on Tue Oct 18, 2011 7:45 pm

Hello everybody.

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

Code: Select all
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)?
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: import xml.parsers.expat

Postby facelessuser on Tue Oct 18, 2011 8:08 pm

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.
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: import xml.parsers.expat

Postby DSHugo on Tue Oct 18, 2011 9:03 pm

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.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: import xml.parsers.expat

Postby facelessuser on Tue Oct 18, 2011 9:38 pm

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
facelessuser
 
Posts: 1575
Joined: Tue Apr 05, 2011 7:38 pm

Re: import xml.parsers.expat

Postby rmaksim on Wed Nov 30, 2011 7:43 am

And how to fix it for Linux?

Any ideas?

Interesting package https://github.com/a-sk/sublime-css-colors also generates this error. :cry:
rmaksim
 
Posts: 59
Joined: Sat Jul 02, 2011 7:31 pm

Re: import xml.parsers.expat

Postby rmaksim on Tue Dec 06, 2011 12:24 pm

in my ubuntu with default python 2.7 for some packages I did next trick:
Code: Select all
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.
rmaksim
 
Posts: 59
Joined: Sat Jul 02, 2011 7:31 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 29 guests