Reputation:
In my python script i have such button, its very weired when i press the button, it sometimes works but sometimes fails to do the self.buttononTop() call and takes a while to execute subprocess.call(...)
only what it does correctly is the part urllib2.urlopen
all the rest fails, its not stable. What is causing it to get fail sometime and sometime it works? I have updated the linux kernel for this too but it seems same no improvement.
any idea?
def disconnectButton(self, w):
print "Window Resize"
self.buttononTop()
"""URL url = new URL("http://"
+ my_main_server
+ "/a/disconnectusername?username="
+ my_main_username
+ "&password="
+ my_main_password
+ "&language=EN");"""
urllib2.urlopen(disconnect_url).read()
subprocess.call("/var/tmp/restartMe.sh", shell=True)
Upvotes: 0
Views: 86
Reputation:
Have to use as multi-threading.
import threading
def task1():
urllib2.urlopen(blabla)
class bla:
def disconnectButton(self, w):
print "Window Resize"
self.buttononTop()
#urllib2.urlopen(disconnect_url).read()
t1 = threading.Thread(target=task1)
subprocess.call("/var/tmp/restartMe.sh", shell=True)
Upvotes: 1