Hello everyone,<br><br>I'm new to python and have set up a program to parse through reports. The script has started very basic and I've been folding in additional features as it moves along. What it does is takes a specified log file (exported from splunk) and parses through it with a regex specific to the type of log. <br>
<br>It is invoked by: ./extract -f filename -c config<br><br clear="all">I've successfully set up ConfigParser to go through the config and apply the proper configuration to the script, but I'm having trouble getting the regex to work. It worked successfully when I declared it within the script.<br>
<br>---------------- code ----------------<br>def load_config():<br> configdict = ConfigParser()<br> configdict.read('report.conf')<br> conf=main()[0]<br> opt_name = configdict.get(conf,'name')<br>
opt_regex = configdict.get(conf,'regex')<br> return opt_name,opt_regex<br>...<br>rawstr="r"+"\"\"\""+load_config()[1]+"\"\"\""<br>...<br>rxinput = re.compile(rawstr)<br>
---------------- code ----------------<br><br>full code here <a href="http://codepad.org/pva1dE1i">http://codepad.org/pva1dE1i</a><br>configuration here <a href="http://codepad.org/VnXfQhBi">http://codepad.org/VnXfQhBi</a><br>
<br>Any help would be appreciated.<br><br>Thanks,<br>Tyler<br>