question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run Selection/Line in python terminal broken after last update

See original GitHub issue

Environment data

  • VS Code version: 1.28.0
  • Extension version (available under the Extensions sidebar): 2018.9.0
  • OS and version: Windows 10 1803, x64
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Relevant/affected Python packages and their versions: -

Actual behavior

After the latest update of vscode, trying to execute any python block via shift+Enter appends an extra newline at the end of each line, which breaks execution of loops.

Expected behavior

The code runs in the terminal

Steps to reproduce:

  1. Copy the following in a python file:
print(32)
for i in range(4):
    print(i)
  1. Select and run via shift+enter

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

>>> for i in range(4):
...
  File "<stdin>", line 2

    ^
IndentationError: expected an indented block
>>>     print(i)
  File "<stdin>", line 1
    print(i)
    ^
IndentationError: unexpected indent
>>>

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help) (The following repeats multiple times, console was cleared before running, errors show only on the first run in a new terminal)

bootstrap-window.js:195 [uncaught exception]: TypeError: Cannot read property 'isWrapped' of undefined

c:\Users\Filippo\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Buffer.js:205 Uncaught TypeError: Cannot read property 'isWrapped' of undefined
    at Buffer.getWrappedRangeForLine (c:\Users\Filippo\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Buffer.js:205)
    at BufferStringIterator.next (c:\Users\Filippo\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Buffer.js:305)
    at Linkifier._linkifyRows (c:\Users\Filippo\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Linkifier.js:65)
    at c:\Users\Filippo\AppData\Local\Programs\Microsoft VS Code\resources\app\node_modules.asar\vscode-xterm\lib\Linkifier.js:53

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
brettcannoncommented, Oct 16, 2018

@jsarneja no ETA as we’re busy dealing with a nasty conda + PowerShell issue.

1reaction
DonJayamannecommented, Oct 18, 2018

@ChandanVerma @pomoneomarx

Please note the issue has been resolved, if you look above, you can see that a PR was merged yesterday to resolve this, we need to verify the fix, hope you can help with that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Run selection/line in python terminal' stops working after you ...
Issue Type: Bug Repro Use the Run selection/line in python terminal command In the python terminal, run quit() (or ctrl+d) Now try using...
Read more >
linux - Run line in Python terminal not working after Run file in ...
Right mouse button --> Run Selection/Line in Interactive Window , this opens an interactive window to run the selected portion of code.
Read more >
IDLE — Python 3.11.1 documentation
A request past the end of the file goes to the end. Clear any selection and update the line and column status. Show...
Read more >
November 2022 (version 1.74) - Visual Studio Code
The Run Task and Configure Tasks commands appear in the terminal dropdown for increased discoverability and ease of access. The last section of...
Read more >
Python console | PyCharm Documentation - JetBrains
With no selection, the command changes to Execute line in console. ... After the code is executed on the Python console, run the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found