Import working in console but not in pyCharm
<p>I had a python project with a lot of imports like:</p>

<pre><code>from src.main.fr.some.module import someclass
</code></pre>

<p>and it was working good but my colleagues wanted the imports to be like:</p>

<pre><code>from fr.some.module import someclass
</code></pre>

<p>Then I changed the <code>PYTHONPATH</code> in the <code>activate</code> script of my <code>virtualenv</code> like:</p>

<pre><code>export PYTHONPATH="/home/giffon/Documents/wopmars/src/main:/home/giffon/Documents/wopmars/src/test"
</code></pre>

<p>and replaced all the <code>src.main.fr.some.module</code> with <code>fr.some.module</code>.</p>

<p>Then I tried my code in the console and the output was good (note that I am printing the <code>PYTHONPATH</code> at the beginning of my code and <code>/home/giffon/Documents/wopmars/src/main</code> appears like expected).</p>

<pre><code>(WopMars)giffon@CZC0507G5C-HP-Z400:~/Documents/wopmars/src/main/fr/tagc/wopmars/framework/parsing$ python3 Parser.py 
PRINTING THE PYTHONPATH
/home/giffon/Documents/wopmars/src/main/fr/tagc/wopmars/framework/parsing
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/pyparsing-2.1.4-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/cycler-0.10.0-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/pytz-2016.4-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/python_dateutil-2.5.3-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/six-1.10.0-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/numpy-1.11.0-py3.4-linux-x86_64.egg
/home/giffon/Documents/wopmars/src/main
/home/giffon/Documents/wopmars/src/test
/home/giffon/virtualenvs/WopMars/lib/python3.4
/home/giffon/virtualenvs/WopMars/lib/python3.4/plat-x86_64-linux-gnu
/home/giffon/virtualenvs/WopMars/lib/python3.4/lib-dynload
/usr/lib/python3.4
/usr/lib/python3.4/plat-x86_64-linux-gnu
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages



Reading the definition file... -&gt; done.
Checking whether the file is well formed... -&gt; done.
Building the execution DAG... -&gt; done.
Writing the dot file... -&gt; done.
</code></pre>

<p>But, since I am working with pycharm, I wanted the IDE to take my changes into account. And here comes the issues.</p>

<p>I read somewhere that I should modify the interpreter Python Path by doing the following: </p>

<blockquote>
  <p>File > Settings > Projet:wopmars > Projet Interpreter > "wheel" >
  More... > "Show path for the selected interpreter (WopMars interpreter
  selected)" > + > "Browse to /home/giffon/Documents/wopmars/src/main" >
  Ok > Ok > Apply > Ok</p>
</blockquote>

<p>And then I execute the same code than above:</p>

<pre><code>/home/giffon/virtualenvs/WopMars/bin/python3 /home/giffon/Documents/wopmars/src/main/fr/tagc/wopmars/framework/parsing/Parser.py
PRINTING THE PYTHONPATH
/home/giffon/Documents/wopmars/src/main/fr/tagc/wopmars/framework/parsing
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/pyparsing-2.1.4-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/cycler-0.10.0-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/pytz-2016.4-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/python_dateutil-2.5.3-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/six-1.10.0-py3.4.egg
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages/numpy-1.11.0-py3.4-linux-x86_64.egg
/home/giffon/Documents/wopmars/src/test
/home/giffon/Documents/wopmars/src/main
/home/giffon/virtualenvs/WopMars/lib/python3.4
/home/giffon/virtualenvs/WopMars/lib/python3.4/plat-x86_64-linux-gnu
/home/giffon/virtualenvs/WopMars/lib/python3.4/lib-dynload
/usr/lib/python3.4
/usr/lib/python3.4/plat-x86_64-linux-gnu
/home/giffon/virtualenvs/WopMars/lib/python3.4/site-packages



Traceback (most recent call last):
  File "/home/giffon/Documents/wopmars/src/main/fr/tagc/wopmars/framework/parsing/Parser.py", line 12, in &lt;module&gt;
    from fr.tagc.wopmars.framework.management.DAG import DAG
ImportError: No module named 'fr.tagc.wopmars.framework.management.DAG'
</code></pre>

<p>You probably noticed that the <code>/home/giffon/Documents/wopmars/src/main</code> appears in the <code>PYTHONPATH</code> meaning that the configuration of pycharm
interpreter's path has been taken into account. So, the interpreter knows where to find modules but can't see <code>fr</code>... any idea for solving this issue?</p>

<p>It is probably not interesting for solving this issue but the error-raising code is:</p>

<pre><code>print("PRINTING THE PYTHONPATH")                          
for p in sys.path:                                        
    print(p)                                              
print("\n\n")                                             


from fr.tagc.wopmars.framework.management.DAG import DAG  
</code></pre>

<p><em>Note: changing <code>PYTHONPATH</code> in <code>.profile</code> or <code>.bashrc</code> gave me the same results</em></p>

<p><em>Note2: if I don't export PYTHONPATH, the console give me the same error than pycharm</em></p>