Using requests library with Panda3d and packp3d [SOLVED]

Hi Panda people!

I’ve been developing a small game with my university group for the last few months, and finally we’re nearing the end of its implementation.

So far, we’ve been able to manage any and all issues on our own. However, we ran into a series of issues when we wanted to pack and redistribute our game (for testing).

The problem seems to be related to the requests package (see http://docs.python-requests.org/en/latest/). It’s not included by the Panda3d team, so we tried several solutions.

First we tried to include the requests module directly in the game folder, and using sys.path.insert(0, ‘’) right before importing the requests module. That did not work, providing the error message that “Module requests was not found”.

Then we tried to package the requests module ourselves (using ppackage) and hosting it on our own url.
Then we use -r requests,1,hostURL (and yes, we set the version number to 1 in the config.pdef file). This produced the same or a very similar error.
And yes, hostURL is an actual url in our attempts.

Then we tried using the base.appRunner.installPackage(requests, 1, hostURL) at runtime (before any other game code was initialized). This produced the same error that the module could not be found.

Myself and my group are pretty much going out of our skin with this issue; we’re so close to being ready to test, and our deadline is fast approaching.
Please help!

Any experiences (issues or solutions) related to including third party libraries with the packp3d tool and pdeploy tools would be helpful.

Isn’t ‘requests’ written in Python? You could just pack the py/pyc files with your game, no?

Hi,

Thanks for your quick response.
I’m not completely sure what you mean by

We tried to place the requests module inside the game folder and include it like so. But it still complained about missing the requests module when we try to packp3d it.

Could you maybe elaborate on what you mean and ideally provide an example?

It should be as simple as that. If there’s nothing special about that module then it should just work. Maybe requests needs some default python modules not packedinto a p3d file… have you tested it with packp3d -r morepy?

Can’t help more, a David could be needed :wink:

Hi again,

Thanks for your answer again.

We managed to solve the problem by using ppackage and placing the requests module inside the game folder. I’m not sure why that approach did not work earlier, but at least the problem is now solved.