Spaces:
Sleeping
Sleeping
Update bs/balance_sheet_generator.py
#10
by
sahil-1-garg
- opened
bs/balance_sheet_generator.py
CHANGED
|
@@ -696,7 +696,7 @@ def main() -> None:
|
|
| 696 |
"""
|
| 697 |
logger.info(" ENHANCED BALANCE SHEET GENERATOR v3.0 (Template-Based) started.")
|
| 698 |
import sys
|
| 699 |
-
api_key =
|
| 700 |
input_file = settings.input_file
|
| 701 |
output_dir = settings.output_dir
|
| 702 |
if len(sys.argv) > 1:
|
|
@@ -704,11 +704,11 @@ def main() -> None:
|
|
| 704 |
if len(sys.argv) > 2:
|
| 705 |
output_dir = sys.argv[2]
|
| 706 |
if not api_key:
|
| 707 |
-
logger.error(" Missing
|
| 708 |
-
|
| 709 |
if not os.path.exists(input_file):
|
| 710 |
logger.error(f" Input file not found: {input_file}. Please ensure your JSON data file exists.")
|
| 711 |
-
|
| 712 |
|
| 713 |
generator = EnhancedBalanceSheetGenerator(api_key)
|
| 714 |
try:
|
|
@@ -720,10 +720,13 @@ def main() -> None:
|
|
| 720 |
print(f"Output file: {abs_path}") # For API subprocess parsing
|
| 721 |
else:
|
| 722 |
logger.error(f" PROCESSING FAILED. Output file not created: {abs_path}")
|
|
|
|
| 723 |
else:
|
| 724 |
logger.error(" PROCESSING FAILED. Please check the error messages above and try again.")
|
|
|
|
| 725 |
except Exception as e:
|
| 726 |
logger.error(f" Fatal error: {e}", exc_info=True)
|
|
|
|
| 727 |
|
| 728 |
if __name__ == "__main__":
|
| 729 |
main()
|
|
|
|
| 696 |
"""
|
| 697 |
logger.info(" ENHANCED BALANCE SHEET GENERATOR v3.0 (Template-Based) started.")
|
| 698 |
import sys
|
| 699 |
+
api_key = os.environ.get("OPENROUTER_API_KEY")
|
| 700 |
input_file = settings.input_file
|
| 701 |
output_dir = settings.output_dir
|
| 702 |
if len(sys.argv) > 1:
|
|
|
|
| 704 |
if len(sys.argv) > 2:
|
| 705 |
output_dir = sys.argv[2]
|
| 706 |
if not api_key:
|
| 707 |
+
logger.error(" Missing OpenRouter API key. Please provide a valid OPENROUTER_API_KEY.")
|
| 708 |
+
sys.exit(1)
|
| 709 |
if not os.path.exists(input_file):
|
| 710 |
logger.error(f" Input file not found: {input_file}. Please ensure your JSON data file exists.")
|
| 711 |
+
sys.exit(1)
|
| 712 |
|
| 713 |
generator = EnhancedBalanceSheetGenerator(api_key)
|
| 714 |
try:
|
|
|
|
| 720 |
print(f"Output file: {abs_path}") # For API subprocess parsing
|
| 721 |
else:
|
| 722 |
logger.error(f" PROCESSING FAILED. Output file not created: {abs_path}")
|
| 723 |
+
sys.exit(1)
|
| 724 |
else:
|
| 725 |
logger.error(" PROCESSING FAILED. Please check the error messages above and try again.")
|
| 726 |
+
sys.exit(1)
|
| 727 |
except Exception as e:
|
| 728 |
logger.error(f" Fatal error: {e}", exc_info=True)
|
| 729 |
+
sys.exit(1)
|
| 730 |
|
| 731 |
if __name__ == "__main__":
|
| 732 |
main()
|