No output from print(), df.show() and df.printSchema() in VS Code debug console

Bilal Ahmed 6 Reputation points
2022-06-21T17:22:38.627+00:00

I'm using latest VS code 1.68.1 remote for local development with Azure Databricks cluster. I use to evaluate spark dataframe variables in debug console however it stop working (screenshot attached). You can see there is not output from .show() and .printSchema() and I've tried changing launch.json but nothing working. Moreover, if I debug python file everything work fine only facing issue while debugging pytest cases. Any solution???
213389-screenshot-2022-06-21-124144.png

launch.json

 {  
    "version": "0.2.0",  
    "configurations": [  
        {  
            "name": "Python: Current File",  
            "type": "python",  
            "request": "launch",  
            "program": "${file}",  
            "env": {  
                "DISPLAY": "1",  
                "PYTHONPATH": "${workspaceFolder}",  
                "PYDEVD_WARN_EVALUATION_TIMEOUT": "1000",  
            },  
            "console": "integratedTerminal",  
            "cwd": "${workspaceFolder}",  
            "redirectOutput":true,  
            "purpose": ["debug-test"],  
            "debugOptions": [  
                "WaitOnAbnormalExit",  
                "WaitOnNormalExit",  
                "RedirectOutput"  
            ],  
        }  
      ]  
    }  
  
Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 90,661 Reputation points Moderator
    2022-06-22T06:45:14.007+00:00

    Hello @Bilal Ahmed ,

    Thanks for the question and using MS Q&A platform.

    Look like you are able to resolve this issue: https://stackoverflow.com/questions/72704600/no-output-from-print-df-show-and-df-printschema-in-vs-code-debug-console

    Add this "python.testing.pytestArgs": ["--capture=no"] parameter to your settings.json which you can find under .vscode directory. For detailed answer check https://github.com/microsoft/debugpy/issues/899

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.