I got the beacon result printed on linux (raspbian) terminal through command sudo python testblescan.py [source code: https://github.com/switchdoclabs/iBeacon-Scanner- ], but when I try to run the testblescan.py directly on the python shell (python 2.7.9 by default as python 2.x on raspberry pi 3 model B) then I got an indentation issue which I solved by providing right indentation to the code naming myTestBle.py as filename (see on my screenshot). Now, I encountered by the error regarding bluez.hci_send_cmd(4 params) from blescan.py file. It seems to me that Bluetooth modules for python is not working on my new raspberry pi 3 . I followed this [Tutorial on comment] and many other documents; I installed blueZ 5.39, pybluez 0.22, python-bluez and all other necessary Bluetooth libraries and dependencies; I tried every possible way to deal with this, but, the result is nothing. Maybe I am missing something or I don't have the depth knowledge of this. I require guidelines and suggestions to solve this issue. I would be obliged for any help from anyone. Thanks in advance.
I'm not sure if you're still working on this project or not. But I believe the solution to the above problem is simple. You should try running idle with elevated privileges. If it works with sudo in the shell but doesn't work in Idle, simply try opening Idle from shell via "sudo Idle" or "sudo Idle3" for python 3. That should give Idle the same privileges as the shell while using Idle.
Best of luck!