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

[Question] ValueError: * must be a valid directory #5

Closed
Kristinita opened this issue Apr 17, 2017 · 4 comments
Closed

[Question] ValueError: * must be a valid directory #5

Kristinita opened this issue Apr 17, 2017 · 4 comments

Comments

@Kristinita
Copy link

1. Summary

I can not set path to my projects.

2. Settings

  • I have Sublime Text 3 Portable for Windows.
  • Absolute path to my Sublime Text working directory — D:\Sublime Text 3 x64
  • Absolute path to my sublime-project and sublime-workspace files — D:\Sublime Text 3 x64\Data\Packages\User\Projects.
  • I set user environment variable and restart Windows: PROJECTS_PATH = D:\Sublime Text 3 x64\Data\Packages\User\Projects
  • Example part of my User/Preferences.sublime-settings
"open-sesame.projects_path": "PROJECTS_PATH",
"open-sesame.projects_depth": 1,

3. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings.

I install Open Sesame → I restart Sublime Text → I open any file in Sublime Text → Ctrl+Shift+P (⌘⇧p for Mac) → Open Sesame: Add Project Folder.

4. Expected behavior

Successful add a project to the active window.

5. Actual behavior

command: open_sesame_add_folder
Traceback (most recent call last):
  File "D:\Sublime Text 3 x64\sublime_plugin.py", line 797, in run_
    return self.run()
  File "plugin in D:\Sublime Text 3 x64\Data\Installed Packages\open-sesame.sublime-package", line 45, in run
  File "plugin in D:\Sublime Text 3 x64\Data\Installed Packages\open-sesame.sublime-package", line 78, in find_folders
ValueError: PROJECTS_PATH must be a valid directory

If

"open-sesame.projects_path": "./Projects",

I get similar stack trace:

command: open_sesame_add_folder
Traceback (most recent call last):
  File "D:\Sublime Text 3 x64\sublime_plugin.py", line 797, in run_
    return self.run()
  File "plugin in D:\Sublime Text 3 x64\Data\Installed Packages\open-sesame.sublime-package", line 45, in run
  File "plugin in D:\Sublime Text 3 x64\Data\Installed Packages\open-sesame.sublime-package", line 78, in find_folders
ValueError: ./Projects must be a valid directory

I try set path to my Projects directory use Sublime Text Build System variables → I get similar behavior.

6. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126
Package:
I use the latest stable version of this package for Sublime Text 3

Thanks.

@gerardroche
Copy link
Owner

Thank you for a detailed report.

There are a few issues.

PROJECTS_PATH is not a environment variable, it's a string. So "open-sesame.projects_path": "PROJECTS_PATH" just sets the projects_path to a string PROJECTS_PATH. Assuming the environment variable is set correctly then changing it to ``"open-sesame.projects_path": "$PROJECTS_PATH"` will solve the issue it.

However, if you're setting the environment variable then you don't have to set the projects path in Sublime Text, this is one of the main advantages of using the environment variable. So given that you've set the PROJECTS_PATH environment, Open Sesame will auto detect and use it as the projects path. So you won't need to set "open-sesame.projects_path": "$PROJECTS_PATH".

"open-sesame.projects_path": "./Projects" won't work because ./ is the current working directory and you're probably not launching Sublime from that directory.

If the above fixes above don't solve the issue then try setting the absolute path.

open-sesame.projects_path": "D:\Sublime Text 3 x64\Data\Packages\User\Projects"

The above should certainly work.

If the environment variable is set correctly i.e. PROJECTS_PATH="D:\Sublime Text 3 x64\Data\Packages\User\Projects" then the following should also work.

open-sesame.projects_path": "$PROJECTS_PATH"

But of course if the above works then you don't even need to set it so remove the above setting and it should work too.

@Kristinita
Copy link
Author

Update

1. Settings

I set absolute path to my Projects folder in User/Preferences.sublime-settings:

"open-sesame.keymaps": true,
"open-sesame.projects_depth": 2,
"open-sesame.projects_path": "D:\\Sublime Text 3 x64\\Data\\Packages\\User\\Projects",

2. Steps to reproduce

I restart Sublime Text after change settings → I open any file in Sublime Text →

  1. Ctrl+Shift+P (⌘⇧p for Mac) → Open Sesame: Open Project.
  2. Ctrl+Shift+P (⌘⇧p for Mac) → Open Sesame: Add Project Folder.

3. Expected behavior

Any actions.

4. Actual behavior

Nothing occurs. Also, I don't get output in Sublime Text console.

command: open_sesame
command: open_sesame_add_folder

Thanks.

@gerardroche
Copy link
Owner

gerardroche commented Apr 22, 2017

When you set open-sesame.projects_path" back to an invalid string

"open-sesame.projects_path": "foobar",

does it still produce the exception: ValueError: ./Projects must be a valid directory?

I pushed a new release which will show a status message in the status bar if no projects can be found.

@markusgritsch
Copy link

When sesame.path contains one non-existent directory, the other valid paths are ignored altogether.

It would be nice if Sesame would be more tolerant and still process the remaining valid paths, like FuzzyFileNav does.

I use the same .sublime-settings file on two computers, where not every machine has the same folders.

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

No branches or pull requests

3 participants