Repository: spyder-ide/spyder

Issue:
Spyder always open a new instance after updating to 3.2.7 version
<!--- **PLEASE READ:** Before submitting here, please carefully consult our *Troubleshooting Guide* at https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ and search the issues page for your error/problem, as most posted bugs are duplicates or easy fixes.

If you don't find anything, please provide a detailed step-by-step description (in English) of the problem and what led up to it below. Issue reports without a clear way to reproduce them will be closed. Thanks! --->

## Problem Description
spyder always open a new instance after updating to 3.2.7 version(already check the 'Use a single instance' option) 


### What steps will reproduce the problem?

1. open two py files
2. 
3. 

### What is the expected output? What do you see instead?



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Package Versions

* Spyder:3.2.7
* Python:3.6.1
* Qt:5.9.2/5.10.0
* PyQt:5.9.2/5.10.0
* Operating System:win10 education 1709(16299.248)

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

IPython >=4.0    :  6.2.1 (OK)
cython >=0.21    :  None (NOK)
jedi >=0.9.0     :  0.11.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.13.1 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.2 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.1 (OK)
sympy >=0.7.3    :  None (NOK)




Discussion:
Thanks for reporting. We'll take a look at this for our next release.
Note to self: This most probably happens for pip installations only.
Unfortunately not, I updated my installation using `conda update spyder`

1. A new instance is opened every time
2. The command window stays open when using 'spyder.exe' (`python.exe` instead of `pythonw.exe` used?)
@dalthviz, take a look at this one. Please use one environment where you install Spyder with conda and another one with pip to test this. It's important that you install Spyder in them and test if single instance mode is working or not, instead of using `bootstrap.py`.

The most probable thing we need to do is to expand the criteria to detect if Spyder is running here:

https://github.com/spyder-ide/spyder/blob/3.x/spyder/utils/external/lockfile.py#L187
@dalthviz, please focus on finishing this one this weekend so I can release 3.2.8 tomorrow.

Resolving patch:
diff --git a/spyder/utils/external/lockfile.py b/spyder/utils/external/lockfile.py
--- a/spyder/utils/external/lockfile.py
+++ b/spyder/utils/external/lockfile.py
@@ -184,7 +184,8 @@ def lock(self):
                         p = psutil.Process(int(pid))
 
                         # Valid names for main script
-                        names = set(['spyder', 'spyder3', 'bootstrap.py'])
+                        names = set(['spyder', 'spyder3', 'spyder.exe',
+                                     'spyder3.exe', 'bootstrap.py'])
                         if running_under_pytest():
                             names.add('runtests.py')
 


Test patch: