py script error %1 is not a valid Win32 application when run from go code

Viewed 51

When I run the py script directly from cmd it works fine.

But when I run it from Go code:

    command := exec.Command(file.py, params...)
    err = command.Run()

I get an error "%1 is not a valid Win32 application.".

I have simplified the example file:

Py file:

Call via console works correctly:

enter image description here

When I type python, I get some strange result (???)

enter image description here

(Here I've called a few times, it just prints Python when called no matter what's in the file)

When I try to call via go, the error persist

command := exec.Command("C:\\file.py")
err = command.Run()

This is all on version 2.7.17 for Windows x86-64 MSI installer. But I also tried 3.x.x versions and x86 bits, the result is the same

0 Answers
Related