NameError("name '__pydevd_ret_val_dict' is not defined")
时间: 2023-09-30 20:12:03 浏览: 198
This error message suggests that the Python interpreter is unable to find the variable or function "__pydevd_ret_val_dict" in the current scope. This could be due to a number of reasons, such as a typo in the variable/function name, or the variable/function not being defined yet.
It's possible that this error is related to a debugging tool or library that you're using, as "__pydevd" suggests that it may be related to PyDev, a Python IDE. If that's the case, you may need to check the documentation for the tool to see how to properly use the missing variable or function.
Without more context or code, it's difficult to provide a more specific solution.
相关问题
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) { AVDictionaryEntry *t = NULL; AVDictionary *tmp = NULL; int ret = 0; if (!options) return 0; while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ret = av_opt_set(obj, t->key, t->value, search_flags); if (ret == AVERROR_OPTION_NOT_FOUND) ret = av_dict_set(&tmp, t->key, t->value, 0); if (ret < 0) { av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value); av_dict_free(&tmp); return ret; } ret = 0; } av_dict_free(options); *options = tmp; return ret; }
这是一个函数定义,它的作用是将 AVDictionary 类型的 options 中的所有键值对设置到 obj 对象中。函数内部通过 av_dict_get 函数遍历 options 中的所有键值对,然后通过 av_opt_set 函数将键值对设置到 obj 对象中。如果 av_opt_set 函数返回 AVERROR_OPTION_NOT_FOUND,则说明 obj 对象中不存在该选项,此时将该键值对添加到临时的 AVDictionary 对象 tmp 中。如果 av_opt_set 函数返回其他错误,则说明设置选项失败,函数返回错误码。最后,函数释放 options 对象并将 tmp 对象赋值给 options 对象。函数返回 0 表示设置选项成功。
请用power_supply_get_by_name(ddata->dev)的方法对以下函数进行改写:static int set_charger_type(void) { int ret; static int old_type_en = 0; union power_supply_propval val; struct power_supply *psy = power_supply_get_by_name("bbc"); if (psy == NULL) { pr_info("power_supply_get_by_name error.\n"); return -1; } val.intval = chr_type_en; pr_info("set_charger_type: %d.\n", val.intval); if (val.intval) { if (!old_type_en) { ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); old_type_en = 1; } power_supply_changed(psy); val.intval = POWER_SUPPLY_TYPE_WIRELESS; ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val); if (!ret) { return val.intval; } else { return 0; } } else { val.intval = POWER_SUPPLY_TYPE_USB; ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val); if (ret < 0) pr_info("set chg psy failed\n"); power_supply_changed(psy); old_type_en = 0; } return 0; }
static int set_charger_type(void) {
int ret;
static int old_type_en = 0;
union power_supply_propval val;
struct power_supply *psy = power_supply_get_by_name("bbc");
if (!psy) {
pr_info("power_supply_get_by_name error.\n");
return -1;
}
val.intval = chr_type_en;
pr_info("set_charger_type: %d.\n", val.intval);
if (val.intval) {
if (!old_type_en) {
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_ONLINE, &val);
old_type_en = 1;
}
power_supply_changed(psy);
val.intval = POWER_SUPPLY_TYPE_WIRELESS;
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val);
if (ret < 0) {
pr_info("set chg psy failed\n");
return 0;
}
return val.intval;
} else {
val.intval = POWER_SUPPLY_TYPE_USB;
ret = power_supply_set_property(psy, POWER_SUPPLY_PROP_TYPE, &val);
if (ret < 0) {
pr_info("set chg psy failed\n");
}
power_supply_changed(psy);
old_type_en = 0;
}
return 0;
}
阅读全文