Maybe Ange
Maybe Ange
Explore posts from servers
CC#
Created by Maybe Ange on 5/5/2023 in #help
❔ Just a question
13 replies
CC#
Created by Maybe Ange on 5/4/2023 in #help
❔ [FIX} Csharp & Python / WPF APP
I have a problem with this code, in fact I have a button on my WPF software and when I click on it it executes a separate python script in another file. The problem is that the software returns me my error I made in "Try" and tells me that it can't find the file and it can't run it, yet I don't understand the path is ok , can someone help me?
private void Button_Click(object sender, RoutedEventArgs e)
{
string pythonPath = @"C:\Program Files\Python\Python39\python.exe";
string scriptPath = @"D:\Documents\Script security network\Software Box\Software\Reload Box\scripts\reload-no-time.py";

try
{
if (!File.Exists(scriptPath))
{
throw new FileNotFoundException("Le fichier de script n'existe pas", scriptPath);
}
}
catch (FileNotFoundException ex)
{
MessageBox.Show($"Erreur : {ex.Message}");
return;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string pythonPath = @"C:\Program Files\Python\Python39\python.exe";
string scriptPath = @"D:\Documents\Script security network\Software Box\Software\Reload Box\scripts\reload-no-time.py";

try
{
if (!File.Exists(scriptPath))
{
throw new FileNotFoundException("Le fichier de script n'existe pas", scriptPath);
}
}
catch (FileNotFoundException ex)
{
MessageBox.Show($"Erreur : {ex.Message}");
return;
}
49 replies