Browse files

send an error if netifaces is not installed

  • Loading branch information...
1 parent 7cbdeec commit 99c8cb626908ce247898c216d8ec4d48123ed8c4 @Geal committed Feb 26, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 network/network.py
View
6 network/network.py
@@ -1,5 +1,9 @@
#!/usr/bin/python
-import netifaces, sys
+try:
+ import netifaces, sys
+except ImportError:
+ print '{ "version": 1, "title": "Network", "type":"status", "status":"error", "message":"Please install the netifaces Python module to use this script" }'
+ exit()
def command_from_interface(intf):
return '{ "name" : "' + intf + '", "value" : "'+ netifaces.ifaddresses(intf)[netifaces.AF_INET][0]["addr"] + '", "command" : ".pilotssh/network/network.py ' + intf + '" }'

0 comments on commit 99c8cb6

Please sign in to comment.