I'm trying to write a script that authenticates to AD. Here's my problem:
import sys
sys.stdout = open('output.csv', 'w')
def ad_dict(ldapobj,attr_dict={},recurse=0,auth=1,filter=()):
if ldapobj.find(',')==-1: ldapobj='cn='+ldapobj+','+Ad.ldap_main_loc
if auth: #setup authenticated connections
if debug: print 'auth'
When I run it, it gets as far as this and says that "Global name 'debug' is not defined. I thought that debug was built in here, why wouldn't it be defined?. If it helps, I'm using ActivePython for this script.
Why don't you just define a global variable called debug if you need this functionality? (or use logging.debug() )