Question

I am using Spyder IDE to develop code and the IDE currently has default end-of-line character set to be CRLF. I would like to use '\n' instead because all my existing source code uses '\n' and so I don't want to have a bunch of new files that use a different end-of-line character.

Is there a way to specify the default end-of-line character in Spyder IDE? If yes, how?

Was it helpful?

Solution

(Spyder maintainer here) To configure the end of line characters you want to use, you need to go to the menu

Tools > Preferences > Editor > Advanced settings

then to the section End of line characters and select the ones that Spyder will use on save.

OTHER TIPS

I just started exploring Spyder 4.1.5 (unfortunately could not get 5.1.5 installed), and found this for EOL settings:

'Tools' > 'Preferences' > choose 'Editor' in the list on the left > 'Advanced setting' tab on the right > at the bottom is the 'End-of-line characters' section.

To convert existing CRLF to LF, select the LF option in the dropdown, then for each file you want to convert, make any edit and save the file and voila. (I think you have to do the edit+save step file-by-file.)

As Carlos Cordoba wrote, Spyder does not allow setting the line ending but it does respect the line endings of a file. If a file has LF line endings and you hit enter, it wont add CRLF even if you are on windows.

My solution is to change the line endings of a new file with notepad++ (edit-> EOL conversion) For many existing files you can use the replace function, explained here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top