Repository: spyder-ide/spyder

Issue:
Spyder opens new instances when double-clicking Python scripts
<!--- **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

I recently upgraded Spyder to 3.2.8 from 3.2.4.  I bind Spyder with any `.py` files on my Windows 10 computer, i.e., on the right-click menu of a certain `.py` file, under "open with", I choose "choose another app", and choose "C:\Anaconda3\Scripts\spyder.exe" to open `.py` files (and I check "Always use this app to open .py files" option).

After upgrading to 3.2.8, I found that every time I double-clicked a `.py` file, a new instance of Spyder opens up, with an empty cmd window pointing to "C:\Anaconda3\Scripts\spyder.exe" also open.

This was not the case for my previous versions of Spyder.

### What steps will reproduce the problem?

The steps are described above.

### What is the expected output? What do you see instead?

If a Spyder instance is already open, then double-clicking other `.py` files does not open new Spyder instances.  Instead, the `.py` files should be opened in the current Spyder instance.

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

N/A

## Package Versions

* Spyder: 3.2.8
* Python: 3.6.3
* Qt: 5.6.2
* PyQt: 5.6.0
* Operating System: Windows 10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

N/A



Discussion:
This is supposed to be fixed. @dalthviz, could you take a look at this when you have some time? Thanks!
I can confirm that I have repeatedly had troubles with new instances appearing with a number of the recent 3.2* versions.  I regularly upgrade Spyder.   I update via Anaconda.  
Current version with the problem is 3.2.8
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Windows 10
Ipython 6.3.0

**I did not have the problem with 3.2.6.   I just downgraded to that version and the new instance problem is gone via conda install spyder=3.2.6.**

The downgrade to 3.2.7 did not work to solve things.  Hence you may want to look at the diff between 3.2.6 and later versions.

See https://stackoverflow.com/q/33817046/438386 for ways people is using this feature on Windows.
This is another related question: https://stackoverflow.com/q/50162165/438386

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
@@ -185,7 +185,8 @@ def lock(self):
 
                         # Valid names for main script
                         names = set(['spyder', 'spyder3', 'spyder.exe',
-                                     'spyder3.exe', 'bootstrap.py'])
+                                     'spyder3.exe', 'bootstrap.py',
+                                     'spyder-script.py'])
                         if running_under_pytest():
                             names.add('runtests.py')
 


Test patch: