So I’m developing a tool for Linux for compiling and installing a game, and I’m making it via python, what I’m trying to do is have the python script run aptitude to install depends, but i get this when returning and printing the output:
Traceback (most recent call last):
File "/home/[redacted]/PycharmProjects/Launcher/backend/terminal_debug.py", line 14, in <module>
output = install_deps.func_install_deps("apt")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[redacted]/PycharmProjects/Launcher/backend/install_deps.py", line 6, in func_install_deps
output = subprocess.Popen(['/bin/apt', 'install', 'libsdl2-dev', 'gcc-mips-linux-gnu make'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/bin/apt'
and here’s the code making it happen:
# install_deps.py
import subprocess
def func_install_deps(packageManager):
if packageManager == "apt":
output = subprocess.Popen(['/bin/apt', 'install', 'libsdl2-dev', 'gcc-mips-linux-gnu make'])
return output
and finally here’s the trimmed code for the file that’s using the install depends function as a module (cmd is a variable that receives user input, but it’s ommited here.)
# terminal_debug.py
import install_deps
if cmd == "install-depends":
output = install_deps.func_install_deps("apt")
print(output)
3