Description of problem: Step 1: download the text from http://rest.kegg.jp/get/cpd:C00132 Step 2: perform a re.match('^\w+', line) with line equal to "DBLINKS CAS: 67-56-1\n" (that's line 23, by my count) Step 3: wat Running the following python code will cause an error: import urllib2 import time import re def get_test(db,iD): t1 = float(time.clock()) a = urllib2.urlopen('http://rest.kegg.jp/get/' + db + ':' + iD) #a = urllib2.urlopen('http://rest.kegg.jp/list/cpd') rawString = a.read().decode('utf-8') t2 = float(time.clock()) r = float(t2-t1) print r return rawString def parse_response(response): currentField = None data = {} for line in response.split('\n'): newField = re.match('^\w+', line) print line print newField if newField: currentField = newField.group(0) lineData = re.findall('\s\S+', line)[1:] lineData.append('\n') lineData = "".join(map(str, lineData)) data[currentField] = lineData print "here" else: #print currentField lineData = str(line) data[currentField] = data[currentField].join(lineData) return data The data from the restful interface is: ENTRY C00132 Compound NAME Methanol; Methyl alcohol FORMULA CH4O EXACT_MASS 32.0262 MOL_WEIGHT 32.0419 REMARK Same as: D02309 REACTION R00602 R00605 R00608 R00614 R01142 R01143 R01144 R01145 R01146 R02362 R02624 R03551 R04280 R04384 R04409 R04608 R05825 R06250 R06685 R06729 R08149 R08150 R08974 R08975 R09098 R09273 R09274 R09337 R09518 R09553 R09725 R09846 PATHWAY ko00680 Methane metabolism ko00901 Indole alkaloid biosynthesis ko00910 Nitrogen metabolism ko01100 Metabolic pathways ko01120 Microbial metabolism in diverse environments ko01220 Degradation of aromatic compounds ENZYME 1.1.1.244 1.1.2.7 1.1.3.13 1.1.99.37 1.2.99.4 1.11.1.6 1.11.1.7 1.11.1.21 1.13.11.8 1.13.11.- 1.14.13.25 1.14.18.3 2.1.1.90 2.1.1.246 2.3.1.152 3.1.1.11 3.1.1.44 3.1.1.59 3.1.1.61 3.1.1.78 3.1.1.82 3.1.1.85 3.1.1.- 3.1.6.16 DBLINKS CAS: 67-56-1 PubChem: 3432 ChEBI: 17790 PDB-CCD: MOH 3DMET: B01170 NIKKAJI: J2.364G ATOM 2 1 C1a C 22.1200 -14.6300 2 O1a O 23.5200 -14.6300 BOND 1 1 1 2 1 /// Version-Release number of selected component: python-2.7.3-7.2.fc17 Additional info: libreport version: 2.0.18 abrt_version: 2.0.18 backtrace_rating: 4 cmdline: /usr/bin/python /usr/bin/ipython crash_function: rl_do_undo kernel: 3.6.11-5.fc17.x86_64 truncated backtrace: :Thread no. 1 (10 frames) : #5 rl_do_undo at ../undo.c:227 : #6 rl_revert_line at ../undo.c:302 : #7 readline_internal_teardown at ../readline.c:475 : #8 rl_callback_read_char at ../callback.c:212 : #9 readline_until_enter_or_signal at /usr/src/debug/Python-2.7.3/Modules/readline.c:967 : #10 call_readline at /usr/src/debug/Python-2.7.3/Modules/readline.c:1055 : #11 PyOS_Readline at /usr/src/debug/Python-2.7.3/Parser/myreadline.c:211 : #12 builtin_raw_input at /usr/src/debug/Python-2.7.3/Python/bltinmodule.c:2046 : #13 call_function at /usr/src/debug/Python-2.7.3/Python/ceval.c:4098 : #14 PyEval_EvalFrameEx at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
Created attachment 698576 [details] File: core_backtrace
Created attachment 698577 [details] File: environ
Created attachment 698578 [details] File: limits
Created attachment 698579 [details] File: backtrace
Created attachment 698580 [details] File: cgroup
Created attachment 698581 [details] File: smolt_data
Created attachment 698582 [details] File: executable
Created attachment 698583 [details] File: maps
Created attachment 698584 [details] File: dso_list
Created attachment 698585 [details] File: proc_pid_status
Created attachment 698586 [details] File: var_log_messages
Created attachment 698587 [details] File: open_fds
Created attachment 698588 [details] File: build_ids
Bug caused by shitty code. used join instead of +. Move along folks..