You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CiscoConfParse objects don't support python's pickle module - this is a very handy module when you're working with 1000s of configs (it takes a long time to call CiscoConfParse() on this many objects)
I've had a look at the source code - it looks ike it's trying to save CiscoConfParse.config but it wasn't set during the __init__ - it looks like you can fix this by just specifying
seems like there might be more than i've detailed - when attempting to load a pickled object i hit a AttributeError: 'ConfigList' object has no attribute 'data' error which gets stuck into an infinite loop (or recursion loop) and crashes
i didn't have this problem in ciscoconfparse 1.0 - i'm unsure what specifically changed but will try to look further into it
looks like it's only an issue when i'm in debugging mode in my IDE and i have a breakout that contains a ciscoconfparse object, likewise if i print it, it also throws an exception
but if i don't have breakpoints and just let the code run, no issues - very weird, this is most likely beyond me
One problem is that attrs does not support this Optional[] typing syntax...
@attrs.define(repr=False)classCiscoConfParse(object):
"""Parse Cisco IOS configurations and answer queries about the configs."""config: Optional[Union[str,List[str]]] =None
There are a number of things that have to be fixed for CiscoConfParse() pickling / un-pickling to work... for now, consider it unsupported and it won't be fixed anytime soon. It also looks like I can't use attrs on BaseCfgLine() if I want un-pickling to work correctly.
Contact Details
No response
What happened?
CiscoConfParse
objects don't support python'spickle
module - this is a very handy module when you're working with 1000s of configs (it takes a long time to call CiscoConfParse() on this many objects)I've had a look at the source code - it looks ike it's trying to save CiscoConfParse.config but it wasn't set during the
__init__
- it looks like you can fix this by just specifyingduring the
__init__
hereit seems like CiscoConfParse.config should be set somewhere? it's entirely unused in this module it seems, perhaps a remnant of CiscoConfParse 1.0?
CiscoConfParse Version
0.7.74
What Operating System are you using?
MacOS
What Python version(s) have this problem?
Python 3.10
Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.
Python tracebacks
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: