Utilisez ce guide pour confirmer que votre intégration Python + Flutter est fonctionnelle.
cd "c:\Users\Admin\Documents\Stage KPIT\desktop_app_final_code_2\code_python"
python example_script.py --operation info --name "Jean" --age 25{
"operation": "info",
"name": "Jean",
"age": 25,
"birth_year": 2000,
"category": "adult",
"status": "success"
}✅ OK? Continuez à l'étape 2.
❌ Erreur? Vérifiez que Python est installé: python --version
.\build_windows.bat[INFO] Python found:
Python 3.x.x
[INFO] Checking PyInstaller installation...
[OK] PyInstaller is already installed
[INFO] Building example_script.py...
[INFO] Running PyInstaller...
[OK] Build completed successfully!
[INFO] Executable created: dist\example_script.exe
[INFO] File size: XXXXX bytes
[INFO] Testing executable...
{"operation": "info", ...}
[OK] Test successful!
✅ OK? Continuez à l'étape 3.
❌ Erreur? Installez PyInstaller: python -m pip install pyinstaller
.\dist\example_script.exe --operation calculate --value 42{
"operation": "calculate",
"input": 42,
"double": 84,
"square": 1764,
"sqrt": 6.4807...
}✅ OK? Continuez à l'étape 4.
❌ Erreur? Vérifiez l'exécutable existe: dir dist\example_script.exe
mkdir ..\python_executables
copy dist\example_script.exe ..\python_executables\
dir ..\python_executables\Directory: C:\Users\Admin\Documents\Stage KPIT\desktop_app_final_code_2\python_executables
example_script.exe 123456 bytes
✅ OK? Continuez à l'étape 5.
❌ Erreur? Vérifiez le dossier: dir ..
lib/services/python_executor.dart
class PythonExecutor {
static Future<PythonExecutionResult> execute(
String scriptName, {
List<String> arguments = const [],
int timeoutSeconds = 30,
}) async {✅ OK? Le service est là.
❌ Erreur? Recréez le fichier depuis CODE_SNIPPETS.md
cd ..
dart lib/test_python_integration_simple.dart============================================================
Python Integration Tests
============================================================
[Test 1] Info operation
✓ PASS Exit code: 0
Response: {operation: info, ...}
[Test 2] Calculate operation
✓ PASS Calculation correct: 42 * 2 = 84
Response: {operation: calculate, ...}
[Test 3] Error handling - missing argument
✓ PASS Correctly failed with exit code 1
Error message: --value is required...
[Test 4] Value extraction from JSON
✓ PASS Extracted value correctly: square = 100
...
============================================================
Test Summary
============================================================
Total tests: 5
Passed: 5
Failed: 0
✓ All tests passed!
✅ OK? Continuez à l'étape 7.
❌ Erreur? Vérifiez python_executables/example_script.exe existe.
flutter run -d windowsLaunching lib\main.dart on Windows in debug mode...
...
Flutter run key commands.
h Hardware-assisted rendering enabled.
r Hot reload. 🔥🔥🔥
R Hot restart.
d Detach (terminate "flutter run").
c Clear the console.
q Quit (terminate the app).
- Écran démarre
- Pas d'erreur rouge
- Interface visible
✅ OK? Allez à l'étape 8.
❌ Erreur? Consultez TESTING_GUIDE.md
- Sélectionnez une opération (Info ou Calculate)
- Entrez les paramètres
- Cliquez "Execute Script"
- Voyez le résultat JSON
{
"operation": "info",
"name": "...",
"age": ...,
...
}✅ OK? ✨ TOUT FONCTIONNE! ✨
Cochez à mesure que vous progressez:
| # | Étape | Commande | ✅ |
|---|---|---|---|
| 1 | Script Python | python example_script.py --operation info --name "Test" --age 25 |
[ ] |
| 2 | Construire .exe | .\build_windows.bat |
[ ] |
| 3 | Tester .exe | .\dist\example_script.exe --operation calculate --value 42 |
[ ] |
| 4 | Copier pour Flutter | copy dist\example_script.exe ..\python_executables\ |
[ ] |
| 5 | Test Dart | dart lib/test_python_integration_simple.dart |
[ ] |
| 6 | Flutter run | flutter run -d windows |
[ ] |
| 7 | Écran fonctionne | Cliquer "Execute Script" dans l'app | [ ] |
Félicitations! Votre intégration Python + Flutter est complètement fonctionnelle.
Vous pouvez maintenant:
- ✅ Créer vos propres scripts Python
- ✅ Les empaqueter en .exe avec PyInstaller
- ✅ Les appeler depuis Flutter
- ✅ Traiter les résultats JSON
- ✅ Déployer l'app avec les exécutables
Consultez ces documents dans cet ordre:
QUICK_TEST_GUIDE_FR.md- Guide rapide de testTESTING_GUIDE.md- Guide complet de testTEST_COMMANDS_SUMMARY.md- Toutes les commandesBEST_PRACTICES.md- Dépannage avancé
| Problème | Solution |
|---|---|
| "python: not found" | Installer Python depuis https://www.python.org/ |
| ".\build_windows.bat: not found" | Naviguez au dossier code_python |
| "example_script.exe: not found" | Exécutez .\build_windows.bat d'abord |
| "Flutter not found" | Installer Flutter depuis https://flutter.dev |
| "Résultat n'est pas du JSON" | Vérifiez la commande ne contient pas d'erreurs |
| "Test Dart échoue" | Vérifiez python_executables/example_script.exe existe |
- Si tout fonctionne: Continuez vers
CODE_SNIPPETS.mdpour apprendre à personnaliser - Si erreurs: Relisez le message d'erreur, consultez les guides
- Si bloqué: Vérifiez que tous les fichiers existent dans leur dossier
Prochaines étapes:
- Lisez
CODE_SNIPPETS.mdpour voir des exemples - Modifiez
example_script.pypour vos besoins - Reconstruisez avec
.\build_windows.bat - Testez dans Flutter
Bonne chance! 🚀