【问题标题】:winpdb not working with python 3.3winpdb 不适用于 python 3.3
【发布时间】:2014-01-12 21:13:46
【问题描述】:

我无法让 rpdb2 与 python 3.3 一起运行,但根据几个来源,这应该是可能的。

$ rpdb2 -d myscript.py
A password should be set to secure debugger client-server communication.
Please type a password:x
Password has been set.
Traceback (most recent call last):
  File "/usr/local/bin/rpdb2", line 31, in <module>
    rpdb2.main()
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14470, in main
    StartServer(_rpdb2_args, fchdir, _rpdb2_pwd, fAllowUnencrypted, fAllowRemote, secret)
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14212, in StartServer
    g_module_main = -1
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 14212, in StartServer
    g_module_main = -1
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 7324, in trace_dispatch_init
    self.__set_signal_handler()
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 7286, in __set_signal_handler
    handler = signal.getsignal(value)
  File "/usr/local/lib/python3.3/dist-packages/rpdb2.py", line 13682, in __getsignal
    handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
ValueError: signal number out of range

rpdb2 的版本是RPDB 2.4.8 - Tychod。 我通过运行pip-3.3 install winpdb 安装它。

有什么线索吗?

【问题讨论】:

    标签: python debugging remote-debugging python-3.3 winpdb


    【解决方案1】:

    问题的原因是 rpdb2 使用 signal 模块中的扩展属性列表来列出所有信号。新的python版本添加了SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK等属性

    所以过滤也应该扩展(补丁只改变一行):

    --- rpdb2.py
    +++ rpdb2.py
    @@ -7278,11 +7278,11 @@
         def __set_signal_handler(self):
             """
             Set rpdb2 to wrap all signal handlers.
             """
             for key, value in list(vars(signal).items()):
    -            if not key.startswith('SIG') or key in ['SIGRTMIN', 'SIGRTMAX'] or key.startswith('SIG_'):
    +            if not key.startswith('SIG') or key in ['SIG_IGN', 'SIG_DFL', 'SIGRTMIN', 'SIGRTMAX']:
                 continue
    
             handler = signal.getsignal(value)
             if handler in [signal.SIG_IGN, signal.SIG_DFL]:
                 continue
    

    很遗憾,目前还没有正式的 winpdb 开发或分支,所以现在这个补丁只存储在 SO 上。

    【讨论】:

      【解决方案2】:

      今天遇到了同样的问题,这是我为它工作所做的工作。 我仍然不太确定这样做是否正确。

      发件人:

      def __getsignal(signum):
          handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
          return handler
      

      收件人:

      def __getsignal(signum):
          try:
              # The problems come from the signum which was 0.
              g_signal_getsignal(signum)
          except ValueError:
              return None
          handler = g_signal_handlers.get(signum, g_signal_getsignal(signum))
          return handler
      

      这个函数应该在13681行或类似的地方。

      【讨论】:

        猜你喜欢
        • 2014-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-05
        • 2014-06-20
        • 2015-01-02
        • 2014-01-04
        相关资源
        最近更新 更多