相关疑难解决方法(0)

错误时停止PyCharm

在PyCharm调试模式下,有没有办法让它在遇到错误后立即停止但不退出并突出显示有问题的行?我想到的类似功能是Matlab的“发生错误时停止”。

debugging breakpoints pycharm

14
推荐指数
1
解决办法
1654
查看次数

使具有不可选取字段的对象可选取的正确方法是什么?

对我来说,我所做的就是检测不可选取的内容并将其放入字符串中(我想我也可以将其删除,但随后它会错误地告诉我该字段不存在,但我宁愿让它存在但成为字符串) )。但我想知道是否有一种不那么老套、更正式的方式来做到这一点。

我当前使用的代码:

def make_args_pickable(args: Namespace) -> Namespace:
    """
    Returns a copy of the args namespace but with unpickable objects as strings.

    note: implementation not tested against deep copying.
    ref:
        - /sf/ask/4908983481/
    """
    pickable_args = argparse.Namespace()
    # - go through fields in args, if they are not pickable make it a string else leave as it
    # The vars() function returns the __dict__ attribute of the given object.
    for field in vars(args):
        field_val: Any = getattr(args, field)
        if not dill.pickles(field_val): …
Run Code Online (Sandbox Code Playgroud)

python pickle dill

6
推荐指数
1
解决办法
1527
查看次数

标签 统计

breakpoints ×1

debugging ×1

dill ×1

pickle ×1

pycharm ×1

python ×1