I am trying to use ConfigObj to create a python .py file.
The issues I'm facing are as follows -
- How can I append the starting arguments(classname, init statements), import statements etc using configObj?
- In ConfigObj, we can use section separators. How can I use comments as section names? Obviously, any incorrect code in the .py file and it'll not run. So, I want to separate things using comments as section headers.
The following is the code for the configspec file that I'm trying to use - (yes, I'm working on OpenFlow) -
from mininet.topo import Topo, Node
class MyTopo( Topo ):
"Simple topology example."
def __init__( self, enable_all = True ):
"Create custom topo."
# Add default members to class.
super( MyTopo, self ).__init__()
[["Define_Nodes"]]
[[__many__]]
[["Add_nodes"]]
[[__many__]]
[["Add_edges"]]
[[__many__]]
# Consider all switches and hosts 'on'
self.enable_all()
topos = { 'mytopo': ( lambda: MyTopo() ) }
Finally, when I ran this spec, my code returns the following error -
in _handle_configspec
raise ConfigspecError('Parsing configspec failed: %s' % e)
ConfigspecError: Parsing configspec failed: Invalid line at line "1".
Obviously, this means that I'm not able to create the right kind of configspec to run with ConfigObj.
Any answers to my 2 point Questions will be great!