Update README to point to RTD for docs instead of PythonHosted.org
[osm/N2VC.git] / examples / add_model.py
index e703450..3e46490 100644 (file)
@@ -51,14 +51,16 @@ async def main():
         print("Destroying model")
         await controller.destroy_model(model.info.uuid)
 
-    except Exception as e:
+    except Exception:
         LOG.exception(
             "Test failed! Model {} may not be cleaned up".format(model_name))
 
     finally:
         print('Disconnecting from controller')
-        await model.disconnect()
+        if model:
+            await model.disconnect()
         await controller.disconnect()
 
 
-loop.run(main())
+if __name__ == '__main__':
+    loop.run(main())