Closed aliraza19 closed 5 years ago
The problem is similar to the problem mentioned in Issue 87.. As mentioned in issue 87 , I tried to comment out the specified line sys.path.insert(0,"bluepy/bluepy") but no luck.
from bluepy.btle import Scanner, DefaultDelegate, Peripheral It says peripheral is not defined in error. So What do we define, or what is being missed here? Please tell me how to be sure that python external libraries are correctly loaded.
I am working with built-in version of python (2.7) right now and I am sure that this is not any hardware issue. I Installed all mentioned requirements with specified version and checked the code in Open BCI_Python Ganglion.py which seems alright.
Ali, thanks for logging this issue. HOWEVER, can you edit the title to be more accurate and descriptive to the exact error, which is: "NameError: global name 'Peripheral' is not defined". This is the same error that is showing up in the related issue 87.
I replicated this bug with a minimal example below:
from ganglion import OpenBCIGanglion
driver = OpenBCIGanglion(port="TEST")
Running this produces:
Traceback (most recent call last):
File "/home/ian/PycharmProjects/OpenBCI_Python/openbci/test.py", line 3, in <module>
driver = OpenBCIGanglion(port="AUTO")
File "/home/ian/PycharmProjects/OpenBCI_Python/openbci/ganglion.py", line 94, in __init__
self.connect()
File "/home/ian/PycharmProjects/OpenBCI_Python/openbci/ganglion.py", line 121, in connect
self.gang = Peripheral(self.port, 'random') # ADDR_TYPE_RANDOM
NameError: global name 'Peripheral' is not defined
When we expect some error about "TEST" not being a MAC address.
I think I see the bug, it relates to the somewhat messy way that BluePy is imported.
Ian, thanks. @andrewjaykeller, can you edit the title of this issue as I mentioned in the previous post? Title of issue should be (or at least include): "NameError: global name 'Peripheral' is not defined", which is also showing up in issue 87.
Hey @aliraza19 and @basophobic , can you test out my patch in pull request #105 above and tell us if it resolves this specific problem for you?
First of all thanks ikm for providing a helpful suggestion. As you mentioned in pull request #105 , i edited my code in ganglion.py accordingly but fortunately landed on ValueError: Expected MAC address, got '' . As soon as i test it with ganglion device i will update.
Perfect, it sounds like we resolved that specific bug for you. If you find another bug please create a new issue for it (after researching to confirm it's a bug).
Yes issue is resolved and we ended up in error ' plugins not found' device now connect but is unable to load plug-in. I am soon going to create a new issue for it after studying the problem in more detail. Thanks Stay in touch :+1:
Hey @andrewjaykeller I think you can close this issue as it was resolved in #105 .
Resolved by #105
Basically we are trying to connect our Ganglion device to python so we can build a real time application in python. We have checked our device in Open_BCI GUI linux and its connecting properly. we are trying to connect Ganglion device with OpenBCI_Python through linux using user.py but eventually ended up in a error named "NameError: name 'Peripheral' is not defined" in terminal . Can anyone help us to resolve it?
Specifications: Ubuntu 18.04 LTS Open_BCI Python downloaded and installed from github Link: (https://github.com/OpenBCI/OpenBCI_Python) Installed all Requirements Link: (https://github.com/OpenBCI/OpenBCI_Python/blob/master/requirements.txt) Python 3.6 and 2.7 pip3 and 2
Error details: Picture in link: https://ibb.co/cnE4Sf (Avoid semi colon in end, simply copy till 'f' and paste in browser)
Solution Tried:
Extra information: 1.Device mac address shows in Hci tool le scan.
Please suggest some solution to our problem or an alternate way to connect our Ganglion device with python for application building.