-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AttributeError: module 'posixpath' has no attribute 'sep' #1697
Comments
I can't reproduce this issue with the information provided. Be sure to provide a minimal reproducible example when reporting an issue.
I also stepped through the following with the PyCharm 2022.1.3 debugger on Linux and did not get the reported error. from jinja2.loaders import FileSystemLoader
loader = FileSystemLoader(".")
# the following code accesses os.path.sep
print(loader.list_templates()) |
Highly suspect this ticket is related. It suggests this is system-specific and likely tied to newer Python versions. I saw the related PR which supposedly fixes the issue. |
Reproducing this bug is indeed tricky. It occurs on one system and not on another very similar system. But it also seems this does not only happen here with jinja, as @kevin-brown mentioned. Using |
On one of my systems the loader command fails with "AttributeError: module 'posixpath' has no attribute 'sep'.
It can actually run the code but not use the debugger within PyCharm 2022.1.3. This will trigger the exception.
The full stack trace looks like the following:
Expected result: No error when running the code in the debugger just as when running without debugger.
It seems
os.path.sep
is the problem here. According to the official Python documentationos.sep
is the primary source (https://docs.python.org/3/library/os.html#os.sep). Chaning fromos.path.sep
toos.sep
fixes this issue.Environment used:
The text was updated successfully, but these errors were encountered: