Skip to content

Comments

Find the results dir based on the example script file location.#68

Open
zuckerruebe wants to merge 1 commit intomainfrom
make-example-script-runnable-no-dev-install
Open

Find the results dir based on the example script file location.#68
zuckerruebe wants to merge 1 commit intomainfrom
make-example-script-runnable-no-dev-install

Conversation

@zuckerruebe
Copy link
Contributor

When dong pip install pytrnsys-process in a fresh environment and then running the processing_example.py script from somewhere else (git clone of the source repo, unrelated to my new venv into which I've "pip installed" pytrnsys-process) then I get the following error

(venv) PS C:\Users\damian.birchler\dev\pytrnsys-process-pypi-test> python C:\Users\damian.birchler\src\pytrnsys\wd1\pytrnsys_process\examples\ready_to_run\processing_example.py
Traceback (most recent call last):
  File "C:\Users\damian.birchler\src\pytrnsys\wd1\pytrnsys_process\examples\ready_to_run\processing_example.py", line 186, in <module>
    main()
  File "C:\Users\damian.birchler\src\pytrnsys\wd1\pytrnsys_process\examples\ready_to_run\processing_example.py", line 160, in main
    simulations_data = api.process_whole_result_set_parallel(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\damian.birchler\dev\pytrnsys-process-pypi-test\venv\Lib\site-packages\pytrnsys_process\process\process_batch.py", line 348, in process_whole_result_set_parallel
    _validate_folder(results_folder)
  File "C:\Users\damian.birchler\dev\pytrnsys-process-pypi-test\venv\Lib\site-packages\pytrnsys_process\process\process_batch.py", line 472, in _validate_folder
    raise ValueError(f"Folder does not exist: {folder}")
ValueError: Folder does not exist: C:\Users\damian.birchler\dev\pytrnsys-process-pypi-test\venv\Lib\site-packages\examples\ready_to_run\data\results

This is because the script assumes that the directory layout is as it would be in a developer install. I've changed the paths of the script so that it should work independently of how/where it is run.

However, I've not checked whether this still works in a development install. Furthermore, I'm not sure if api.REPO_ROOT is still needed now? Maybe not and it can be removed? I know it's still referenced in some places, but I mean whether it's still neded theoretically or whether it could be refactored away. I don't mind it being there, just that having removed one reference now, I wanted you to double check.

Cheers

@coveralls
Copy link

Coverage Status

coverage: 97.524% (+0.002%) from 97.522%
when pulling 2889849 on make-example-script-runnable-no-dev-install
into b952abe on main.

@zuckerruebe
Copy link
Contributor Author

zuckerruebe commented Mar 6, 2025

@sebastian-swob: Would you now increase the fix version for this merge request?

@sebastian-swob
Copy link
Contributor

@zuckerruebe Yes I would merge main into this branch and then increase the version in the toml file

@sebastian-swob
Copy link
Contributor

@zuckerruebe Why would you run the processing example outside of the cloned git repo?

@zuckerruebe
Copy link
Contributor Author

@zuckerruebe Why would you run the processing example outside of the cloned git repo?

Because I wanted to test an installation of pytrnsys-process I did with pip install pytrnsys-process. ;)

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.

3 participants