Search code examples
pythonpython-3.xactive-directorypython-modulepyad

Python pyad issue: AttributeError: module 'pyad.pyad' has no attribute 'adquery'


I am experiencing an issue when trying to use Python's pyad module.

from pyad import *
pyad.set_defaults(ldap_server=adserver, username="", password="")
q = pyad.adquery.ADQuery()
-------------------------
AttributeError: module 'pyad.pyad' has no attribute 'adquery'

Windows 10; Python 3.8.3; and I did a force install of pyad and pywin32

Any help is greatly appreciated!


Solution

  • Try using import pyad.adquery instead of from pyad import *, like their examples show.

    It may not be the issue. The pyad library does define __all__ in their code, but there seems to be a lot of caveats to how import * works, so it's worth a try.