Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
theoneandonly-vector opened this issue Feb 15, 2021 · 9 comments

Comments

@theoneandonly-vector
Copy link

theoneandonly-vector commented Feb 15, 2021

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:

@theoneandonly-vector
Copy link
Author

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
Copy link
Author

theoneandonly-vector commented Feb 16, 2021

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

@Widmo
Copy link

Widmo commented Mar 16, 2021

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

@theoneandonly-vector
Copy link
Author

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

it works perfectly for me.

@Widmo
Copy link

Widmo commented Mar 16, 2021

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

@theoneandonly-vector
Copy link
Author

have a look at the issues.

@paz
Copy link

paz commented Mar 29, 2021

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

@Widmo
Copy link

Widmo commented Mar 29, 2021

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

@drlight17
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants