Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

send an error if netifaces is not installed

  • Loading branch information...
commit 99c8cb626908ce247898c216d8ec4d48123ed8c4 1 parent 7cbdeec
Geoffroy Couprie authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 network/network.py
6 network/network.py
View
@@ -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 + '" }'
Please sign in to comment.
Something went wrong with that request. Please try again.