diff --git a/chatbug/file_append.py b/chatbug/file_append.py index 15a808f..27b805e 100644 --- a/chatbug/file_append.py +++ b/chatbug/file_append.py @@ -10,10 +10,12 @@ def check_append_file(prompt: str) -> str: filename = part[1:] try: if os.path.exists(filename): - with open(filename, "r") as f: + with open(filename, "r", encoding="utf-8") as f: content.append("%s:'''\n%s'''" % (filename, f.read())) except FileNotFoundError: print(f"File '{filename}' not found.") + except Exception as e: + print("exception encountered %s", e) content.append(prompt) return "\n".join(content) return prompt