Помогите пожалуйста.
если в ipython ввожу последовательно вот эти строки, то все отрабатывает и получаю данные из сервера.
from ldap3 import Server, Connection, ALL server = Server('172.17.1.2', get_info=ALL) conn = Connection(server, 'imya@domen.ru', 'password') conn.search('dc=eksmo-office,dc=ru', '(&(objectclass=person)(sn=Фамилия))', attributes=['sAMAccountName', 'mail', 'telephoneNumber', 'middleName', 'displayName', 'description']) print(conn.entries)
А если все это пихаю в файл скрипта
cat adress-book.py
#!/bin/env python from ldap3 import Server, Connection, ALL server = Server('172.17.1.2', get_info=ALL) conn = Connection(server, 'imya@domen.ru', 'password') conn.search('dc=eksmo-office,dc=ru', '(&(objectclass=person)(sn=Фамилия))', attributes=['sAMAccountName', 'mail', 'telephoneNumber', 'middleName', 'displayName', 'description']) print(conn.entries)
то получаю ошибку
$ ./adress-book.py
o
l
l
e
h
Traceback (most recent call last): File "./adress-book.py", line 3, in <module> from ldap3 import Server, Connection, ALL File "/usr/lib/python3.5/site-packages/ldap3/__init__.py", line 321, in <module> from .core.server import Server File "/usr/lib/python3.5/site-packages/ldap3/core/server.py", line 36, in <module> from .tls import Tls File "/usr/lib/python3.5/site-packages/ldap3/core/tls.py", line 28, in <module> from ..utils.log import log, log_enabled, ERROR, BASIC, NETWORK File "/usr/lib/python3.5/site-packages/ldap3/utils/log.py", line 26, in <module> from logging import getLogger, getLevelName, DEBUG File "/usr/lib/python3.5/logging/__init__.py", line 28, in <module> from string import Template File "/home/das-ich/src/pylessons/string.py", line 4, in <module> letter = string[index] IndexError: string index out of range
Научите как это правильно в скрипт написать?