Repository: spyder-ide/spyder

Issue:
Crash when trying to run a Python file in a project from the explorer pane - Spyder 4.0.1
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [y] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ y] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ y] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [n/a ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [ y] Tried basic troubleshooting (if a bug/error)
    * [y ] Restarted Spyder
    * [ n] Reset preferences with ``spyder --reset`` I reinstalled everything from scratch using `Anaconda3-2019.10-Windows-x86_64`
    * [y ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/) updated following: https://docs.anaconda.com/anaconda/install/update-version/ 
    * [n/a] Tried the other applicable steps from the Troubleshooting Guide
* [y ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description
Crash when trying to run a Python file in a project
Same as in: https://github.com/spyder-ide/spyder/issues/10590


### What steps reproduce the problem?
1. right click on a python file in the left pane
2. choose "run" from the context menu

### What is the expected output? What do you see instead?
file should execute but instead I get an error message


### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

  File "C:\Users\...\AppData\Local\Continuum\anaconda3\envs\py37\lib\site-packages\spyder\plugins\explorer\plugin.py", line 100, in <lambda>
    False, True))
TypeError: run_script() missing 1 required positional argument: 'console_namespace'

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.0.1
* Python version:  3.7.6 
* Qt version:  5.12.5
* PyQt version: 5.12.3 
* Operating System name/version: Windows 10

__N.B. In practice I am using a  py37 (python 3.7.6) virtual environment selected from the Anaconda Navigator, and with Spyder launched from there.__

![image](https://user-images.githubusercontent.com/7424763/74289367-17973600-4cec-11ea-9ea3-0fa3beb2b220.png)

![image](https://user-images.githubusercontent.com/7424763/74289341-064e2980-4cec-11ea-86fe-9a83f0c139b9.png)

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
atomicwrites >=1.2.0         :  1.3.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
cloudpickle >=0.5.0          :  1.2.2 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
IPython >=4.0                :  7.12.0 (OK)
jedi =0.14.1                 :  0.14.1 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
numpydoc >=0.6.0             :  0.9.2 (OK)
pexpect >=4.4.0              :  4.8.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
psutil >=0.3                 :  5.6.7 (OK)
pygments >=2.0               :  2.5.2 (OK)
pylint >=0.25                :  2.4.4 (OK)
pyls >=0.31.2;<0.32.0        :  0.31.7 (OK)
zmq >=17                     :  18.1.1 (OK)
qdarkstyle >=2.7             :  2.8 (OK)
qtawesome >=0.5.7            :  0.6.1 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
rtree >=0.8.3                :  0.9.4 (OK)
sphinx >=0.6.6               :  2.4.0 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
watchdog                     :  None (OK)
cython >=0.21                :  None (NOK)
matplotlib >=2.0.0           :  3.1.3 (OK)
numpy >=1.7                  :  1.18.1 (OK)
pandas >=0.13.1              :  1.0.1 (OK)
scipy >=0.17.0               :  1.4.1 (OK)
sympy >=0.7.3                :  None (NOK)

```



Discussion:
@dalthviz, this could happen if the user changed the setting

    Run in console's namespace instead of an empty one

in `Run > Configuration per file`.

Please try that to see if you can reproduce this error.
As a check (mostly to prove to myself, being a newby with Spyder, and in general non-Jupyter IDEs, that the issue was not caused by code):

The code in the file is executed as expected when I activate py37 environment from a terminal and just run it from there
> @dalthviz, this could happen if the user changed the setting
> 
> ```
> Run in console's namespace instead of an empty one
> ```
> 
> in `Run > Configuration per file`.
> 
> Please try that to see if you can reproduce this error.

This is what I have (untouched) 
![image](https://user-images.githubusercontent.com/7424763/74290016-d869e480-4ced-11ea-8dd9-1782834f30db.png)


Resolving patch:
diff --git a/spyder/plugins/explorer/plugin.py b/spyder/plugins/explorer/plugin.py
--- a/spyder/plugins/explorer/plugin.py
+++ b/spyder/plugins/explorer/plugin.py
@@ -97,7 +97,7 @@ def register_plugin(self):
         treewidget.sig_run.connect(
             lambda fname:
             ipyconsole.run_script(fname, osp.dirname(fname), '', False, False,
-                                  False, True))
+                                  False, True, False))
         treewidget.sig_open_dir.connect(
             lambda dirname:
             self.main.workingdirectory.chdir(dirname,


Test patch: