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

[Win] "\" as line ending character in __init__.py throws an syntax error #2328

Closed
jho101 opened this issue Nov 8, 2023 · 3 comments
Closed

Comments

@jho101
Copy link

jho101 commented Nov 8, 2023

Summary

  • OS: Windows 10
  • Architecture: 64bit
  • Psutil version: 5.9.6
  • Python version: 3.9
  • Type: installation

Description

We are synchronizing our python packages with the version control tool Perforce. In Perforce the user can decide between several line ending styles like (local, system, shared(UNIX and local).
So the result of it is that the whitespaces in the files are different depending on what line ending style we are using.

The problem here is that every time a "\" is used, script fails. I have attached the correspond file with the not working line endings. If you ressolve the "\" it should work:

init.py.txt

@jho101 jho101 added the bug label Nov 8, 2023
@giampaolo
Copy link
Owner

I'm not sure what you're trying to say here. psutil uses UNIX line endings (\n) in all files (.py, .rst, etc.).

@jho101
Copy link
Author

jho101 commented Nov 8, 2023

Hi,
thanks for the quick reply. I wanted to say that if someone changes the line endings to a non Unix style, when psutil is not working anymore because of using the "\" to forwarding the code line to the next line. I think my initial description is misleading. I have added another images.
E.g.: If I remove the "\" from the fun variable, when it is working.

image

image

@giampaolo
Copy link
Owner

A problem with your editor perhaps? I'm not sure. Anyway, if you want to modify psutil source code I recommend configuring your editor to use the UNIX style. You don't want to mix \n and \r\n anyway. Just stick to one (\n).

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

No branches or pull requests

2 participants