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

"OSError: [Errno 2] No such file or directory" when creating the store on disk #133

Closed
moggers87 opened this issue Jun 20, 2015 · 5 comments
Labels

Comments

@moggers87
Copy link
Collaborator

https://github.com/xray7224/PyPump/blob/master/pypump/store.py#L186

This line can raise an OSError with the rather cryptic message "[Errno 2] No such file or directory"

@moggers87
Copy link
Collaborator Author

Looks like this error is raise when the parent dir (e.g. $HOME/.config) doesn't exist

@moggers87
Copy link
Collaborator Author

We will also get a different OSError if we don't have permission to create the directory, however it's pretty clear on what the error was in that case.

@kabniel
Copy link
Collaborator

kabniel commented Jun 20, 2015

A quick fix for the first error would be to use the recursive os.makedirs instead of os.mkdir

@moggers87
Copy link
Collaborator Author

The second error is a little more obvious, so I don't think we should catch that one.

moggers87 added a commit that referenced this issue Jun 20, 2015
This test will fail if the JSONStore can't create the default PyPump config dir due to ~/.config being missing
@moggers87 moggers87 added the bug label Jun 20, 2015
@moggers87
Copy link
Collaborator Author

Test case done

moggers87 added a commit that referenced this issue Jun 21, 2015
Also, use asserts, don't raise exceptions

Touch #133
moggers87 added a commit that referenced this issue Jun 21, 2015
JSONStore now creates parent directories when needed to. It will still
fail if it doesn't have permissions, but that error is quite clear.

Touch #133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants