lock problem

Leo Kislov Leo.Kislov at gmail.com
Fri Mar 16 02:31:39 EDT 2007


On Mar 15, 2:31 pm, Ritesh Raj Sarraf <r... at researchut.com> wrote:

[snip]

>         os.environ['__kabc_ldap'] = temp_file_name

[snip]

> Now as per the above code, "aa" is the first string which will be executed in
> Thread-1. In my query to the ldap server, I am getting a record which matches
> the "aa" string. I've verified it by putting a breakpoint and checking the
> value.
>
> The problem is that when I run the program manually, I don't get the data from
> the first thread i.e. of the string "aa".
>
> I'm not sure if there's something wrong in the code mentioned above or is it
> really a lock problem.
>
> Can somebody please help about where I'm doing any mistake ?

You're changing environmental variable __kabc_ldap that is shared
between your threads. Environment is not designed for that kind of
usage, it was designed for settings. Either use an option to set
output file or just redirect stdout. If the interface of ldapsearch is
so lame that it requires environmental variable use env to set the
variable: "env __kabc_ldap=/tmp/wrjhdsf ldapsearch ..."

  -- Leo




More information about the Python-list mailing list