Fix "no such directory error" on startup #881
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR solves the "no such directory error" when starting visdom with an
-env_path
that does not exist. For new users this is even the case for just callingvisdom
without any arguments.Background:
In trying to solve one issue, I have to admit, I created another one in PR #839.
Reason for this shortcoming is probably that the function
ensure_dir_exists
has previously created the directory for the parent of the given path, i.e. expecting a proper file-path, but, it has been used in two variants in the code:load_layouts
), where it has been called on a specificlayout.json
-fileenv_paths
, where the function did only work when the path given by the user would have ended with a path-delimiter (/
). (what i wanted to solve in Fix Relative Env Path Errors #839).This PR solves this issue by
os.path.abspath
the function would also normalize any trailing path-delimiter (/
)load_layouts
even if the path already existed, thus I (re)movedensure_dir_exists
thereMotivation and Context
See issues #875 and #874 for details. (This issue should solve both of these.)
How Has This Been Tested?
The following variants are working with this PR in place:
visdom
(creates$HOME/.visdom
if it does not exist)visdom -env_path /tmp/doesnotexist
(creates directory)visdom -env_path /tmp/doesnotexist/
(creates directory also with a trailing/
)visdom -env_path .
(enabled by the change of vis.svg(svg_file=xxx) not working #613 )Screenshots (if appropriate):
Types of changes
Checklist:
py/visdom/VERSION
according to Semantic VersioningMinor version increase to
0.2.3
.Note
The checks will probably fail, till #880 and #879 is merged.