robbrad / UKBinCollectionData

UK Council Bin Collection Data Parser Outputting Bin Data as a JSON
MIT License
144 stars 91 forks source link

Missing Module #98

Closed onslack closed 2 years ago

onslack commented 2 years ago

Hi there,

Now I'm 99.9% sure this is a user error issue but thought I'd ask anyways.

I've copied the repo to a ubuntu WSL vm thing on my pc and updated/installed the scripts according to the poetry file, but when running the script for my council that you guys kindly created the other week I get a missing module error

Traceback (most recent call last): File "/root/UKBinCollectionData/uk_bin_collection/uk_bin_collection/collect_data.py", line 6, in from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass ModuleNotFoundError: No module named 'uk_bin_collection'

My HA install is running on a separate machine running a Proxmox server

any help/guidance would be smashing

robbrad commented 2 years ago

Hi @onslack

Can try and run from the repo root with

poetry run uk_bin_collection.uk_bin_collection.collect_data.py

I plan on making a package to remove the need for this

Thanks Rob

onslack commented 2 years ago

Hi @onslack

Can try and run from the repo root with

poetry run uk_bin_collection.uk_bin_collection.collect_data.py

I plan on making a package to remove the need for this

Thanks Rob

Cheers Rob, I'll give that a go now and keep you updated

I saw the package discussion, I'm keeping my eyes peeled on the progression

onslack commented 2 years ago

just ran the extra bit from the repo root and got this

FileNotFoundError

[Errno 2] No such file or directory: b'/snap/bin/uk_bin_collection.uk_bin_collection.collect_data.py'

at /usr/lib/python3.10/os.py:607 in _execvpe 603│ path_list = map(fsencode, path_list) 604│ for dir in path_list: 605│ fullname = path.join(dir, file) 606│ try: → 607│ exec_func(fullname, *argrest) 608│ except (FileNotFoundError, NotADirectoryError) as e: 609│ last_exc = e 610│ except OSError as e: 611│ last_exc = e

robbrad commented 2 years ago

Just on my way home

What I'll do is replicate what your doing from scratch and ensure the docs are correct

The way the repo is laid out from experience is the best mix for testing and python import structure.

This is how poetry sets it up when you create a poetry project

The objective of the dir try is as follows

Top level is repo. (Any env stuff)

Next is the project = uk_bin_collection

This contains the python module (uk_bin_collection) The tests

Finally the python module folder is uk_bin_collection

This contains the collect_data.py and councils

The layout avoids relative imports and python path issues but relies on the venv working correctly

Will come back you you tonight

Rob

robbrad commented 2 years ago

My bad!!! Typo

Try

poetry run python uk_bin_collection/uk_bin_collection/collect_data.py

onslack commented 2 years ago

poetry run python uk_bin_collection/uk_bin_collection/collect_data.py

That worked ! I can actually see the Json/Bin info now

Thank you , I can carry on now

Keep up the good work