Ok, so I have a project that I've written in Python(Actually it's not done yet), its the card game "Cheat" that you play in the command prompt with (until I learn wxPython -- GUI for Python) with computer players (or other people with you). I want to distribute it later, and I've found a way to make a nice executable installer to make it easy for the users. The problem is it will install the python files on their system, and theres not much point in an easy to use installer if they also have to go download the python interpreter. So anyway, I want it to download a .exe file also so you can just click it and play (Obviously will only work on windows, maybe after I solve this I might make executables for other platforms). So what I want to do is to Make a C program that will call a single function from the python program, which will play the game (without the user needing to install python). I tried, but I got all confused with a lot of errors. Also, it may seem the obvious solution is to just program the whole game in C, but I don't really like C, I prefer python, and if someone can come up with a simple way to do this, I'll write all my projects in python and use this to make the exe. I tried including the Python.h header and then using RunPy_SimpleString among other things but nothing seems to work, all giving me errors and I'm tired of trying. I looked up before this some Python things for making exe's like "freeze", which makes enormous C byte arrays with python somehow.., and other things, but I couldn't find them where they should have been, I just want to directly make the C program if possible. So if anyone knows anything about this, please post. I don't know very much about C, but I can program and understand it fine because I did Java for a long time before I started Python, the only exception being that I'm not familiar with its API, which makes it harder since I havn't been able to find clear 'official' documentation anywhere. Thankyou in advance, sorry for the long post.
(I'm pretty sure this is more related to C than Python so I put it here)

No the problem is with python...you can't run python code without having python installed (or using the large python dll that has all of the python stuff in it.) The python code expects that all to be there.

If you want to reduce the size of what you're shipping, you need to use a language that is better able to be selective about what it has to have to run (like C).

hmm, well I havn't even been able to get it to run with python installed, could you help me there maybe? And the things like freeze and py2exe don't require the user to install python.. somehow but I can't figure out how to use those. I don't mind that much requiring python to be installed when I distribute it as long as I have an exe file that you can click instead of going to command prompt and typing python foo.py. So could someone help me on how to call the method with python installed? thanks.

EDIT: Actually I guess the exe file could just be a function that does the command "python foo.py" and it could find the other file since its in the same folder... Would that work?
I tried making a exe file typing "python " and then the path to one of my .py files and i saved as exe, when I open it in notepad it has converted to a bunch of numbers and symbols, but when I run it it opens command prompt for 1 second and then closes, even though I made the .py file ask for input in an infinity loop or make it pring 30000 *'s... So if someone could point me in the right direction for this.

py2exe don't require the user to install python.. somehow but I can't figure out how to use those.

Try going through the py2exe tutorial.

EDIT: Actually I guess the exe file could just be a function that does the command "python foo.py" and it could find the other file since its in the same folder... Would that work?

If you'll use py2exe to assemble all the files your python prog needs, you can skip the idea of coding anykind of wrapper application in C just to get the game up and running. I.e. the dist directory will contain the files you need to distribute, including the .exe.

I think using py2exe would be handy, since no python installation is required on the target computers (and you can code everything in python).

Py2exe sounds great, thanks for the link, but does it work with python 3? That's the main problem I had with freeze and the others.. version 3 is pretty new and I've been using it, but all those programs haven't updated yet, and I don't want to convert my project to an older version.. well I'll try it out and let you know.

Yeah, just to install it you need python 2.7, but I'll install python 2.7 then install py2exe then try it on my py 3 program.. It looks great though, does exactly what I want.

Thankyou very much mitrmkar, I tried it on a test program and it works great. Thread solved.

This question has already been answered. Start a new discussion instead.