Python3.5:TypeError:\uqinit_u9()获得意外的关键字参数“nosigint”

2024-10-03 19:22:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我用python3.5做doctest。总有一个错误:

  File "D:\Program Files\Anaconda\lib\doctest.py", line 357, in __init__
    pdb.Pdb.__init__(self, stdout=out, nosigint=True)

TypeError: __init__() got an unexpected keyword argument 'nosigint'

错误似乎发生在医生测试.py文件,但不是我自己的代码。在

我希望定义一个类似dict的类,我的代码是:

^{pr2}$

你能帮我做这个吗?在


Tags: 代码inpyinitlib错误lineanaconda
3条回答

有另一个潜在的解决方案,我已经用来解决这个bug。您可以将__init__方法添加到SpyderPdb类中,该类为丢失的nosigint参数设置默认值。在

我使用的是WinPython发行版来获取Spyder,但它可能与Anaconda类似。对于python3.5+来说,它位于:\WinPython…\Python…\Lib\site packages\spyder\utils\site\网站自定义.py在

对于早期版本,它可能位于…\Lib\site packages\spyderlib\widgets\externalshell中\网站自定义.py在

class SpyderPdb(pdb.Pdb):
    def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None, nosigint=False):
        super(pdb.Pdb, self).__init__()

Spyder developer here)此问题将在2017年3月中旬发布的Spyder3.1.4中修复。在

看起来您使用的是Anaconda Python发行版。在

你用的是Spyder IDE吗?在

Spyder的问题跟踪器中有一个open bug。在

建议的解决方法包括修改pdbdoctest的源代码。在

For a shoddy quick fix you can remove the

nosigint=True argument from the pdb.Pdb.init in doctest.py

and change the default value of nosigint toTrue in pdb.py

如果你受到这个错误的影响,你可以鼓励制造Spyder的人通过Subscribing to Notifications about this issue on GitHub来修复它

相关问题 更多 >