Error Python version 3.6 does not support this syntax.

Frank Millman frank at chagford.com
Tue Nov 27 08:24:43 EST 2018


"srinivasan"  wrote in message 
news:CAFsTbWeC-wW7AgRWtOtK5Z8FhLrFa1HOcoObkV7bcydS1bEG3A at mail.gmail.com...
>
> 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) 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.",
>
> 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:*

*            print(e)*
*            return None*

Here is a quick, untested, reply. If it does not work for you, please post 
again with the output.

The correct syntax for Python 3.x is

    except BluetoothctlError as e:

The line 'print(e)' should then work.

In the line 'return None',  it may be complaining that None is superfluous - 
a plain 'return' does the same thing.

HTH

Frank Millman





More information about the Python-list mailing list