[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OSError: [WinError 193] %1 is not a valid Win32 application
From: |
Bruno Haible |
Subject: |
Re: OSError: [WinError 193] %1 is not a valid Win32 application |
Date: |
Tue, 30 Apr 2024 15:44:31 +0200 |
Hi,
Jianshan Jiang wrote:
> I use the newest version of gnulib from git. when I run the
> ./autogen.sh where I create for sed-4.9. gnulib-tool will throw an
> exception like below:
> ...
> File "C:\Python312\Lib\subprocess.py", line 1538, in _execute_child
> hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> OSError: [WinError 193] %1 is not a valid Win32 application
Two questions and one suggestion:
1) You're apparently using Windows and can execute shell scripts.
Which environment are you using for doing so? Cygwin? MSYS2? Other?
2) Why are you spending time to write an autogen.sh script for sed,
when the README-hacking file recommends to use the 'bootstrap'
script for the same purpose?
And a suggestion: What if you set the environment variable
GNULIB_TOOL_IMPL=sh ? Does your autogen.sh work then?
> Finally, I have found the solution. I have add the 'shell=True' into
> function sp.run in GLImport.py. You can see the detail
> in 001-gnulib-fix-WinError-193.diff.
Collin: Before you just apply this patch, two notes:
* The patch is a pessimization on Unix systems, since executing with
shell=True is slower than without.
* We have basically three ways to deal with this (that I can see):
a) Update the requirements and say that a Cygwin environment with a
Cygwin-based Python build is required. (I tested that; so, we know
that works.)
b) Change the gnulib-tool entry-point script to prefer the shell-based
implementation if the host OS, as viewed from Python, is native
Windows (not Cygwin).
c) Port gnulib-tool.py to native Windows.
Your choice.
Bruno