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.

debug console is not working and stdout has wrong file descriptor

See original GitHub issue

Environment data

  • VS Code version: 1.21.1
  • Extension version (available under the Extensions sidebar): 2018.3.1
  • OS and version: Windows Server R2
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 2.7.14
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): XXX
  • Relevant/affected Python packages and their versions: XXX

Actual behavior

I have experimented a deep learning code with two computers, and all codes worked well without any bugs.

After I restart vscode two days ago, I have some troubles about print on one computer.

When I started the code, vscode show the terminal with the commands. (I remember that the vscode show the debug console first.)

and the running is immediately stopped.

The error occurred in print function.

the error message is

IOError: [Errno 9] Bad file descriptor

and the return of the sys.stdout.fileno() and sys.stderr.fileno() is -2.

and the change of strout to nullwriter makes the code run.

This problem occured my second computer either, after the restart of the vscode…

How can I solve this problem?

Expected behavior

XXX

Steps to reproduce:

  1. XXX

Logs

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

XXX

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

XXX

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
DonJayamannecommented, Apr 2, 2018

remember that the vscode show the debug console first.)

This has changed, the default is now the terminal. You can change this to the debug console.

Please could you provide a sample to replicate this issue.

1reaction
chienjchienjcommented, Apr 2, 2018

I got same error when i print something… There is a workound method is set “console”:“none” in launch configurations image

That error won’t occurred

FYI

Read more comments on GitHub >

github_iconTop Results From Across the Web

debug console is not working and stdout has wrong file ...
I think the default stdout is redirected to wrong file descriptor when console is terminal. So the nullwriter for stdout make the code...
Read more >
why am I getting IOError: (9, 'Bad file descriptor') error while ...
stdout is not available when not running as a console session. Instead of using print statements you can consider using the logging module...
Read more >
Debug Output (SYSLOG) Issues - Apache Software Foundation
In the default case, the debug output goes out on file descriptor 1, stdout. But if you think about that, it is a...
Read more >
Troubleshoot ASP.NET Core on Azure App Service and IIS
Learn how to diagnose problems with Azure App Service and Internet Information Services (IIS) deployments of ASP.NET Core apps.
Read more >
How to capture stdout/stderr output — pytest documentation
During test execution any output sent to stdout and stderr is captured. ... fd (file descriptor) level capturing (default): All writes going to...
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