Nov-06-2019, 03:17 AM
I am seeing a weird behavior and I could not find out why. Here is what I did:
in my_def.py, I have:
test.py
However, if I run a wrapper script which call's the test.py, the tran_counter magically get changed, and what's even more interesting is that, the value which is printed to terminal with the "Debug" tag, is correct. But the value gets printed into run.log is wrong, and it's starting value is 0x10, and get's incremented by 4 in the loop.
It's driving me crazy and I have no idea how to find the rootcause. Any help would be greatly appreciated.
in my_def.py, I have:
tran_counter = 0x11000 def output_status(p_file = sys.stderr): global tran_counter print "Debug:transaction counter terminal output: ",hex(tran_counter) print >> p_file, "transaction count: ", hex(tran_counter)this is imported and called in another module:
test.py
import my_def f_handle = open('run.log','w+') for i in range(0,100): my_def.output_status(f_handle) my_def.tran_counter += 4it's just that simple. The problem is if I run test.py, the counter increment and output as expected.
However, if I run a wrapper script which call's the test.py, the tran_counter magically get changed, and what's even more interesting is that, the value which is printed to terminal with the "Debug" tag, is correct. But the value gets printed into run.log is wrong, and it's starting value is 0x10, and get's incremented by 4 in the loop.
It's driving me crazy and I have no idea how to find the rootcause. Any help would be greatly appreciated.