Skip to content
Browse files

fixed issue with turtleart refusing to run if WeDo is not attached

  • Loading branch information...
1 parent 0927884 commit 92831a0ababb1c7dde507f04ba81d25f6d68ef47 @itdaniher committed Mar 28, 2011
Showing with 10 additions and 8 deletions.
  1. +1 −1 TurtleArt/turtleart
  2. +1 −0 TurtleArt/wedo_plugin.py
  3. +8 −7 WeDoMore.py
2 TurtleArt/turtleart
@@ -1 +1 @@
-Subproject commit e46262988a4f02f1ebbcb6602f8d93fbd1dad907
+Subproject commit c6e7ebe564d13ca87382375de39814561289451b
View
1 TurtleArt/wedo_plugin.py
@@ -16,6 +16,7 @@ class Wedo_plugin(Plugin):
def __init__(self, parent):
self.WeDo = WeDo()
self._parent = parent
+
def setup(self):
palette = make_palette('WeDo', colors=["#FF6060", "#A06060"], help_string=_('Palette of WeDo blocks'))
View
15 WeDoMore.py
@@ -2,21 +2,22 @@
import sys
import usb.core
+import logging
class WeDo:
def __init__(self):
"""Find a USB device with the VID and PID of the Lego WeDo. If the HID kernel driver is active, detatch it."""
self.dev = usb.core.find(idVendor=0x0694, idProduct=0x0003)
if self.dev is None:
- sys.exit("Can't find Lego WeDo")
- if self.dev.is_kernel_driver_active(0):
- try:
- self.dev.detach_kernel_driver(0)
- except usb.core.USBError as e:
- sys.exit("Could not detatch kernel driver: %s" % str(e))
+ logging.debug("No Lego WeDo found")
+ else:
+ if self.dev.is_kernel_driver_active(0):
+ try:
+ self.dev.detach_kernel_driver(0)
+ except usb.core.USBError as e:
+ sys.exit("Could not detatch kernel driver: %s" % str(e))
self.valMotorA = 0
self.valMotorB = 0
- print('successfully imported')
def getRawData(self):
"""Read 64 bytes from the WeDo's endpoint, but only return the last eight."""

0 comments on commit 92831a0

Please sign in to comment.
Something went wrong with that request. Please try again.