As you may know, Vim has offered an embedded Python for several years.
I'm updating the Win64 port of Vim and decided to make the Python
interface work too.
I think I've fixed all the tedious Py_ssize_t issues, and the simple
sanity test of
:py print "hi"
works. However, more complex examples fall over with ImportErrors. As
far as I can tell, it's related to sys.path, which shows as:
['', 'd:\\Python25\\python25.zip', '.\\DLLs', '.\\lib',
'.\\lib\\plat-win', '.\\lib\\lib-tk', 'D:\\vimsrc\\vim7\\src']
When I run python interactively, sys.path looks like:
['', 'd:\\Python25\\python25.zip', 'd:\\Python25\\DLLs',
If I modify sys.path to use the fully qualified pathnames, things
start working. If I build a 32-bit version of Vim, things work out of
I'm loading python25.dll; i.e., Vim was compiled with
-DDYNAMIC_PYTHON. The python25.dll was installed by
My patches (and the complete if_python.c) can be found at
/George V. Reilly
We have developed a C project and we want to write unit test for it. I used
a sample VC++ project with Python using swig (to wrap a ".i" file).
My C functions has a return value and formal parameters could be pointers or
scalars, I need to pass some of them by reference to get the value back.
Here's an example of a function of mine (functional test OK):
S32 CALENDAR_RequestHandlerFunction (U32 U32RequestID, void* pArg1, void*
pArg2, void* pArg3);
pArg1 or pArg2 or pArg3 could point to anything and could be IN or OUT.
I imported "ctypes" module in my "test.py" file, but Python complain from
"pArg1" saying: "TypeError: in method CALENDAR_RequestHandlerFunction',
argument 2 of type 'void *'
Notice that I used the same proto in my ".i" file.
Any help to test C functions using Python and avoid C types problems?