Deploying with pdeploy and packp3d when using subprocess

I did some testing of using packp3d and pdeploy with a game that calls a subprocess using python’s subprocess module.

This is what the function that calls the subprocess looks like:

def hostGame(self):
		args = ["python", "Game.py", "-m", "H"]
		game = subprocess.Popen(args)
		base.closeWindow(base.win)
		game.wait()
		base.openDefaultWindow()
		self.setWindowProperties()
		self.hub.menuSpoke.createMenu(self.menuArgs)

When I install the game and run it on my laptop, it doesn’t seem to open the subprocess, it moves immediately to base.openDefaultWindow(), because there isn’t a subprocess to wait for. How do I fix this?

In the p3d environment, there isn’t necessarily a “python” executable on the PATH. There’s no reason to assume that the user running the p3d file even has Python installed at all (and a full installation of Python isn’t part of the p3d download).

So while the subprocess module is technically available, it will be difficult to use it to launch a subordinate Python process. I think you will need to find another way to launch your game.

David