Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue with plugin_interface.py imports #92

Closed
wants to merge 53 commits into from
Closed

Fix Issue with plugin_interface.py imports #92

wants to merge 53 commits into from

Conversation

tushar-c
Copy link

plugin_interface.py : when imported in other files as 'import plugin_interface as plugintypes', this causes missing modules errors. The commit would have the aforementioned file manually put in the plugins directory and the imports changed to : from . import plugin_interface as plugintypes

@codecov-io
Copy link

codecov-io commented Oct 17, 2018

Codecov Report

❗ No coverage uploaded for pull request base (1.0.0@3ff1c32). Click here to learn what that means.
The diff coverage is 24.84%.

Impacted file tree graph

@@           Coverage Diff            @@
##             1.0.0      #92   +/-   ##
========================================
  Coverage         ?   37.46%           
========================================
  Files            ?        9           
  Lines            ?     1588           
  Branches         ?        0           
========================================
  Hits             ?      595           
  Misses           ?      993           
  Partials         ?        0
Impacted Files Coverage Δ
openbci/__init__.py 100% <100%> (ø)
openbci/utils/parse.py 87.97% <100%> (ø)
openbci/utils/ssdp.py 31.11% <40%> (ø)
openbci/cyton.py 47.5% <45.35%> (ø)
openbci/wifi.py 20.84% <5.67%> (ø)
openbci/utils/utilities.py 77.41% <64.28%> (ø)
openbci/ganglion.py 13.86% <8.67%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ff1c32...f2288eb. Read the comment docs.

@andrewjaykeller
Copy link

@tushar-c what's new with this commit?

@tushar-c
Copy link
Author

Sorry for the very late response, the problem was of improper imports causing issues, and was faced by at least one other user, as described here: #91 ; my attempt was to fix this temporarily at least.

@daniellasry daniellasry moved this from To do to High Priority To Do in OpenBCI SW Dev Jan 21, 2019
@zekailin00
Copy link

I think I figure our what the cause is.
The problem is after you install OpenBCI sudo python3 setup.py install, the plugin_interface.py is in the OpenBCI_Python-1.0.2-py3.5.egg/openbci/plugins folder. Moving plugin_interface.py to the OpenBCI_Python-1.0.2-py3.5.egg folder can temporarily solve this problem.

The user.py works well at any time without this bug, because import openbci.cyton as bci imports the openbci directly in the folder we cloned, not from python packages we installed, and plugin_interface.py this cloned folder as well.

This bug only occurs if we run the python programs that do not stay together with openbci folder and plugin_interface.py. For example, test_wifi.py or test_cyton.py are in the folder called tests. In those cases, when we import openbci, this will be import from python packages instead of from the openbci folder we cloned from Github.

To solve this problem, the installation part has be fix. So plugin_interface.py has to be in the OpenBCI_Python-1.0.2-py3.5.egg folder.

@tushar-c
Copy link
Author

I think I figure our what the cause is.
The problem is after you install OpenBCI sudo python3 setup.py install, the plugin_interface.py is in the OpenBCI_Python-1.0.2-py3.5.egg/openbci/plugins folder. Moving plugin_interface.py to the OpenBCI_Python-1.0.2-py3.5.egg folder can temporarily solve this problem.

The user.py works well at any time without this bug, because import openbci.cyton as bci imports the openbci directly in the folder we cloned, not from python packages we installed, and plugin_interface.py this cloned folder as well.

This bug only occurs if we run the python programs that do not stay together with openbci folder and plugin_interface.py. For example, test_wifi.py or test_cyton.py are in the folder called tests. In those cases, when we import openbci, this will be import from python packages instead of from the openbci folder we cloned from Github.

To solve this problem, the installation part has be fix. So plugin_interface.py has to be in the OpenBCI_Python-1.0.2-py3.5.egg folder.

And so I did make a 'temporary' fix to that you could install from here: https://github.com/tushar-c/openbci-fixed .

@daniellasry
Copy link
Contributor

I believe you are having this issue because you need to run:

python setup.py develop

Then you will be able to run:

python tests/test_cyton.py

From this post:

That way you can edit the source code and see the changes directly without having to reinstall every time that you make a little change. This is useful when you are the developer of that project hence the name develop. If you are just installing someone else's package you should use install

Closing this pull request, since it is old and the code seems to have been merged. If you are still having trouble, please open a new issue!

@daniellasry daniellasry closed this Mar 4, 2019
OpenBCI SW Dev automation moved this from High Priority To Do to Done Mar 4, 2019
@rivasd
Copy link

rivasd commented Apr 23, 2019

the issue that was supposed to be fixed by this PR, namely #91 , is still present in the 1.0.2 release. Im not really sure why either because it would be easily fixed by moving the file named plugin_interface.py that is in the project root to the openbci/plugins directory and doing a search-replace for all instances of import plugin_interface as to import .plugin_interface as (adding the dot for relative import). If you need assistance for the Pypi updating process or anything else feel free to ping me on the neurotechx slack @ drivas.

@retiutut retiutut removed this from Done in OpenBCI SW Dev Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants