mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
fix: Move FileNotFoundError handling up after file open and read
This commit is contained in:
parent
35c6d5b569
commit
b219e790a4
1 changed files with 7 additions and 4 deletions
11
testsr.py
11
testsr.py
|
@ -15,12 +15,15 @@ def process_markdown(filename):
|
|||
try:
|
||||
with open(filename, "r") as file:
|
||||
content = file.read()
|
||||
except FileNotFoundError:
|
||||
print(json.dumps({"error": f"File '{filename}' not found."}, indent=4))
|
||||
return
|
||||
|
||||
# Split the content into sections based on '####' headers
|
||||
sections = re.split(r"(?=####\s)", content)
|
||||
# Split the content into sections based on '####' headers
|
||||
sections = re.split(r"(?=####\s)", content)
|
||||
|
||||
results = []
|
||||
for section in sections:
|
||||
results = []
|
||||
for section in sections:
|
||||
if not section.strip(): # Ignore empty sections
|
||||
continue
|
||||
# Extract the header (if present)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue