Message386187
os.posix_spawn fails with a wrong error information when executing an existing file with shebang pointing to a non-existing file.
$ cat demo
#!/usr/bin/hugo
$ ./demo
bash: ./demo: /usr/bin/hugo: bad interpreter: No such file or directory
$ cat repro.py
import os
os.posix_spawn("./demo", ["./demo"], {})
$ python3.10 repro.py
Traceback (most recent call last):
File "/home/torsava/mess-old/2021-02/python-popen/repro.py", line 2, in <module>
os.posix_spawn("./demo", ["./demo"], {})
FileNotFoundError: [Errno 2] No such file or directory: './demo'
The same problem exists when `demo` is on the PATH.
$ export PATH=".:$PATH"
$ demo
bash: ./demo: /usr/bin/hugo: bad interpreter: No such file or directory
$ cat repro_path.py
import os
os.posix_spawn("demo", ["demo"], {})
$ python3.10 repro_path.py
Traceback (most recent call last):
File "/home/torsava/mess-old/2021-02/python-popen/repro_path.py", line 2, in <module>
os.posix_spawn("demo", ["demo"], {})
FileNotFoundError: [Errno 2] No such file or directory: 'demo' |
|
Date |
User |
Action |
Args |
2021-02-03 10:43:05 | torsava | set | recipients:
+ torsava |
2021-02-03 10:43:04 | torsava | set | messageid: <1612348984.98.0.934369937347.issue43113@roundup.psfhosted.org> |
2021-02-03 10:43:04 | torsava | link | issue43113 messages |
2021-02-03 10:43:04 | torsava | create | |
|