Reputation: 1
I've been trying to automate rendering of .wav files from MAME emulator via a Python script. My goal is to have a little website to drop my .bin file on and let the script + MAME handle the rest in the background - then give me back my .wav to download it.
And the whole process works just fine, with the tiny small issue of MAME simply not working with the Python subprocess.
The python code I use to start MAME is:
process = subprocess.Popen(
[
'/path/to/mame',
'channelf',
'-rompath', '/path/to/mame/roms/',
'-cart', '/path/to/file.bin',
'-window',
'-seconds_to_run', str(play_length),
'-nothrottle',
'-ui', 'simple',
'-sound', 'none',
'-video', 'none',
'-wavwrite', '/path/to/file/render.wav',
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
This always returns permanently dropping privs did not work: File exists
.
Executing the exact same command in the shell on the other hand works without issues (working dir doesnt matter because I use full paths only, but I also tried relative paths from my python dir too - same outcome).
# /path/to/mame channelf -rompath /path/to/mame/roms/ -cart /path/to/file.bin -window -seconds_to_run 240 -nothrottle -ui simple -sound none -video none -wavwrite /path/to/file/render.wav
pci id for fd 7: 1b36:0100, driver (null)
MESA-LOADER: failed to open qxl: /snap/mame/4284/gnome-platform/usr/lib/x86_64-linux-gnu/dri/qxl_dri.so: cannot open shared object file: No such file or directory (search paths /snap/mame/4284/gnome-platform/usr/lib/x86_64-linux-gnu/dri, suffix _dri)
pci id for fd 8: 1b36:0100, driver (null)
kmsro: driver missing
Average speed: 7242.29% (239 seconds)
The errors here are seemingly unimportant because this will create the render.wav file correctly.
I didn't find any resources online for this specific issue. The error message seems to come from snapd, and not MAME itself but all the results online are not related to Python subprocesses. Did anyone ever try something like this before?
I am basically just wondering what difference between shell and subprocess could result in this. And ideally, how I can fix it.
Upvotes: 0
Views: 52