pyjamas - Run python script on button click -


i need run python script python gui(pyjamas).when ever press button python script on specific path should run. on this???
below code, hello.py display button when click button test.py should executed. when see in wireshark no packet sent. idea solve

hello.py

import pyjd # dummy in pyjs. pyjamas.ui.rootpanel import rootpanel pyjamas.ui.button import button pyjamas.ui.html import html pyjamas.ui.label import label pyjamas import window pyjamas.ui.html import html pyjamas.ui.button import button def greet():     #fred.settext("no, click me!")     '''mycode = 'print "hello world"'     execfile(printdummy.py)     window.alert("hello, sam!")'''     #subprocess.call("test.py", shell=true)     #execfile(test.py)     test.sendpacket()  if __name__ == '__main__':     pyjd.setup("public/hello.html?fred=foo#me")     b = button("click me", greet, stylename='teststyle')     rootpanel().add(b)     pyjd.run() 

test.py

from socket import socket, af_packet, sock_raw  def sendpacket():     s = socket(af_packet, sock_raw)     s.bind(("eth0", 0))      # we're putting ethernet frame here,      # have want instead     # have @ 'struct' module more      # flexible packing/unpacking of binary data     # , 'binascii' 32 bit crc     src_addr = "\x54\xbe\xf7\x40\xf5\x82"     dst_addr = "\xff\xff\xff\xff\xff\xff"     payload = ("[("*30)+"ilx intel"+("]"*30)     checksum = "\x1a\x2b\x3c\x4d"     ethertype = "\x08\x01"      s.send(dst_addr+src_addr+ethertype+payload+checksum)     print "messge sent"     #message=s.recv(4096)     #message="hello world"     s.close()     #print message     #print(len(message))  if __name__ == '__main__':     sendpacket() 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -