Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I got the error message when trying to debug a python script:

debugfile('C:/Users/Wei-shan/Desktop/pythonScripts/simple pendulum.py', wdir='C:/Users/Wei-shan/Desktop/pythonScripts', current_namespace=True)
Traceback (most recent call last):

  File "C:\Users\Wei-shan\AppData\Local\Temp/ipykernel_19384/837447315.py", line 1, in <module>
    debugfile('C:/Users/Wei-shan/Desktop/pythonScripts/simple pendulum.py', wdir='C:/Users/Wei-shan/Desktop/pythonScripts', current_namespace=True)

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 589, in debugfile
    enter_debugger(

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spyderpdb.py", line 773, in enter_debugger
    debugger.run(code)

  File "D:\anaconda3\lib\site-packages\spyder_kernels\customize\spyderpdb.py", line 716, in run
    super(SpyderPdb, self).run(cmd, globals, locals)

  File "D:\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'

Any suggestions? Thank you very much

like image 350
WEI SHAN LEE Avatar asked Feb 04 '23 13:02

WEI SHAN LEE


1 Answers

This will be fixed in Spyder 5.1.2. In the meantime, downgrade the ipykernel package in the environment to 6.2.0:

conda activate my_env
conda install ipykernel=6.2.0

You should see something like:

The following packages will be DOWNGRADED:

  ipykernel                            6.4.1-py37h06a4308_1 --> 6.2.0-py37h06a4308_1

after which, restart spyder and it should be good.

like image 83
Colin Avatar answered Feb 06 '23 16:02

Colin