How to make Pycharm search my local source directories before the site libraries

So PyCharm insists on searching my site-packages in my virtual env before searching my source directories. Is there a way to force it to search my source directories first?

Thanks,

Paul
4 comments
Comment actions Permalink
What do you mean by "before". It seems it searches in both locations simultaneously.
0
Comment actions Permalink
Okay. I should of been more specific. sys.path has the site-packages before
the additional source directories. So a module maybe imported from the
site-packages, when I actually want a module from one of my sources
directories.

Thanks

Paul

On Tue, Oct 13, 2015 at 7:40 AM, Piotr Dobrogost - PyCharm <
jetforum@jetbrains.com> wrote:

* PyCharm <http://forum.jetbrains.com/forum/PyCharm> * > * How to make
Pycharm search my local source directories before the site libraries
<http://forum.jetbrains.com/thread/PyCharm-14721> * 9:39 am
<http://forum.jetbrains.com/thread/PyCharm-14721?message=PyCharm-14721-1> Piotr
Dobrogost <http://forum.jetbrains.com/user/piotr.dobrogost>

What do you mean by "before". It seems it searches in both locations
simultaneously.

Paul(Paul) 1 2 <http://forum.jetbrains.com/user/Paul(Paul)%201%202> @ Oct
12 <http://forum.jetbrains.com/thread/PyCharm-14721>

So PyCharm insists on searching my site-packages in my virtual env before
searching my source directories. Is there a way to force it to search my
source directories first?

Thanks,

Paul

JetBrains Forum | Build #183 (Jun/11/2015 4:11PM) | Feedback
<http://confluence.jetbrains.net/display/JETF/Feedback>
0
Comment actions Permalink
I'm guessing you're asking not about _searching_ in source code (Edit|Find) but rather executing Python code. If so then as long as you checked "Add content roots to PYTHONPATH" and/or "Add source roots to PYTHONPATH" in run/debug configuration (and set these roots properly in Settings|Project|Project Structure) then your folers should come before site-packages in `sys.path` and get imported.
0
Comment actions Permalink
Hi,

You are correct. I should not have used the term search

I wish that was true, but it was not. Now it does appear to be working
correctly (I also removed the offending package from site-packages.

I consider this closed for now, since I cannot reproduce it at the moment.

Thanks,

On Tue, Oct 13, 2015 at 9:18 AM, Piotr Dobrogost - PyCharm <
jetforum@jetbrains.com> wrote:

* PyCharm <http://forum.jetbrains.com/forum/PyCharm> * > * How to make
Pycharm search my local source directories before the site libraries
<http://forum.jetbrains.com/thread/PyCharm-14721> * 11:17 am
<http://forum.jetbrains.com/thread/PyCharm-14721?message=PyCharm-14721-3> Piotr
Dobrogost <http://forum.jetbrains.com/user/piotr.dobrogost>

I'm guessing you're asking not about _searching_ in source code
(Edit|Find) but rather executing Python code. If so then as long as you
checked "Add content roots to PYTHONPATH" and/or "Add source roots to
PYTHONPATH" in run/debug configuration (and set these roots properly in
Settings|Project|Project Structure) then your folers should come before
site-packages in `sys.path` and get imported.

Paul(Paul) 1 2 <http://forum.jetbrains.com/user/Paul(Paul)%201%202> @ 10:49
am
<http://forum.jetbrains.com/thread/PyCharm-14721?message=PyCharm-14721-2>

Okay. I should of been more specific. sys.path has the site-packages before
the additional source directories. So a module maybe imported from the
site-packages, when I actually want a module from one of my sources
directories.

Thanks

Paul

On Tue, Oct 13, 2015 at 7:40 AM, Piotr Dobrogost - PyCharm <
jetforum@jetbrains.com> wrote:

* PyCharm <http://forum.jetbrains.com/forum/PyCharm> * > * How to make
Pycharm search my local source directories before the site libraries
<http://forum.jetbrains.com/thread/PyCharm-14721> * 9:39 am
<http://forum.jetbrains.com/thread/PyCharm-14721?message=PyCharm-14721-1>
Piotr
Dobrogost <http://forum.jetbrains.com/user/piotr.dobrogost>

What do you mean by "before". It seems it searches in both locations
simultaneously.

Paul(Paul) 1 2 <http://forum.jetbrains.com/user/Paul(Paul)%201%202> @ Oct
12 <http://forum.jetbrains.com/thread/PyCharm-14721>

So PyCharm insists on searching my site-packages in my virtual env before
searching my source directories. Is there a way to force it to search my
source directories first?

Thanks,

Paul

JetBrains Forum | Build #183 (Jun/11/2015 4:11PM) | Feedback
<http://confluence.jetbrains.net/display/JETF/Feedback>

JetBrains Forum | Build #183 (Jun/11/2015 4:11PM) | Feedback
<http://confluence.jetbrains.net/display/JETF/Feedback>
0

Please sign in to leave a comment.