bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
372 stars 81 forks source link

ImportError in cly.pi #133

Closed gerard33 closed 4 years ago

gerard33 commented 4 years ago

When running cli.py I get this error.

File "cli.py", line 11, in <module>
    from bimmer_connected.vehicle import VehicleViewDirection, PointOfInterest
ImportError: cannot import name 'PointOfInterest'
robthebold commented 4 years ago

Is it possible that cli.py is trying to import PointOfInterest from the pip-installed library version of bimmer_connected/vehicle.py rather than the latest version in your devel directory?

robthebold commented 4 years ago

I get the same issues if I don't update the source in ~/.local/lib/python3.5/site-packages/bimmer_connected/ to match the changes I've made. Apparently python looks in the pip installed library before looking locally for imports.

rikroe commented 4 years ago

How are you guys running cli? Using python -m bimmer_connected.cli or python bimmer_connected/cli.py? Also, could it be that as Rob mentioned you are mixing up dev and pypi versions? Just did a clean install of bimmer_connected==0.6.2 in a fresh venv and everythings works as it should.

gerard33 commented 4 years ago

Will have a look at it, probably something I did wrong indeed :sunglasses:

robthebold commented 4 years ago

At least on Ubuntu 16.04 with python 3.5.2, I've found that python will first look in a subdirectory named, e.g. bimmer_connected before searching installed packages called "bimmer_connected". So if cli.py lives in the directory one level up from subdir "bimmer_connected", all the imports will first be searched for in the bimmer_connected directory. So I've taken to moving cli.py up one directory level whenever I need to test against any new/experimental library stuff rather than the pip3 installed version.

Before I noticed this behavior, I kept scratching (and beating) my head wondering why something that I had just added to a module couldn't be imported!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.