packp3d mysql

Hello,
I am trying to use packp3d of panda 1.8, and I have an issue.

I have installed a package mysql, and it is present into the lib/site-packages of my python directory into the panda directory.

Launching the game from prompt, in the original way (python, and not p3D), it works fine.

Once I package it with this line :

packp3d -o d:\shim\server\server.p3d -d d:\pascal\shimstar\ShimstarServer -r bullet -r morepy

I launched it throug

panda3d server.p3d

and I got this error :

  File "D:\pascal\shimstar\ShimstarServer\shimstar\bdd\dbconnector.py", line 4,
in <module>
    import mysql.connector
ImportError: No module named mysql.connector
:TaskManager: TaskManager.destroy()
Failure on startup.

It seems that packp3d has not take in the package, the package mysql.

CAn you advice me?

Thank you

During packp3d I got this error:

there are some missing modules : dummy_threading, scproxy, xmlplus, java.lang, mysql.connector, panda3d.Ai, panda3d.bullet

For information, I think I got some unused import I have to clean (like xmlplus, and panda3d.ai).

But the most important are mysql.connector, and panda3d.bullet.

What’s wrong in my line command?
[/code]

You can get bullet by add “-r bullet” to your packp3d command line.

As for mysql, that’s not one of the standard Python packages we host on panda3d.org, so you would have to build it into a package yourself and host that package on your own server if you really need to use it. (This is necessary because it includes compiled modules; it isn’t a pure Python module. If it were pure Python it would just work.)

But note that mysql is just for communicating to a server, which has to be installed separately. So whoever is running your p3d file will have to have separately installed the MySQL server and the appropriate databases. Unless you’re planning on contacting your own server directly over the internet, which introduces other problems.

You’re probably better off using some database other than mysql for local storage. If you need server storage, mysql is a fine choice; but you probably shouldn’t have your distributed p3d files accessing it directly.

David

I had the “-r bullet” in my command line :frowning:

Concerning Mysql, I have a master database hosted on a specific server. It is not a local storage, but a multiplayer game, with distant database.

In this first version, the game contacts the database to gather different information. It is an easiest way, than the server will send through network the datas.

Anyway, for the moment, my game need to access to access through internet to my mysql databse.

I have further questions because of what you wrote.

Do you discourage to access internet database through p3D (in fact exe at final)? Why? What is the matter? which problems?

I don’t know how to build a package like mysql, do you have links to a procedure to do that?

PS: If it is very annoying, I will remove mysql call from my client, and switch to network communication with the server only.

Then perhaps it will work in spite of the error message. Give it a try. Sometimes that error message is incorrect.

No, though it’s not a good game design, because it provides zero security. Any user can corrupt the database completely in his favor.

The procedure is similar to building a p3d file, but it is more involved. You will need a pdef file and the ppackage tool (instead of the packp3d tool), then you will need to host the entire directory of generated contents on your server. The manual has some more information about this.

This is a much better design.

David

Thank you for answer.

For information, I limit access to database on Select.
From this, the security is better.
But I think I will migrate to remove mysql from my client.

Anyway, on my server, if I want to distribute it, I need mysql. So I will try to manage package.

I will try… I Hope to success :stuck_out_tongue:

You can also consider switching to sqlite, which we do provide as a standard package.

David

Oh, I don’t know it was taken in charge.

Maybe it will be the simpliest way to do.

Thanks for advice. I will maybe take this point.