为了账号安全,请及时绑定邮箱和手机立即绑定

KeyError:无+ argparse python 3.xx

KeyError:无+ argparse python 3.xx

隔江千里 2021-05-30 01:25:56
main():parser = argparse.ArgumentParser(description="IVS code")parser.add_argument("--prod", help="Product to import config for")parser.add_argument("--wf", help="File to write results to")parser.add_argument("--ipf", help="IVS product family file") #not in use yet, might keep all ivs product family in same fileargs=parser.parse_args()print (args)dataDF,keepDF,rulesDF,family_list,level_list,price_override_dict = getInputDataStructures(args)================================================== ============================功能def getInputDataStructures(args):#Create the price override dictionary    reader = csv.reader(open(cfg[args.prod]["po"], 'r'), skipinitialspace=True)   #reader = csv.reader(open(cfg[args.prod]["po"], 'r'), skipinitialspace=True)    next(reader, None)  # skip the headers    price_override_dict = {}    for row in reader:        cd,cntry,price = row        price_override_dict[cd+'|'+cntry] = price================================================== ==================== YAML 文件 -> 集合和杂项:lvl: "ITEM_CODE,REGIONS,CLUSTERS,SUBCLUSTER,COUNTRY"kl: Keep.csvrs: rules.csvpf: "Sets and Misc"ps: "-"pg: Product_Family.csv dt: "Sets_Misc.rpt"po: "priceOverride.csv"=================================================== ==========================错误输出:24]: runfile('.../Workspace/CodeFiles/volume_substitution_v3.py', wdir='.../Workspace/CodeFiles')Reloaded modules: configNamespace(ipf=None, prod=None, wf=None)Traceback (most recent call last):  File "<ipython-input-24-6b4c2ae644d5>", line 1, in <module>    runfile('.../Workspace/CodeFiles/volume_substitution_v3.py', wdir=.../CodeFiles')  File ".../Workspace/CodeFiles/volume_substitution_v3.py", line 447, in <module>    main()  File ".../Workspace/CodeFiles/volume_substitution_v3.py", line 130, in main    dataDF,keepDF,rulesDF,family_list,level_list,price_override_dict = getInputDataStructures(args)我如何运行它或应该提供什么输入来运行这段代码?有什么方法可以使此代码正常工作?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 199 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信