Threads + Enviroment Variables

Adonis Vargas deltapigz at telocity.com
Sat Sep 29 17:24:57 EDT 2001


im having problems accessing enviroment variables from within a thread; the
error im am getting is an 'undefined' error, but the variables i definded
but in a module-level.
i.e.

-- in module something.py --
something = []

-- in script --
from something import * # import the variable 'something' right?

def somefunction(somevalue):
    return somevalue+=1

def somethreadedfunction():
    for i in range(10):
        something = somefunction(0) # boom. an 'undefined' error???
        print something

Thread(target=somethreadedfunction).start()
--

now this is not the real code im working on; since the code im working on is
very complex i chose not to paste it; just provided the general idea of what
i am trying to accomplish, therefore the code provided could not be correct.

any help would be greately be appreciated.

Adonis





More information about the Python-list mailing list