You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @chendaniely thank you for putting pyprojroot together, I use it all the time now
Just ran into an issue where I was outside my project direct (without realizing it) and got a cryptic RecursionError
16 if len(found) > 0:
17 return path
---> 18 return py_project_root(path.parent, project_files)
19
20
RecursionError: maximum recursion depth exceeded while calling a Python object
Obviously it's my fault for being in the wrong directory.
But I wonder if there's a way to catch this and give a user a more informative error message though?
i.e. something like
try:
return py_project_root(path.parent, project_files)
except RecursionError as e:
print("did not find project root, are you in the project directory?")
raise e
(I don't know if that's an idiomatic way to add info and re-raise the error, but something like that which gives a little more info to a user that might be lost in some other problem and confused by the error, like me 🙂 )
Just a suggestion. Thanks!
The text was updated successfully, but these errors were encountered:
added context:
this happens because I have my project installed into an environment, and I'm importing it outside the directory.
Within the project itself there's a "core" package that uses pyprojroot to get some data the package uses.
I.e.,
src/
my_package/
some_module.py
data = pyprojroot.here.joinpath('/data/list_of_files.txt')
so maybe this is an edge case that would be better solved by me just keeping the data file inside the package.
Feel free to not fix if you don't feel like it's worth handling that edge case.
Anyways now you have an issue about it; in case anyone else has my brilliant idea they can find it.
Hi @chendaniely thank you for putting
pyprojroot
together, I use it all the time nowJust ran into an issue where I was outside my project direct (without realizing it) and got a cryptic
RecursionError
Obviously it's my fault for being in the wrong directory.
But I wonder if there's a way to catch this and give a user a more informative error message though?
i.e. something like
(I don't know if that's an idiomatic way to add info and re-raise the error, but something like that which gives a little more info to a user that might be lost in some other problem and confused by the error, like me 🙂 )
Just a suggestion. Thanks!
The text was updated successfully, but these errors were encountered: