You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ciscoconfparse v1.6.41在macOS环境下解析配置文件报错求助

ciscoconfparse在macOS下初始化时触发TypeError:io.open()参数错误

此前使用Python模块ciscoconfparse从未遇到问题,但更换为MacBook后,按照文档推荐语法尝试打开配置文件test.txt时,始终触发TypeError错误。

错误信息如下:

Python 3.10.7 (v3.10.7:6cc6b13308, Sep  5 2022, 14:02:52) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ciscoconfparse import CiscoConfParse
>>> 
>>> parse = CiscoConfParse('test.txt')
2022-09-22 11:37:54.599 | ERROR    | ciscoconfparse.ciscoconfparse:__init__:485 - An error has been caught in function '__init__', process 'MainProcess' (32493), thread 'MainThread' (4336010624):
Traceback (most recent call last):

  File "<stdin>", line 1, in <module>
> File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ciscoconfparse/ciscoconfparse.py", line 485, in __init__
    config = self.get_config_lines(config=config, logger=logger)
             │    │                       │              └ <loguru.logger handlers=[(id=1, level=10, sink=<stdout>)]>
             │    │                       └ 'test.txt'
             │    └ <function CiscoConfParse.get_config_lines at 0x103f653f0>
             └ <CiscoConfParse: None lines / syntax: ios / comment delimiter: '!' / factory: False / encoding: 'UTF-8'>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ciscoconfparse/ciscoconfparse.py", line 582, in get_config_lines
    with open(config, **self.openargs) as fh:
              │         │    └ <function Logger.catch.<locals>.Catcher.__call__.<locals>.catch_wrapper at 0x103f657e0>
              │         └ <CiscoConfParse: None lines / syntax: ios / comment delimiter: '!' / factory: False / encoding: 'UTF-8'>
              └ 'test.txt'

TypeError: io.open() argument after ** must be a mapping, not method

环境信息:

  • ciscoconfparse v1.6.41
  • Python 3.10.7
  • macOS Monterey 12.6

是否应该将此问题上报为bug?

内容的提问来源于stack exchange,提问作者Kilowatt123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 14:40:51