ldap-mailcow icon indicating copy to clipboard operation
ldap-mailcow copied to clipboard

syncer.py: TypeError: list indices must be integers or slices, not str

Open theoneandonly-vector opened this issue 4 years ago • 9 comments

docker-compose logs --tail=10 -f ldap-mailcow

mailcowcustomized_ldap-mailcow | Traceback (most recent call last):
mailcowcustomized_ldap-mailcow |   File "//syncer.py", line 181, in <module>
mailcowcustomized_ldap-mailcow |     main()
mailcowcustomized_ldap-mailcow |   File "//syncer.py", line 31, in main
mailcowcustomized_ldap-mailcow |     sync()
mailcowcustomized_ldap-mailcow |   File "//syncer.py", line 52, in sync
mailcowcustomized_ldap-mailcow |     for (email, ldap_name, ldap_active) in ldap_results:
mailcowcustomized_ldap-mailcow |   File "//syncer.py", line 46, in <lambda>
mailcowcustomized_ldap-mailcow |     x[1]['userPrincipalName'][0].decode(),
mailcowcustomized_ldap-mailcow | TypeError: list indices must be integers or slices, not str

my "userPrincipalName": looks like this:

[email protected]

theoneandonly-vector avatar Feb 15 '21 12:02 theoneandonly-vector

maybe this was different because of the version of python used back when the image was built. but as I had to trust my CA-certificate I had to build it myself which leads to an updated system.

theoneandonly-vector avatar Feb 16 '21 12:02 theoneandonly-vector

I just built it with: "python:3.6-alpine3.13" -> same error "python:3.6-alpine3.12" -> same

theoneandonly-vector avatar Feb 16 '21 13:02 theoneandonly-vector

I have the same error. Does anyone solved this issue?

Widmo avatar Mar 16 '21 19:03 Widmo

@Widmo just use this project: https://github.com/myOmikron/mailcow-ldap-sync

it works perfectly for me.

theoneandonly-vector avatar Mar 16 '21 19:03 theoneandonly-vector

Thank You, I will try, but I'm afraid there is no any even simple documentation :)))

Widmo avatar Mar 16 '21 19:03 Widmo

have a look at the issues.

theoneandonly-vector avatar Mar 16 '21 19:03 theoneandonly-vector

is there more information on this issue? are you using a windows server or linux ldap backend?

paz avatar Mar 29 '21 02:03 paz

Windows LDAP backend, this error appears even, when group / OU is empty.

Widmo avatar Mar 29 '21 08:03 Widmo

Hi. I've added exception handler in syncer.py to ignore such errors. Try it. PS. In my syncer.py instead of userPrincipalName I use mail attribute. If it is a problem for you just edit syncer.py (in lines 44 and 47)

drlight17 avatar Jan 25 '22 14:01 drlight17