-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Error Path handling: ValueError: '//src' does not start with '/'
#1631
Comments
ValueError: '//src/lib3to6' does not start with '/'
ValueError: '//src' does not start with '/'
I see the def normalize_path_maybe_ignore(
path: Path, root: Path, report: "Report"
) -> Optional[str]:
"""Normalize `path`. May return `None` if `path` was ignored.
`report` is where "path ignored" output goes.
"""
try:
abspath = path if path.is_absolute() else Path.cwd() / path
normalized_path = abspath.resolve().relative_to(root).as_posix()
except OSError as e:
report.path_ignored(path, f"cannot be read because {e}")
return None |
Related python issue: https://bugs.python.org/issue33660. Whatever the WA will be, it might be worth mentioning that in a comment. Last time Łukasz made the following WA: 75d2af2. This case certainly craves for a test. |
Sigh, that's frustrating. Thank you for jumping in @mbarkhau. I'll take care of BPO-33660 but for the time being we'll need an internal workaround. Care to add a PR to Black for that? |
Would be happy to. I'll go forward with the above change and see if I can add a test. |
This happens within a docker container running at the root level.
For context:
When I run
black src/
I get this error.It works fine if I run it with the absolute path
black /src/
.Editing the local file, I see these values in the function:
I feel very stupid saying this, but this may be an issue with the
pathlib.Path.resolve
function. You may nonetheless wish to implement a workaround by callingpath.absolute()
first:The text was updated successfully, but these errors were encountered: