[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

pythoncom.CoInitialize() not recognised in Eclipse

pythoncom.CoInitialize() not recognised in Eclipse

3/29/2010 2:14:00 AM

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!

Jason Scheirer

3/29/2010 3:17:00 AM

On Mar 28, 7:14 pm, KB <ke...@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.

Dieter Verfaillie

3/29/2010 5:59:00 AM

Quoting KB <keith@nekotaku.com>:
> I am getting an error from the IDE saying it does not recognise
> CoInitialize():
>
> ****
> import pythoncom
>
> pythoncom.CoInitialize()
> pythoncom.CoUninitialize()
> ****

It works out of the box with PyDev 1.5.5.2010030420 on Eclipse 3.5.2
on Windows XP. If nothing seems to work for you, you could try adding
pythoncom to the
"Forced Builtins" tab of your Python interpreter configuration to see if it
helps (restart eclipse after you've done that, sometimes changes to
the symbols
database don't get picked up without restarting eclipse...)

mvg,
Dieter

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

3/29/2010 5:17:00 PM

On Mar 28, 8:16 pm, Jason Scheirer <jason.schei...@gmail.com> wrote:
> On Mar 28, 7:14 pm, KB <ke...@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.

3/29/2010 5:50:00 PM

On Mar 28, 10:59 pm, "Dieter Verfaillie" <diet...@optionexplicit.be>
wrote:
> Quoting KB <ke...@nekotaku.com>:
>
> > I am getting an error from the IDE saying it does not recognise
> > CoInitialize():
>
> > ****
> > import pythoncom
>
> > pythoncom.CoInitialize()
> > pythoncom.CoUninitialize()
> > ****
>
> It works out of the box with PyDev 1.5.5.2010030420 on Eclipse 3.5.2  
> on Windows XP. If nothing seems to work for you, you could try adding  
> pythoncom to the
> "Forced Builtins" tab of your Python interpreter configuration to see if it
> helps (restart eclipse after you've done that, sometimes changes to  
> the symbols
> database don't get picked up without restarting eclipse...)

Dieter, Thanks, I tried updating my PyDev and Eclipse to your
versions.

Still same issue. How exactly would I add pythoncom to the Forced
Builtins ? I tried simply adding "pythoncom" to the Forced Builtin's
tab but no change.

Any suggestions?

Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
pythoncom.CoInitialize() not recognised in Eclipse

Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te

Il servizio è completamente GRATUITO!