parsing - How to parse dhcpd.conf files with python and bicop? -


i want edit files (dhcpd.conf, dns files) python. looking option , found bicop library. try do:

from bicop import parse parse("/home/tigov/dhcp/dhcpd.conf") 

and got:

traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "/usr/local/lib/python2.6/dist-packages/bicop/config.py", line 83, in parse     return _parse(tokenizer, dictclass=dictclass)   file "/usr/local/lib/python2.6/dist-packages/bicop/config.py", line 141, in _parse     raise parseerror, (input.infile, input.lineno, "unexpected end of file") bicop.config.parseerror: none[1]: unexpected end of file 

any ideas have do, or "bicop how to"? or maybe library this? (iscpy library doesn't work me) , sorry, english weak.

it looks examples bicop don't work. parse accepts string input. try this:

from bicop import parse parse(open("/home/tigov/dhcp/dhcpd.conf").read()) 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -