4

I'm using PyCharm 3.1.1 IDE, Pyramid 1.4.5 web framework and I test my web app using web server that comes with PasteScript 1.7.5 package.
I placed pydevd.settrace() call in the global scope of middleware.py module but this does not work – connection to debug server is made (I see Connected to pydev debugger (build 133.881) in the console inside PyCharm) but execution is stuck in this line. This is code that I'm using:

import pydevd
pydevd.settrace('my.host.at.local.domain', port=21000, suspend=False, stdoutToServer=False, stderrToServer=False)

In middleware.py module there's make_app function which is registered in setup.py of my project as an entry point for Paste like this:

setup(
    (...)
    entry_points="""
        [paste.app_factory]
        main = myapp.config.middleware:make_app
        (...)
    """
)

Moving pydevd.settrace() call into make_app function solves the problem i.e. connection is being made to the debug server and subsequent code is being executed.

However, I would like to know why placing pydevd.settrace() call in the global scope of middleware.py module does not work?

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366

0 Answers0