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

Fix "no such directory error" on startup #881

Merged
merged 5 commits into from
Oct 21, 2022

Conversation

da-h
Copy link
Contributor

@da-h da-h commented Oct 20, 2022

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 calling visdom 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:

  1. first for layouts (in the function load_layouts), where it has been called on a specific layout.json-file
  2. for arbitrary env_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

  1. letting the function work specifically on directories, as the name suggests. by using os.path.abspath the function would also normalize any trailing path-delimiter (/)
  2. ensuring that all uses (only two in the code-base) of that function call it with a directories
  3. on the way I say that the function has been called in load_layouts even if the path already existed, thus I (re)moved ensure_dir_exists there
  4. i have also added the working directory to the logger-output so that users know where their data is stored

Motivation 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:

  • Startup:
    • 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 )
  • Layout Saving: (as this has been changed in the PR as well)
    • start visdom → select any env and any view → open "manage views" window (the folder on the right of the menu bar) → check that "fork" and "delete" work as expected

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactor or cleanup (changes to existing code for improved readability or performance)

Checklist:

  • I adapted the version number under py/visdom/VERSION according to Semantic Versioning
    Minor version increase to 0.2.3.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Note

The checks will probably fail, till #880 and #879 is merged.

@da-h da-h force-pushed the fix_no_such_directory_error branch from 0831042 to 488cf2f Compare October 21, 2022 14:45
@da-h
Copy link
Contributor Author

da-h commented Oct 21, 2022

Rebased onto master.

@JackUrb JackUrb merged commit a3a1b85 into fossasia:master Oct 21, 2022
@da-h da-h deleted the fix_no_such_directory_error branch October 21, 2022 15:37
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.

2 participants