close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to run my python script and I am facing following error TypeError: runfile() got an unexpected keyword argument ‘current_namespace’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: runfile() got an unexpected keyword argument ‘current_namespace’ Error Occurs?

I am trying to run my python script and I am facing following error.

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

How To Solve TypeError: runfile() got an unexpected keyword argument ‘current_namespace’ Error ?

  1. How To Solve TypeError: runfile() got an unexpected keyword argument 'current_namespace' Error ?

    To Solve TypeError: runfile() got an unexpected keyword argument 'current_namespace' Error Above error will be fixed in very next version of spyder 5.1.2 till then You should downgrade the ipykernel package in the environment to 6.2.0 Just run this command. First of all activate environment: conda activate my_env. Then downgrade ipykernel to version 6.2.0. Use this command: conda install ipykernel=6.2.0 Now just restart spyder and Your error must be solved.
    Second Solution is You should try to Uninstall spyder and then reinstall spyder. In my case Reinstalling spyder was worked.

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

    To Solve TypeError: runfile() got an unexpected keyword argument 'current_namespace' Error Above error will be fixed in very next version of spyder 5.1.2 till then You should downgrade the ipykernel package in the environment to 6.2.0 Just run this command. First of all activate environment: conda activate my_env. Then downgrade ipykernel to version 6.2.0. Use this command: conda install ipykernel=6.2.0 Now just restart spyder and Your error must be solved.
    Second Solution is You should try to Uninstall spyder and then reinstall spyder. In my case Reinstalling spyder was worked.

Solution 1: downgrade ipykernel to version 6.2.0

Above error will be fixed in very next version of spyder 5.1.2 till then You should downgrade the ipykernel package in the environment to 6.2.0 Just run this command. First of all activate environment.

conda activate my_env

Then downgrade ipykernel to version 6.2.0. Use this command.

conda install ipykernel=6.2.0

Now just restart spyder and Your error must be solved.

Solution 2: Reinstall spyder

You should try to Uninstall spyder and then reinstall spyder. In my case Reinstalling spyder was worked.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read