This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年01月19日 14:14 by scape, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg151622 - (view) | Author: scape (scape) | Date: 2012年01月19日 14:14 | |
I believe I am having a similar issue to this: http://bugs.python.org/issue7150 I am in the middle of programming a quick script and now I cannot seem to get beyond this issue; as it is printing up the expiration times from the AD user listings (many of which print 1601 year) it finally fails after the same user account, I have compared accounts and the expiration is the same as other accounts in AD: which is set to (never) any ideas of what's going on here and how I can bypass this error? error report: Traceback (most recent call last): ... line 14, in <module> print user.name + ": " + str(user.accountExpires) File "C:\Python27\lib\site-packages\active_directory.py", line 425, in __getattr__ self._delegate_map[name] = converter (attr) File "C:\Python27\lib\site-packages\active_directory.py", line 335, in convert_to_datetime return ad_time_to_datetime (item) File "C:\Python27\lib\site-packages\active_directory.py", line 319, in ad_time_to_datetime return BASE_TIME + delta OverflowError: date value out of range code: import active_directory from datetime import datetime,timedelta ##check AD for account expirations users = active_directory.AD_object ("LDAP://ou=administration,dc=domain,dc=com") for user in users.search (objectCategory='Person'): dn = user.distinguishedName dn = dn.encode("utf-8") #for the occasional apostrophe if "Adjuncts" in str(dn): print user.name + ": " + str(user.accountExpires) print "done" example output: CN=John Hancock: 1601年01月01日 00:00:00 CN=Jane Smith: 1601年01月01日 00:00:00 ... |
|||
| msg151642 - (view) | Author: scape (scape) | Date: 2012年01月19日 16:33 | |
I dug a little deeper using an error trap and found some of the problematic accounts in AD have their attribute set to a wildly long number and not 0 (as are others when 'never' is specified.) i'll dig further, it also does not seem to be an issue with python but more of an issue with the module I am using (active_directory) and its datetime handling (likely not fixed as was Python) I don't think the issue is necessarily solved, but I'll close it anyways as I think I have atleast my solution now |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:25 | admin | set | github: 58033 |
| 2012年06月16日 00:42:45 | belopolsky | set | status: open -> closed |
| 2012年01月19日 16:33:51 | scape | set | messages: + msg151642 |
| 2012年01月19日 14:14:16 | scape | create | |