0

A friend of mine and I are building an engine for a series of RPGs. The project is completely written in python 3.3, using pygame 1.9.2a and (of course) SDL2. We would like to embed the Python interpreter, so that when the user clicks the main.py file (the "executable"), the interpreter opens and execute (read) the file. I think that this involves copying of the python3.dll in the project folder, but do not know much more.

I've tried a few searches, but every time I look, I only found C ++ applications (or similar) trying to use python as a scripting languaje.

Can you help us? We maintain a repository for the project (which is updated every time we add a new idea), which you can visit if you want to see what we are doing.

Thanks again. Zeniel Danaku.

Community
  • 1
  • 1
  • Not exactly. We do not want to convert main.py into an exe. Rather, execute the file as it is. Besides, py2exe won't work with our script, as it's written in python3. – Daniel Rossy Sep 02 '14 at 20:06
  • That's a contradiction though. Since a py file is executed by running python.exe on it. python.exe may or may not access python.dll. There is always an exe file invoked (actually it could be a com file as well) that is executed on windows. – Dov Grobgeld Sep 02 '14 at 20:08
  • We don't mind copying the python.exe file into the proyect folder, but Windows won't recognize the py file if python is not actually installed (we tried with python portable, with no success) – Daniel Rossy Sep 02 '14 at 20:11
  • The association of a py file with the python.exe interpreter is a property in the registry. You can set this property by yourself by your installer and point to your python.exe. The problem is that this association is global, and thus if the user installs another python later on, it will override your private python. One way of solving it is not to use the py extension but your own made up extension e.g. .drpy and then associate drpy with your own python interpreter. Or just create a '.bat' file that runs python on your .py file. Much simpler. – Dov Grobgeld Sep 02 '14 at 20:16
  • The .bat file would be like a launcher, right? – Daniel Rossy Sep 02 '14 at 20:20
  • Yes. À small annoyance is that launching with a batch file alwYs opens a black console in addition to the application. But there is a workaround to that that can be found on the net where the batch file is written in vbs. – Dov Grobgeld Sep 03 '14 at 05:14
  • Not sure but it seems like `exec()` is what you are looking for? --> https://docs.python.org/3/library/functions.html#exec – mozzbozz Nov 10 '14 at 16:16

0 Answers0