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

Error in Visual Studio when formatting with no newline at end of file #617

Open
AdamYoblick opened this issue Oct 15, 2021 · 0 comments
Open

Comments

@AdamYoblick
Copy link

AdamYoblick commented Oct 15, 2021

When trying to format a document in Visual Studio using the autopep8 formatter, an error is thrown when there is no newline at the end of the file. Please see microsoft/PTVS#6752 for details.


Python Code (remove the newline at the end!!!)

######this is a comment
import os,sys;
spam( ham [ 1 ], { eggs : 2 } )
def foo    ():pass
x=1;y     =2;
y = 2
#comment no newline

The error looks like this:

image

Command Line and Configuration

Looks like the command is run by the PTVS extension here: https://github.com/microsoft/PTVS/blob/main/Python/Product/PythonTools/PythonTools/Editor/Formatting/PythonFormatterAutopep8.cs#L27

Your Environment

  • Python version: 3.9.7
  • autopep8 version: 1.5.7
  • Platform: windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant