views:

236

answers:

1

Hello,

I'm running 32-bit Windows XP and trying to have Matlab communicate with Cgate, a command line program. I'd like to make this happen using wexpect, which is a port of Python's module pexpect to Windows. I'm having trouble installing or importing wexpect though. I've put wexpect in the folder Lib, along with all other modules. I can import those other modules but just not wexpect. Commands I've tried include:

import wexpect
import wexpect.py
python wexpect.py install
python wexpect.py install --home=~
wexpect install

Does anyone have anymore ideas?

A: 

If you installed wexpect somewhere in the module search path (sys.path), then import wexpect is what you would use. You have to make sure you installed it in the right path, though (the usual location is Lib\site-packages inside the Python installation.) If the package wexpect.py was in came with a setup.py file, you could install it with

\path\to\python setup.py install

from a DOS prompt. Depending on what else you did you may need to restart the Python interpreter or IDE that you're using for it to pick it up. You should also pay attention to the errors you get when you try import wexpect, as it may have dependencies you need to install.

Thomas Wouters