lock problem

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Mar 17 05:53:14 EDT 2007


En Fri, 16 Mar 2007 04:40:27 -0300, Ritesh Raj Sarraf <rrs at researchut.com>  
escribió:

> Leo Kislov wrote:
>
>> 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 ..."
>
> The environment variable is set with temp_file_name which gets the name  
> from
> tempfile.mkstemp(), which is run in every thread. So I don't think the
> environment variable is going to be the same.

But the environment is global for all threads.
I don't know how ldapsearch works, but can't you pass it an additional  
argument, instead of setting an environment variable? From the long  
commandline you're building, I bet it has a suitable option.
Or, instead of os.system, use subprocess.Popen, wich lets you specify the  
new environment of the child process.

-- 
Gabriel Genellina




More information about the Python-list mailing list