0

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!

nefdot
  • 3
  • 4

1 Answers1

0

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.

Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84
  • Thanks @Gabriel! It looks like I was able to take your advice and get it working. To get it working I had to: `import pyad from pyad import adquery` Otherwise I would get: `pyad.pyad_setdefaults(ldap_server=adserver, username="", password="") NameError: name 'pyad' is not defined` If there's a cleaner way to do the imports, please let me know. I'm pretty new to Python. – nefdot Jun 24 '20 at 17:53