miludedeng / conque

Automatically exported from code.google.com/p/conque
0 stars 0 forks source link

Python cannot load ctypes module on win32 gui vim that has python support and can import ctypes #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

When I run :ConqueTerm cmd.exe, I get this message:
"Conque ERROR: Python cannot load the ctypes module"

Note: The command works with the cygwin version of vim, but not the gui win32 
version.

What version of the product are you using? On what operating system?
Using version 2.3 of ConqueTerm.
I am using the latest 7.3 of gvim for win32.
Vim is compiled with python support.  (I have verified with :version and I can 
run other vim plugins that require python.)
I have python 2.7.2 installed and can import ctypes when I run python from a 
command line. So it seems the message about not being able to load ctypes is 
false.

In my vimrc, I tried to point to the python.exe explicitly:
  let g:ConqueTerm_PyExe='d:\opt\Python27\python.exe'
  let g:ConqueTerm_PyVersion = 2

Do you have any suggestions to debug this? It feels like a bug to me.

Original issue reported on code.google.com by darcypar...@gmail.com on 28 Nov 2011 at 11:15

GoogleCodeExporter commented 8 years ago
Try running the following command in Vim and see if it gives any more helpful 
errors:

:python import sys
:python print(sys.version)
:python import ctypes

If the first command fails it means Vim can't find your python library at all. 
If the first two commands work, check to make sure the version Vim finds is 2.7.

If it's finding 2.7, the last command should at least print out some more 
helpful error messages.

Original comment by nicora...@gmail.com on 28 Nov 2011 at 11:32

GoogleCodeExporter commented 8 years ago
Thanks for the debugging tips! This lead me to find out that I had the 64bit 
version of python 2.7 installed (which also came with the 32bit version). The 
solution was to uninstall and download/install just the 32bit version.

:python import sys worked

:python print(sys.version) returns: 
2.7.2 (default, June 12, 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

Interestingly, when I run print(sys.version) inside a python shell, I see it is 
a 64bit version...

:python import ctypes returns:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\opt\Python27\Lib\ctypes\__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
Import Error: DLL load failed: %1 is not a valid Win32 application.

After uninstalling the 64 bit version of Python and only installing the 32bit 
version, conqueterm works.

Thanks again.

Original comment by darcypar...@gmail.com on 29 Nov 2011 at 12:04

GoogleCodeExporter commented 8 years ago

Original comment by nicora...@gmail.com on 30 Nov 2011 at 11:31