Link to home
Start Free TrialLog in
Avatar of NevSoFly
NevSoFly

asked on

run python script in VB.net

I need to run a python script in VB.net.  The script itself works perfectly but will not run when I try to do it withing VB.net.  I get the error "The specified executable is not a valid application for this OS platform."
Label2.Text = String.Empty

        If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
            Dim p As Process = New Process

            txtSD.Text = FolderBrowserDialog1.SelectedPath
            p.StartInfo.FileName = "WinCombineLogs.py" 'set path of current antivirus product.
            p.StartInfo.Arguments = " -d " + DateTimePicker1.Text + " -f " + txtSD.Text 'set arguments of current antivirus product.

            p.StartInfo.UseShellExecute = False 'required for redirect.
            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden 'don't show commandprompt.
            p.StartInfo.CreateNoWindow = True
            p.StartInfo.RedirectStandardOutput = True 'captures output from commandprompt.
            p.Start()
            p.WaitForExit()
        End If
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Hairbrush
Hairbrush
Flag of Jersey image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NevSoFly
NevSoFly

ASKER

where would I find the interpreter for Win XP or Win 7?
As you said that "the script itself works perfectly" I presume you already have the software installed on your PC.  Try looking for C:\Program Files\Python\python.exe

(http://docs.python.org/faq/windows.html#how-do-i-make-python-scripts-executable)
thank you