Sublime Forum

Cant import python pexpect

#1

Hi,

im trying to write a plugin where i need the pexpect module.

I am able to import pexpect in python scripts outside sublime text, but in the plugin code i get:

Traceback (most recent call last): File "/usr/lib/sublime-text-2/sublime_plugin.py", line 62, in reload_plugin m = imp.load_module(modulename, *m_info) File "./grunt.py", line 1, in <module> import pexpect ImportError: No module named pexpect

Does anyone have a solution?

0 Likes

#2

At least on Windows ST2 use it’s own Python interpreter so you have to put pexpect module in a path where ST2 could find it. Your plugin package directory or user directory is fine.
I think it’s the same for linux. For OSX I think it’s the system Python interpreter that is used. But maybe I’m wrong here.

0 Likes