Description:
In the output window, I enter
pe++.py test.cpp
and expect to execute this python script, but it failed and said
%1 is not a valid Win32 application.
Root cause:
In DWORD SciTEWin::ExecuteOne(const Job &jobToRun), when the executable file is a python script, the first call of CreateProcessW will fail and the error code is ERROR_BAD_EXE_FORMAT. The current implementation only try to call CreateProcessW with prefix "cmd.exe /c " when the error code is ERROR_FILE_NOT_FOUND.
Possible fix:
Also try to call CreateProcessW with prefix "cmd.exe /c " if the error code is ERROR_BAD_EXE_FORMAT.
Possible fix code:
DWORD errCode = ::GetLastError();
// if jobCLI "System can't find" or "Bad exe format" - try calling with command processor
if ((!running) && (jobToRun.jobType == jobCLI) && (errCode == ERROR_FILE_NOT_FOUND || errCode == ERROR_BAD_EXE_FORMAT)) {
I'm not seeing this on Windows 10 1709 Fall Creators Update with Python 3.6.1 and current repository SciTE or SciTE 4.0.2. It does initially return ERROR_FILE_NOT_FOUND so gets rerun with cmd/c.
With this script saved into pe++.py:
Running it by typing "pe++.py test.cpp" gives these results:
Its possible that the .py extension is not associated with Python.exe on your machine maybe due to installation or reinstallation or permissioning issues.
Thanks for your reply. I checked and found that I missed something in the description. Here is the steps:
1. Add D:\usr\bin to PATH environment variable.
2. Put pe++.py under D:\usr\bin.
3. Copy pe++.py to D:\, the new name is pe++a.py.
4. Open D:\test.c.
5. In the output window: you can run pe++a.py successfully while railed to run pe++.py.
Committed change as [47bbc6].
Related
Commit: [47bbc6]