views:

147

answers:

1

I want to run wexpect (the windows port of pexpect) on my Windows 7 64-bit machine. I am getting the following error: C:\Program Files (x86)\wexpect\build\lib>wexpect.py Traceback (most recent call last): File "C:\Program Files (x86)\wexpect\build\lib\wexpect.py", line 97, in raise ImportError(str(e) + "This package was intended for Windows like operating systems.") ImportError: No module named win32console This package requires the win32 python packages.This package was intended for Windows like operatin g systems.

In the code it is failing on the following line: from win32console import *

I am using Python 2.6.4. I cannot figure out how to install win32console.

+2  A: 

Install this: http://sourceforge.net/projects/pywin32/

Edit to add slightly longer explanation: There's a very useful set of Windows-specific Python modules, called PyWin32. I believe win32console is part of that. You can either install PyWin32 on top of the standard python.org release of Python, or you can install ActiveState ActivePython which bundles everything you need all together. I'm using ActivePython and I have a win32console module.

user9876
Installed it and linked it to my python 2.6 installation. Still the same error. Do I need to restart Python or something?
David
Start a new interactive Python session (by typing "python") and type the command "import win32console". What happens?
user9876
I did, though, get a program called PythonWin. It provides a python console. In this console the win32console exists.
David
Just writing python from command line yielded the following result:C:\Program Files (x86)\wexpect\build\lib>pythonPython 2.6.4 (r264:75708, Oct 26 2009, 07:36:50) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> from win32console import *Traceback (most recent call last): File "<stdin>", line 1, in <module>ImportError: No module named win32console
David
I suspect you have 2 (or more) different versions of Python installed. Does wexpect ship with it's own version of Python? You can figure out which Python you're using by typing "import sys" then "print sys.executable" - that works at Python command prompt or from a Python script.
user9876
(The reason for my suspicion is that you have "a program called PythonWin. It provides a python console. In this console the win32console exists." yet when you just type "python" you get a different version of Python which doesn't have win32console).
user9876