View Single Post
  #5  
Old 03-12-2015, 10:27 AM
shall6 shall6 is offline
Member
 
Join Date: Dec 2014
Posts: 9
Thanks for the assist - can't believe I missed that. Now I'm on to the hard part (been hunting through old threads but no answer).

When I run with the if statement, I can't get it to work. It has to do with the data coming through as e.raw_data. I tried converting it to a string but I still can't compare it. This is what I have after trying to convert BOTH my data and my if object (already a string) to strings. It still doesn't work. Of course it will recognize them as NOT equal... but that doesn't help me much. Why can't I actually turn this raw data into an object?

Code:
dataNetwork = viz.addNetwork('OEM-PC')
def onNetwork(e):
    if isinstance(e,viz.RawNetworkEvent):
        print e.raw_data
        v = str(e.raw_data)
        if v == str('hi'):
            print v

viz.callback(viz.NETWORK_EVENT,onNetwork)
Thanks!
Reply With Quote