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.

Update Pyramid debug template to use `python -m pyramid.scripts.pserve`

See original GitHub issue

Hi there has been an issue reported before where the “Pyramid” debug option tries to find the wrong pserve on some platforms.

https://github.com/Microsoft/vscode-python/pull/530

The fix was submitted here:

https://github.com/Microsoft/vscode-python/pull/530/commits/f22b4510d22a3e7eb01db5509dc81c83b3f12071

And it added this block of code to fix it, which uses pserve.exe on Windows and pserve on everything else: https://github.com/jpfarias/vscode-python/blob/master/src/client/debugger/Main.ts#L217-L224

I don’t believe this fix was sufficient as today using VSCode 1.26.1 and vscode-python 2018.7.1 I was getting launch error Unable to locate 'pserve.py' required for debugging Pyramid application

Solution for me was to just not try to use the “program” launch style, but instead use the “module” launch style like the “flask” example. I think you guys should consider changing the default to this as it is simpler to understand … and deprecate the custom DebugOption as it is not required nor simpler:

    {
            "name": "Python: Pyramid",
            "type": "python",
            "request": "launch",
            "module": "pyramid.scripts.pserve",
            "args": [
                "${workspaceFolder}/development.ini"
            ],
            "debugOptions": [
                "RedirectOutput",
            ]
        }

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
stevepiercycommented, Aug 27, 2018

@brettcannon I’ve got an open PR with some improvements. Please let me know if this hits the mark. Thank you!

1reaction
mmerickelcommented, Aug 23, 2018

I can refer to the git blame on setup.py for pyramid which shows that the pserve command has been pserve.scripts.main for at least 7 years

This is true but the if __name__ == '__main__' support which is required for the -m option to work was only added in 1.5 but from then on it is a supported way to invoke the console scripts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command-Line Pyramid - The Pylons Project
Each of Pyramid's console scripts ( pserve , pviews , etc.) can be run using python3 -m , allowing custom arguments to be...
Read more >
How can I reload pserve when a template changes?
Pyramid already provides a method to reload templates without restarting pserve by putting such configuration in a PasteDeploy ...
Read more >
Brett Cannon on Twitter: "Could a Pyramid maintainer tell me if `-m ...
Update Pyramid debug template to use `python -m pyramid.scripts.pserve` ... the "Pyramid" debug option tries to find the wrong pserve on some platforms....
Read more >
pyramid - PyPI
python -3 -m pyramid.scripts.pserve development.ini ... If you're using the Pyramid debug toolbar, when you upgrade Pyramid to 1.5a2+, you'll also need to ......
Read more >
The Pyramid Web Framework - Read the Docs
The code is executed once when the script is run as ... Tutorial Templating, Templates, Debugging Templates, and Available Add-On Template.
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