oldnapalm / vpower

ANT+ Virtual Power Meter
MIT License
17 stars 9 forks source link

ImportError: attempted relative import with no known parent package #20

Closed jonathancolledge closed 3 years ago

jonathancolledge commented 3 years ago

Hello again! I tried setting this up on a Raspberry Pi and followed the instructions like so:

git clone https://github.com/oldnapalm/vpower.git sudo apt install python3-pip cd vpower pip install -r requirements.txt cd pyrow python3 pyrow.py

But then I get this error: from . import csafe_cmd ImportError: attempted relative import with no known parent package

I've tried googling the error and can't seem to make it work. Can you help please?

oldnapalm commented 3 years ago

Hi,

I suppose pyrow was designed to be run as a package (given the relative import), so if you want to run it outside the package you need to change from . import csafe_cmd to import csafe_cmd and in csafe_cmd.py change from . import csafe_dic to import csafe_dic.

However, pyrow only reads data from the rower, if you want to convert it to ANT power you should run row.py from vpower folder instead.

I never actually tested row.py (I can only get to the "No ergs found" message) since I don't have a rower, so it may not work. I wrote it based on your tests, but since it's been a while and Python and libraries versions have changed, it may require adjustments.

jonathancolledge commented 3 years ago

Ok, thanks, that's awesome - it seemed to work, but now it can't find the ANT package, but I think I used pip instead of pip3 to install the requirements - that'll probably be it!