How to debug a Python package in PyCharm
<h1>Setup</h1>

<p>I have the following tree structure in my project:</p>

<pre><code>Cineaste/
├── cineaste/
│   ├── __init__.py
│   ├── metadata_errors.py
│   ├── metadata.py
│   └── tests/
│       └── __init__.py
├── docs/
├── LICENSE
├── README.md
└── setup.py
</code></pre>

<p><code>metadata.py</code> imports <code>metadata_errors.py</code> with the expression:</p>

<pre><code>from .metadata_errors.py import *
</code></pre>

<p>Thus setting a relative path to the module in the same directory (notice the dot prefix).</p>

<p>I can run <code>metadata.py</code> in the PyCharm 2016 editor just fine with the following configuration:</p>

<p><a href="https://i.stack.imgur.com/xu6kS.png"><img src="https://i.stack.imgur.com/xu6kS.png" alt="enter image description here"></a></p>

<h1>Problem</h1>

<p>However, <strong>with this configuration I cannot debug <code>metadata.py</code></strong>. PyCharm returns the following error message (partial stack trace):</p>

<pre><code>    from .metadata_errors import *
SystemError: Parent module '' not loaded, cannot perform relative import
</code></pre>

<p>PyCharm debugger is being called like so:</p>

<pre><code>/home/myself/.pyenv/versions/cineaste/bin/python /home/myself/bin/pycharm-2016.1.3/helpers/pydev/pydevd.py --multiproc --module --qt-support --client 127.0.0.1 --port 52790 --file cineaste.metadata
</code></pre>

<h1>Question</h1>

<p>How can I setup this project so that PyCharm is able to run and debug a file that makes relative imports? </p>