[BangPypers] Accessing string from thread

murugadoss murugadoss2884 at gmail.com
Thu Jun 3 08:01:15 CEST 2010


Hi all,

I am trying to access the packed string from one thread to another. I am
giving the brief view of what i am trying to do,

Thread1:(file name : Thread1.py)

1.I have a two global variables
string =' '
Teststring = "I am written for testing"

2. i am packing the string using struct.pack method,

temp = ' '
        for i in range(len(Teststring)):
                string = temp + struct.pack("!s",Teststring[i])
                temp = string
        string = string.lstrip()
        print "Test string Lenght",len(Teststring),len(string)


Thread 2:(Filename: Thread2.py)
I am trying to print the length of the string

print "Test string Lenght",len(Thread1.Teststring),len(Thread1.string)

output:
Thread1:
Test string Lenght 24 24
Thread2:
Test string Lenght 24 1

can anyone please tell me the reason, why i am not able to get correct
string length in thread2.

--
Thanks & Regards
V.Murugadoss


More information about the BangPypers mailing list