Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle saving datastack with relative paths, across drives/volumes #1608

Closed
davemfish opened this issue Aug 6, 2024 · 0 comments · Fixed by #1630
Closed

Handle saving datastack with relative paths, across drives/volumes #1608

davemfish opened this issue Aug 6, 2024 · 0 comments · Fixed by #1630
Assignees
Labels
bug Something isn't working
Milestone

Comments

@davemfish
Copy link
Contributor

davemfish commented Aug 6, 2024

When creating a datastack JSON file, users can choose relative or absolute paths for files. Relative paths are relative to the save location of the JSON file. So when that is on a different drive from one of the files in the datastack, it raises,

Traceback (most recent call last):
  File "flask\app.py", line 1473, in wsgi_app
  File "flask\app.py", line 882, in full_dispatch_request
  File "flask_cors\extension.py", line 165, in wrapped_function
  File "flask\app.py", line 880, in full_dispatch_request
  File "flask\app.py", line 865, in dispatch_request
  File "natcap\invest\ui_server.py", line 186, in write_parameter_set_file
  File "natcap\invest\datastack.py", line 568, in build_parameter_set
  File "natcap\invest\datastack.py", line 541, in _recurse
  File "natcap\invest\datastack.py", line 541, in <genexpr>
  File "natcap\invest\datastack.py", line 555, in _recurse
  File "<frozen ntpath>", line 791, in relpath
ValueError: path is on mount 'C:', start on mount 'D:'

We need to handle this more gracefully, at least when the Flask application is the caller, because we don't want to crash the app. I think it's okay for datastack.py to raise this exception.

We could refuse to create the datastack altogether. Or we could revert to using absolute paths.

@davemfish davemfish added the bug Something isn't working label Aug 6, 2024
@davemfish davemfish added this to the 3.14.3 milestone Aug 6, 2024
@emilyanndavis emilyanndavis self-assigned this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants