Merge pull request #196 from bjackman/is-network-connected

target: Ensure returning False when is_network_connected fails
diff --git a/devlib/target.py b/devlib/target.py
index aea3331..350ce55 100644
--- a/devlib/target.py
+++ b/devlib/target.py
@@ -1320,7 +1320,7 @@
 
     def get_rotation(self):
         cmd = 'settings get system user_rotation'
-        return self.execute(cmd).strip()
+        return int(self.execute(cmd).strip())
 
     def set_rotation(self, rotation):
         if not 0 <= rotation <= 3:
diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index 318b4d0..14cb253 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -575,7 +575,7 @@
         :type outfile: str
         """
         if outfile:
-            self._logfile = open(outfile)
+            self._logfile = open(outfile, 'w')
         else:
             self._logfile = tempfile.NamedTemporaryFile()