Skip to content
Home » TypeError: runfile() got an unexpected keyword argument ‘current_namespace’

TypeError: runfile() got an unexpected keyword argument ‘current_namespace’

To solve TypeError: runfile() got an unexpected keyword argument ‘current_namespace’ error follow below methods.

Error Log

  File "C:\anaconda3\lib\bdb.py", line 580, in run
    exec(cmd, globals, locals)

  File "<string>", line 1, in <module>

TypeError: runfile() got an unexpected keyword argument 'current_namespace'

How to solve TypeError: runfile() got an unexpected keyword argument ‘current_namespace’ ?

Follow the given methods and solutions below.

Method 1 :

The above problem will be resolved in the very next edition of spyder 5.1.2. You need downgrade the environment’s ipykernel package to 6.2.0. Simply execute this command. First, activate the environment by typing conda activate new_env.

conda activate new_env

Then, downgrade ipykernel to 6.2.0. Use the following command to install ipykernel=6.2.0: conda install ipykernel=6.2.0

conda install ipykernel=6.2.0

Simply restart Spyder, and the problem should be resolved.

Method 2

Spyder was entirely uninstalled and reinstalled to resolve the problem. It appears that the issue is that you are running an out-of-date version of the spyder kernels. There was a change here a while ago.

Similar Errors:
Deprecation warning from Jupyter: “`should_run_async` will not call `transform_cell` automatically in the future”
Python requires ipykernel to be installed