eclipse pywintypes.com_error

G

gurkanserin

Hello everybody,

i want to use active directory of my firm to user authentication.i am
using active_directory module(Tim Golden's module -
http://tgolden.sc.sabren.com/python/active_directory.html).

i am using windows vista with an administrative account,python
2.5 ,eclipse 3.2 and pydev plugin,and here is my problem :

i am using the script :

-----------------------------------------------------
import active_directory

me = active_directory.find_user ()

print me
-----------------------------------------------------


when i run this script from idle or command line everything goes
fine , but when i want to run it from eclipse i get the followinr
error :


Traceback (most recent call last):
File "H:\dev\eclipse\workspace\pyProject\src\pyPackage
\adDeneme3.py", line 3, in <module>
me = active_directory.find_user ()
File "E:\Python25\lib\active_directory.py", line 721, in find_user
return root ().find_user (name)
File "E:\Python25\lib\active_directory.py", line 539, in find_user
for user in self.search ("sAMAccountName='%s' OR displayName='%s'
OR cn='%s'" % (name, name, name), objectCategory='Person',
objectClass='User'):
File "E:\Python25\lib\active_directory.py", line 572, in search
for result in query ("\n".join (sql_string), Page_size=50):
File "E:\Python25\lib\active_directory.py", line 294, in query
command = Dispatch ("ADODB.Command")
File "E:\Python25\Lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147024770, 'The specified module could not be
found.', None, None)

i think the problem may be related with windows vista and pydev...

thanks for your help...

ps : i also tried this with Windows XP,in that OS both the idle and
eclipse woeks fine,i had no problem
 
T

Tim Golden

i want to use active directory of my firm to user authentication.i am
using active_directory module(Tim Golden's module -
http://tgolden.sc.sabren.com/python/active_directory.html).

i am using windows vista with an administrative account,python
2.5 ,eclipse 3.2 and pydev plugin,and here is my problem :
[...]

File "E:\Python25\lib\active_directory.py", line 294, in query
command = Dispatch ("ADODB.Command")
File "E:\Python25\Lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147024770, 'The specified module could not be
found.', None, None)


Not sure (I don't use Vista) but can you try this:

<code>
import win32com.client
win32com.client.Dispatch ("ADODB.Command")
</code>

TJG
 
G

gurkan

By the way, if what you want to do is user *authentication* (as
opposed to authorisation) then the active_directory module won't
be any good to you. You want to use either the SSPI functionality
or the LogonUser API. There's a toy example of the latter here:

http://timgolden.me.uk/python/win32_how_do_i/check-a-users-credential...

TJG

i have treid the script :

#import active_directory
import win32com.client

win32com.client.Dispatch ("ADODB.Command")
#me = active_directory.find_user ()

#print me

again i got the error :

Traceback (most recent call last):
File "H:\dev\eclipse\workspace\pyProject\src\pyPackage
\adDeneme3.py", line 4, in <module>
win32com.client.Dispatch ("ADODB.Command")
File "E:\Python25\Lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147024770, 'The specified module could not be
found.', None, None)


as i said before the problem is related with pydev-eclipse-pywin
dynamic module loading in vista i think,because CoCreateInstance
function could not be found.

i am not using python module for authentication,i do it with apache.i
am using python for subversion hook scripts written in python for AD
user-email mapping


ps : Thanks Tim for ur nice active_directory module...
 
T

Tim Golden

gurkan said:
i have treid the script :

#import active_directory
import win32com.client

win32com.client.Dispatch ("ADODB.Command")
#me = active_directory.find_user ()

#print me

again i got the error :

Traceback (most recent call last):
File "H:\dev\eclipse\workspace\pyProject\src\pyPackage
\adDeneme3.py", line 4, in <module>
win32com.client.Dispatch ("ADODB.Command")
File "E:\Python25\Lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "E:\Python25\Lib\site-packages\win32com\client\dynamic.py",
line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147024770, 'The specified module could not be
found.', None, None)

I don't think it's that the CoCreateInstance can't be found:
that's a COM error you're seeing and it means that the
IDispatch mechanism can't find the "ADODB.Command" you're
looking for. If I get the chance I'll try to find a Vista
machine to find out what the equivalent is. If anyone on
the list has Vista and/or knows what the score is here,
please let me know.

To double-check, Gurkan, could you open the Registry and
browse to HKEY_CLASSES_ROOT and look for a key ADODB.Command.
I presume it's not present.

TJG
 
S

Spindle

I don't think it's that the CoCreateInstance can't be found:
that's a COM error you're seeing and it means that the
IDispatch mechanism can't find the "ADODB.Command" you're
looking for. If I get the chance I'll try to find a Vista
machine to find out what the equivalent is. If anyone on
the list has Vista and/or knows what the score is here,
please let me know.

To double-check, Gurkan, could you open the Registry and
browse to HKEY_CLASSES_ROOT and look for a key ADODB.Command.
I presume it's not present.

TJG

I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i
mentioned before,
the problem happens only with eclipse and pydev,on the same machine i
can run the script from command line or with IDLE without any errors.
 
G

gurkan

I don't think it's that the CoCreateInstance can't be found:
that's a COM error you're seeing and it means that the
IDispatch mechanism can't find the "ADODB.Command" you're
looking for. If I get the chance I'll try to find a Vista
machine to find out what the equivalent is. If anyone on
the list has Vista and/or knows what the score is here,
please let me know.

To double-check, Gurkan, could you open the Registry and
browse to HKEY_CLASSES_ROOT and look for a key ADODB.Command.
I presume it's not present.

TJG- Alýntýyý gizle -

- Alýntýyý göster -

I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i
mentioned before,
the problem happens only with eclipse and pydev,on the same machine i
can run the script from command line or with IDLE without any errors.
 
T

Tim Golden

Spindle said:
I checked the key,and it was found under HKEY_CLASSES_ROOT.And as i
mentioned before,
the problem happens only with eclipse and pydev,on the same machine i
can run the script from command line or with IDLE without any errors.

Well, that's bizarre then. Hopefully someone else can chime in
with an idea.

TJG
 
K

kyosohma

Well, that's bizarre then. Hopefully someone else can chime in
with an idea.

TJG

This is just a theory, but since Vista is supposed to be more secure,
maybe Eclipse doesn't have the "rights" to access that particular
registry entry. I recall reading that Norton and McAfee had a lot of
trouble getting access to Vista's internals...

I'm not sure why Python would though. I've also heard that if such-and-
such a program isn't installed in the correct place, it doesn't always
function correctly, so that might be the issue too.

Then again, maybe I'm just blowing smoke.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top