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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user