with open('/root/crawl_pj_notice.py') as f:
    c = f.read()

# The broken lines - find the exact text and fix
old = '''            if md_rows:
                col_count = len(md_rows[0].split("|")) - 2
                md_table = md_rows[0] + "\n"
                if col_count > 0:
                    md_table += "| " + " | ".join(["---"] * col_count) + " |\n"
                    md_table += "\n".join(md_rows[1:])
                body_parts.append(md_table)'''

new = '''            if md_rows:
                col_count = len(md_rows[0].split("|")) - 2
                md_table = md_rows[0] + "\n"
                if col_count > 0:
                    md_table += "| " + " | ".join(["---"] * col_count) + " |\n"
                    md_table += "\n".join(md_rows[1:])
                body_parts.append(md_table)'''

if old in c:
    c = c.replace(old, new)
    with open('/root/crawl_pj_notice.py', 'w') as f:
        f.write(c)
    print('Fixed - replaced with escaped newlines')
else:
    print('Pattern not found')
    import re
    # Find the problematic area
    idx = c.find('col_count = len')
    if idx >= 0:
        print(c[idx:idx+250])
