Repository: spyder-ide/spyder

Issue:
Find in Files not working after 3.1.0 update
## Description of your problem
Find in Files produces no output, no internal error (internal console didn't pop up), no error message in bash. Answer is always the same e.g. if searching for range:  'range' - String not found

**What steps will reproduce the problem?**
1. Update to 3.1.0 on Ubuntu Linux 14.04
2. open spyder
3. Search -> Find in Files 
4. type any term you know exists in files

**What is the expected output? What do you see instead?**
list of files and row number where term exist

**Please provide any additional information below**
Just updated and it stopped working

## Versions and main components

* Spyder Version: 3.1.0
* Python Version: 3.5.2
* Operating system: Linux 3.13.0-108-generic x86_64 GNU/Linux Ubuntu 14.04.5 LTS


## Dependencies

Please go to the menu entry `Help > Optional Dependencies` (or
`Help > Dependencies`), press the button `Copy to clipboard`
and paste the contents below:
jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.3 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
numpy >=1.7      :  1.11.1 (OK)
pandas >=0.13.1  :  0.18.1 (OK)
pep8 >=0.6       :  1.7.0 (OK)
psutil >=0.3     :  5.0.0 (OK)
pyflakes >=0.6.0 :  1.3.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.4.6 (OK)
sympy >=0.7.3    :  1.0 (OK)



Discussion:
@andfoy, please take a look at this one to see what's happening.
@nbonacchi Did you tried to use the function by opening a project?
Here is the proof that it actually works. 
![captura de pantalla de 2017-01-20 10-45-44](https://cloud.githubusercontent.com/assets/1878982/22155531/bc21649e-defd-11e6-83b0-ed1f76dbf4d4.png)

I can confirm @nbonacchi's discovery: _Find in Files_ doesn't work in the recent spyder version. It doesn't even seem to _start_ searching (e.g., in a large directory).
Sorry guys for some reason I didn't get any notification for this issue. It should work now...

@andfoy I didn't even know that spyder had projects. I use spyder for my everyday coding and for the python class I teach in my PhD program, usually people come from matlab and its easier to just load the matlab 'skin' and work with the file explorer like they are used to. In general I don't like projects, as all boilerplate project files that are usually created in other UI's don't make sense for small/mid size projects and get more in the way of starting to code than actually help, I will definitely check it out though and form an opinion on it.

So if I'm not in a project it does NOT work.
Another (maybe related) problem, case sensitivity in editor while Ctrl+F also doesn't seem to work.

These are the 2 main 'refactoring' tools I use... I can always use grep or ack or sed or one of the many alternatives that exist, but staying within spyder would be preferrable. 

Also I just updated to 3.1.2 and still same problem persists.
@nbonacchi Thanks for the reply! I'll check the function without loading a project. Now, about the case sensitivity, please open a new issue, to keep track of it. Finally, we're now implementing a brand-new system console (OS independent) which should integrate with Spyder, it should be ready for the next release as an optional plugin.
@ccordoba12  @nbonacchi  I'll check the finder, it seems that is broken
@ccordoba12 Isn't it too ineficient to recover first all the files recursively and then scanning all the found files?
``` python
# spyder.widgets.findinfiles.py - Line 152
ok = self.find_files_in_path(self.rootpath)
if ok:
     self.find_string_in_files()
```
@nbonacchi Can I have more information about the test scenario? I can't reproduce the crash
@andfoy I'm not sure what I can do to help, 
So here's the story of my life...
I have a miniconda installation on my ubuntu 14.04 (yes I know I should upgrade but its my data analysis computer and I'm finishing my papers/PhD so only after that is done) I also have a laptop with ubuntu 16.04. On both systems I created a python 2.7 and a python 3.5 environment, I installed spyder everywhere and up till ver 3.1.0 everything was fine and dandy. I "conda update spyder" as prompted and for ver 3.1.1 on both systems and on both environments Find in Files didn't work. After updating to 3.1.2 it seems to work for 16.04 but still not in 14.04.... Maybe some unmet dependency?

I also have spyder2 installed system wide for both python3.4 and 2.7, I only mention this because although spyder3 is in virtual environments I notice some interactions at the level of the UI namely because I think all spyder instalations use the ~/.spyder2 and the ~/.spyder2-py3 folders to save stuff from one session to the next.
Let me know if there is something else I can tell you...

UPDATE: Ignore the last paragraph, I just noticed a ~/.config/spyder and ~/.config/spyder-py3 folder I think the new spyder3 uses, so it can't be that...
Someone else opened the [case sensitivity bug](https://github.com/spyder-ide/spyder/issues/4072) this morning...
:)
@ccordoba12 Is this an error related to external libraries? I can't even reproduce it by searching on a large directory
>@ccordoba12 Is this an error related to external libraries? I can't even reproduce it by searching on a large directory

I dont understand :-| ?
I can't reproduce the errors, as suggested by the users
A thing that compounds this problem is that for buttons referring to regex etc on that widget, we have absolutely no clue if the button is pressed or not!
@andfoy, I can reproduce it. Please work on other things until we met in person and I show it in my computer :-)
I have the same issue. It's been there ever since updating to 3.0.*. I can't get it to search for anything in files. All it says is "String not found" but there's no delay at all as if it's done any searching, not even when I know for a fact the string is present.

Resolving patch:
diff --git a/spyder/plugins/findinfiles.py b/spyder/plugins/findinfiles.py
--- a/spyder/plugins/findinfiles.py
+++ b/spyder/plugins/findinfiles.py
@@ -153,6 +153,7 @@ def register_plugin(self):
         self.main.search_menu_actions += [MENU_SEPARATOR, findinfiles_action]
         self.main.search_toolbar_actions += [MENU_SEPARATOR,
                                              findinfiles_action]
+        self.refreshdir()
     
     def refresh_plugin(self):
         """Refresh widget"""
diff --git a/spyder/widgets/findinfiles.py b/spyder/widgets/findinfiles.py
--- a/spyder/widgets/findinfiles.py
+++ b/spyder/widgets/findinfiles.py
@@ -397,12 +397,9 @@ def __init__(self, parent, search_text, search_text_regexp, search_path,
         for widget in [self.python_path, self.hg_manifest, self.custom_dir,
                        self.dir_combo, browse]:
             hlayout3.addWidget(widget)
-            
+
         self.search_text.valid.connect(lambda valid: self.find.emit())
-        self.include_pattern.valid.connect(lambda valid: self.find.emit())
-        self.exclude_pattern.valid.connect(lambda valid: self.find.emit())
-        self.dir_combo.valid.connect(lambda valid: self.find.emit())
-            
+
         vlayout = QVBoxLayout()
         vlayout.setContentsMargins(0, 0, 0, 0)
         vlayout.addLayout(hlayout1)
@@ -411,7 +408,7 @@ def __init__(self, parent, search_text, search_text_regexp, search_path,
         self.more_widgets = (hlayout2, hlayout3)
         self.toggle_more_options(more_options)
         self.setLayout(vlayout)
-                
+
         self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
 
     @Slot(bool)


Test patch: