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.

VS Code python extension will modify my data in Python script when i debug with it

See original GitHub issue

Environment data

  • VS Code version: 1.19.3
  • Extension version (available under the Extensions sidebar): 2018.4.0 (2 May 2018)
  • OS and version: windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.5.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: XXX

the VS Code IDE will modify my property in Python script when i debug with it. my test code as below

bytesIO = io.BytesIO(...)
bytesIO.seek(0)
print(bytesIO.realine()) # will output the first line

Actual behavior

print(bytesIO.readline()) output nothing.

Expected behavior

print(bytesIO.readline()) will output the first line.

if i add bytesIO.seek(0) after i watch the variable by vs code ide, the output is right. I wander if the IDE has modified the data inside the bytesIO object, such as it called its iterator and changed the position flag inside the object.

hope it helps!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Jul 10, 2018

If an object implements __iter__ and is NOT an instance of following collection types: list, tuple, bytearray, range, dict, set, frozenset, xrange, buffer, only then we don`t consume the iterator (while building the repr).

0reactions
brettcannoncommented, Nov 8, 2018

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging configurations for Python apps in Visual Studio Code
The Python extension supports debugging of several types of Python applications. ... You can modify configurations (to add arguments, for example), ...
Read more >
Editing Python in Visual Studio Code
The Python extension adds the following refactoring functionalities: Extract Variable, Extract Method, Rename Module, and Sort Imports. Extract Variable.
Read more >
Get Started Tutorial for Python in Visual Studio Code
A Python hello world tutorial using the Python extension in Visual Studio Code ... to VS Code as a Python environment, primarily how...
Read more >
Python in Visual Studio Code
You can configure the Python extension through settings. ... Set breakpoints, inspect data, and use the debug console as you run your program...
Read more >
Using Python environments in VS Code
The Python extension uses the selected environment for running Python code (using the Python: Run Python File in Terminal command), providing language services ......
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