Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-12-30 06:17:53 (GMT)
committer Aneesh Dogra <lionaneesh@gmail.com>2012-12-30 06:19:11 (GMT)
commit71a8c5ee89d014b86a43a768b582a9865e2e83b2 (patch)
treeb3914b53f0c297ff647b76e063f3654ce218caf0
parent6e87e49e3b4dbf9cb6171986448f43a047ed59bb (diff)
Fixes.
-rw-r--r--LevelActivity.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/LevelActivity.py b/LevelActivity.py
index 27ac556..9d0357e 100644
--- a/LevelActivity.py
+++ b/LevelActivity.py
@@ -31,11 +31,14 @@ def read_accelerometer(canvas):
fh = open(ACCELEROMETER_DEVICE)
string = fh.read()
xyz = string[1:-2].split(',')
- x = float(xyz[0]) / (64 * 18)
- y = float(xyz[1]) / (64 * 18)
- canvas.motion_cb(x, y)
- fh.close()
- GObject.timeout_add(100, read_accelerometer, canvas)
+ try:
+ x = float(xyz[0]) / (64 * 18)
+ y = float(xyz[1]) / (64 * 18)
+ fh.close()
+ canvas.motion_cb(x, y)
+ except:
+ pass
+ GObject.timeout_add(100, read_accelerometer, canvas)
class MyCanvas(Gtk.DrawingArea):
''' Create a GTK+ widget on which we will draw using Cairo '''