python Process return global variable -


I open more process with the dragon to retrieve files via urlib2, only put on Fuknsn call is.

<<< Code> t = Process (target = tracker, args = (dir, lidado [claimant],))

This is the function that calls in the process object

  def traer (dir, y): global list two attempts: file = urllib2.urlopen (dir + y) nombre = y output = open ( 'C: / ndfd / degrib / bin / Archivos / '+ nombre,' Wb ') output.write (file.read ()) excluding urllib2.HTTPError output.close (); Print except urllib2.URLError 'HTTPError =' + str (e.code), e: listado2.append (Y) Print 'URLError =' + str (e.reason)  

This Collection of the root

  if __name__ == '__main__': Global listed Global Listado 2 Listado = [] Listado 2 = [] Krer_trip (Dyer, Listado) Sleeda_bath (Dyer, Lindado, Lindado 2)  

inside Salida_bath are inside Loop while turning on this process.

The exception I would like to add a global variable called listado2 but it does not work, tell me that it

Create within Slda_bath

 < Code> manager = manager () listado2 = manager .dict ()  

put a contador of the process and the new listado2 for the process last

  t = Process (target = trace, args = (Contador, dir, listado [contador], listado2))  

and changes it in the traverse function.

  except urllib2.URLError, e: listado2 [claimant] = Y Print 'URLError =' + str (e.reason)  

Check out Please note that this is working

listado2.values ​​(): listado.append (x) print list

indicates parsing that the variable is not supposed to be local, but it does not define a new variable if none exists. You are responsible for starting it before logging in. You feel that this is a list ( listado2.append (y) ), but nowhere in your code, you actually have it Let's start with list value how dragon will know how to implement .append () on a variable that has never been assigned anything?


Comments