On 11/27/2018 7:50 AM, srinivasan wrote:
Dear Python Experts,

As still I am newbie and learning python, I am trying to reuse the
Bluetoothctl wrapper in Python from the link (
https://gist.github.com/egorf/66d88056a9d703928f93

Created in 2015

) I am using python3.6
version, In pycharm editor on the bold highlighted code snippets I see the
error message "Python version 3.6 does not support this syntax.",

No version of Python 3 supports the the old exception statement syntax.
Python 2.7, released in 2010, supports both the old and the new syntax. I am not sure about 2.6 and before. It is odd to me that someone would use both the new print syntax and old except syntax together in 2015.

Could you please how help me how the below highlighted lines of code can be
can be ported to python3.6 version?

*        except BluetoothctlError, e:*

If you run the code through the lib2to3 converter it will change ', ' to ' as '. I have not

Full Code snippet:

Not needed, however start_scan and make_discoverable are a bit flakey.
As written, out is discarded making the assignment to out useless and the 'return None' redundant (since the function always returns None). I suspect that this is a bug.

     def start_scan(self):
         """Start bluetooth scanning process."""
         try:
             out = self.get_output("scan on")
         except BluetoothctlError, e:
                print(e)                return None

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to