Skip to content

Python indentation error with blank line after def #731

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

Closed
untitledds opened this issue Feb 8, 2018 · 1 comment
Closed

Python indentation error with blank line after def #731

untitledds opened this issue Feb 8, 2018 · 1 comment
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug

Comments

@untitledds
Copy link

Environment data

VS Code version: Code 1.20.0 (c63189deaa8e620f650cc28792b8f5f3363f2c5b, 2018-02-07T17:09:39.780Z)
Python Extension version: python|ms-|2018.1.0
Python Version: 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)]
OS and version: Windows_NT x64 10.0.16299

Actual behavior



class pc(object):
    def __init__(self, pcname, model):
        self.pcname = pcname
        self.model = model

    def print_name(self):
        print('Workstation name is', self.pcname, 'model is', self.model)

  • Format document
  • befor def formatter set blank line
  • python get error
>>>     def print_name(self):
  File "<stdin>", line 1
    def print_name(self):
    ^
IndentationError: unexpected indent

Expected behavior

If I remove blank line or set space, code run without error

Steps to reproduce:

Logs

Output from Python output panel

>>> class pc(object):
...     def __init__(self, pcname, model):
...         self.pcname = pcname
...         self.model = model
...
>>>     def print_name(self):
  File "<stdin>", line 1
    def print_name(self):
    ^
IndentationError: unexpected indent
>>>         print('Workstation name is', self.pcname, 'model is', self.model)
  File "<stdin>", line 1
    print('Workstation name is', self.pcname, 'model is', self.model)
    ^
IndentationError: unexpected indent

Output from Console window (Help->Developer Tools menu)

/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:253 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:253
console.ts:123 [Extension Host] (node:17332) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ console.ts:123
t._logExtensionHostMessage @ extensionHost.ts:394
(anonymous) @ extensionHost.ts:211
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104

/C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:253 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:253
console.ts:123 [Extension Host] (node:17332) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ console.ts:123
t._logExtensionHostMessage @ extensionHost.ts:394
(anonymous) @ extensionHost.ts:211
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104

@DonJayamanne
Copy link

Duplicate of #259

@DonJayamanne DonJayamanne marked this as a duplicate of #259 Feb 8, 2018
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug closed-duplicate area-terminal labels Feb 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-terminal bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants