pythoncom.CoInitialize() not recognised in Eclipse

KB keith at nekotaku.com
Mon Mar 29 13:16:40 EDT 2010


On Mar 28, 8:16 pm, Jason Scheirer <jason.schei... at gmail.com> wrote:
> On Mar 28, 7:14 pm, KB <ke... at nekotaku.com> wrote:
>
>
>
> > Hi there,
>
> > I have in the past used PythonWin to write python for COM, and
> > switched to Eclipse.
>
> > I am getting an error from the IDE saying it does not recognise
> > CoInitialize():
>
> > ****
> > import pythoncom
>
> > pythoncom.CoInitialize()
> > pythoncom.CoUninitialize()
> > ****
>
> > (red X next to the two bottom lines saying: "Undefined variable from
> > import: CoInitialize")
>
> > If I open a PyDev/Python Console window in Eclipse, I can type the
> > above, no errors, no problem.
>
> > I tried removing my Python Interpreter and re-adding/re-building but
> > no change.
>
> > python 2.5.2
> > eclipse 3.5.1
> > pydev 1.5.0
>
> > Thanks!
>
> PyDev is probably only looking at functions/classes defined in Python
> source files and not ones defined in C extensions.
>
> To confirm, try typing this in the window:
>
> import _ctypes
> _ctypes._Pointer()
>
> If it says that _ctypes._Pointer doesn't exist, then that's obviously
> the problem.

No problems at all with the editor recognising the above. Also note
that I tried the pythoncom snippet in my OP from the IDE's python
console without issue... weird.



More information about the Python-list mailing list