cc-ai / climategan

Code and pre-trained model for the algorithm generating visualisations of 3 climate change related events: floods, wildfires and smog.
https://thisclimatedoesnotexist.com
GNU General Public License v3.0
75 stars 18 forks source link

Pathlib error in tests #39

Closed 51N84D closed 4 years ago

51N84D commented 4 years ago

For some reason I'm getting the error ModuleNotFoundError: No module named 'omnigan' when running run.py as is.

Changing sys.path.append(str(Path(__file__).parent.parent.resolve())) to sys.path.append(str(Path(__file__).resolve().parent.parent)) in all the test programs fixes the problem for me. Is this the case for you guys?

vict0rsch commented 4 years ago

I think both should be fine as it depends on where you run the python interpreter from, either from root or within tests/

tianyu-z commented 4 years ago

I agreed with Sun: If a script is located in /A/B/name.py

Path(file).parent.parent.resolve() you get: /A/B

Path(file).resolve().parent.parent you get: /A

In our situation, we should choose the latter one because the omnigan folder is here.

vict0rsch commented 4 years ago

there was a typo in the config locations which I just fixed but python tests/run.py runs fine ; if you'd rather run tests from within tests/ that's fine too, but don't remove the ability to run from root :)

51N84D commented 4 years ago

Ah got it