Jason R. Coombs avatar Jason R. Coombs committed 07e0f6f

Fixed issue in discovery when PyBluez is not installed

Comments (0)

Files changed (2)

 ``easy_install jaraco.nxt==dev``.
 
 The ``jaraco.nxt`` library also can take advantage of the `jaraco input
-<http://pypi.python.org/pypi/jaraco.input>`_ 
+<http://pypi.python.org/pypi/jaraco.input>`_
 package.  To include it as part of the install, use the command
 ``easy_install jaraco.nxt[input]``.
 
 Changes
 -------
 
+1.3.3
+~~~~~
+
+* Fixed issue in discovery when PyBluez is not installed.
+
+1.3.2
+~~~~~
+
+* Move to Mercurial repository and bitbucket hosting.
+* Added example of reading from a sensor port.
+
 1.3.1
 ~~~~~
 

jaraco/nxt/__init__.py

 try:
 	import bluetooth
 except ImportError:
-	class bluetooth:
-		class BluetoothSocket: pass
+	import types
+	bluetooth = types.ModuleType('bluetooth')
+	bluetooth.BluetoothSocket = type('BluetoothSocket', (object,), dict())
 	bluetooth.discover_devices = lambda *args, **kwargs: []
 
 log = logging.getLogger(__name__)
 class Connection(serial.Serial, Device):
 	"""
 	A low-level connection to an NXT brick
-	
+
 	Requires that the brick is already paired with this device using
 	Bluetooth.
-	
+
 	Example usage:
 	conn = Connection('COM3')
 	"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.