fix: handle both direct and module execution for web format

- Add try/except for import compatibility
- Supports both `python3 src/generate.py` and `python3 -m src.generate`
- Fixes nested try/except structure for proper error handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-09-10 06:48:23 -05:00
parent adbefdc363
commit a1fd4c84d3

View File

@@ -459,8 +459,12 @@ def main():
elif args.format == 'web':
# Generate web flashcards (HTML with inline SVG)
try:
from .web_generator import generate_web_flashcards
try:
from .web_generator import generate_web_flashcards
except ImportError:
# Fallback for when running script directly
from web_generator import generate_web_flashcards
result_path = generate_web_flashcards(numbers, final_config, output_path)
print(f"\n✓ Generated web flashcards: {result_path}")
print(f" Open in browser to view interactive flashcards")