How to start debugger with an entry_point script : <p>I have a package installed in development mode with <code>pip install -e ./mylocalpkg</code>.</p>

<p>This package defines an <code>entry_points.console_script</code></p>

<pre><code>setup(
    name='mylocalpkg',
    ...
    entry_points={
        'console_scripts': [
            'myscript = mylocalpkg.scriptfile:main'
        ]
    },
    ...
)
</code></pre>

<p>This script can be called with either way</p>

<pre><code>$ python -m mylocalpkg.scriptfile
$ myscript
</code></pre>

<p>However, I cannot debug this script:</p>

<pre><code>$ python -m pdb mylocalpkg.scriptfile
Error: mylocalpkg.scriptfile does not exist
$ python -m pdb myscript
Error: myscript does not exist
</code></pre>

<p>How can I start a debugging session with <code>pdb</code> while calling entry_point scripts ? </p>
