F
fowlertrainer
Hello !
I have get a strange problem in mod_python site.
More modules I have, and think, to I initialize my Session handler
from main module.
Like this:
-- main --
import BHASession
# Session info
BHASessionDir="C:/bhaweb/sessions"
BHASession.SSInit(BHASessionDir)
-- Session --
SSDefaultDir="c:/bhaweb/sessions"
SSLockObj=threading.Lock()
def SSLock():
SSLockObj.acquire()
def SSUnlock():
SSLockObj.release()
def SSInit(SessionDir):
SSLock()
try:
if SSDefaultDir.strip()=="":
# <-
# UnboundLocalError: local variable 'SSDefaultDir' referenced before assignment
SSDefaultDir=SessionDir
finally:
SSUnlock()
--------------
When I not use SSInit, only I write the global variable in BHASession
module like this:
SSDefaultDir="c:/bhaweb/sessions"
then it is working good !!!
Why ? How to force python to module see his variable ?
Thanx for any advance !
I have get a strange problem in mod_python site.
More modules I have, and think, to I initialize my Session handler
from main module.
Like this:
-- main --
import BHASession
# Session info
BHASessionDir="C:/bhaweb/sessions"
BHASession.SSInit(BHASessionDir)
-- Session --
SSDefaultDir="c:/bhaweb/sessions"
SSLockObj=threading.Lock()
def SSLock():
SSLockObj.acquire()
def SSUnlock():
SSLockObj.release()
def SSInit(SessionDir):
SSLock()
try:
if SSDefaultDir.strip()=="":
# <-
# UnboundLocalError: local variable 'SSDefaultDir' referenced before assignment
SSDefaultDir=SessionDir
finally:
SSUnlock()
--------------
When I not use SSInit, only I write the global variable in BHASession
module like this:
SSDefaultDir="c:/bhaweb/sessions"
then it is working good !!!
Why ? How to force python to module see his variable ?
Thanx for any advance !