I'm having a bit of trouble in Python 3 lately.
i have a program that uses Pyglet and AVBin to play sound into my game. It's one of my socket tests, so I want to test the game with someone that doesn't even own python. I used to use cx_Freeze for all of my projects, but Im having a huge problem with this one, because of pyglet and especially AVBin. I would appreciate it if anyone can give an answer to this question in a very simple manner. I've seen this answered a few times, but didn't get anything the people said.
Compiling for Windows 7, Python 3. AVBin and Pyglet required.
The question:
How do I compile a Python 3 script that uses AvBin and Pyglet into a Windows Executable, using cx_Freeze?
Since this was my first time on Stack Exchange, I couldn't really describe the question as good as it should be. But, I researched for a few hours, and got it working! I had to upload the Pyglet library with the executable the cx_Freeze made, and also include the AVBin DLL with the executable.
I'm really sorry for asking this question in the first place. I'll make sure my next questions are more detailed.
Related
I have tried many times to use a compiler like cx_freeze and other programs, but for some reason nothing seems to be working. I made a little game which I want to send to a friend, but he needs python installed.
Can't I just put python.exe and pygame into the folder that I will send my friend and won't python be installed then, and all he needs to do is run the program .py and it will work? Sorry if I'm not being clear.. I'm just trying to find a simple way to compile my code to let users not waste time on downloading pygame and python.
py2exe allows you to package python applications for Windows. Right now it supports everything from 2.4 - 3.1 of python. You do however need to be able to redistribute MSVCR90.dll.
There are a range of distribution tools and you can find a list here.
Since you've had difficultly with several tools now updating your question with error codes and speific problems will yeild better responses.
From my knowledge, just putting a bunch of your stuff in one folder and sending doesn't work. It would be easier to make a .exe
That way your stuff will be protected, and users can easily start it. Otherwise idk. Try using pyinstaller again. It should work if you have a python.x
CX_Freeze is known for having many bugs and problems, Pyg.exe is new to me also. Your best bet is just keep trying until you find a solution.
Putting python.exe and your script together in a folder will not work for distribution. You require all Python dependencies - at best your would need to include all of your Python folder, and it still might not work. The best method would be compilation or packaging with programs such as py2exe, cx_freeze, Cython, pyg.exe, etc.
I recently finished up a small game I wrote in python, using pygame, at the request of some of my friends. Currently, I have the .pyw game file, and an assets folder containing all files used in the program. I used py2exe to distribute the game, which worked fine, although it still does not seem very user friendly to people downloading the game. One of my friends requested a mac version of it, and although I know about py2app, I am unsure of how to use it, and whether or not it is the best way to package my game.
Basically, I want a single file that I can send to any mac user, so they can easily use the program I have made, while preferably not seeing the source code.
I have googled around for a simple solution, but have not found one. If anyone could give a very simple explanation of how to easily do this, that would be great. Please keep in mind I am fairly new to programming, and may not understand all the programming lingo, so if you could keep it simple, I would appreciate it.
Thanks in advance.
The answer to How can I distribute python programs? suggests Pyinstaller which looks promising, although I have not tried it myself.
See this tutorial by Irwin Kwan to see how Pyinstaller can actually be used with Pygame. He describes a procedure for preparing a Windows executable as well as one for OS X.
This question already has answers here:
a good python to exe compiler? [closed]
(3 answers)
Closed 9 years ago.
With some useful answers of my previous question (See below), I decided to give py2exe another try.
I tried the tutorial from py2exe.org (http://www.py2exe.org/index.cgi/Tutorial), but got an error at step 3. I did 1 and 2 exactly as told, and put both files (hello.py and setup.py) in my main folder where I installed python in: D:\Programs\Python.
When running the 'code' form step 3 I got the following error, totally on the bottom of the output:
"ImportError: DLL load failed: %1 is not a valid Win32-application.*"
I've got a screenshot of the entire output, but I don't know where to upload it.
Extra information:
I have 64bit Windows 7 (profesional) and Python 2.7.3 (first I had 3.3.0, but downgraded because of some reasons). It is not a big problem for me to change to another version. I downloaded py2exe 0.6.9.
Note: I couldn't choose between py2exe for 32- or 64bit. I guess then a error should show up earlier, but it might be handy to know.
*I literally translated the last part from Dutch, so it can be slightly different then English pc's.
Previous question:
What is the easiest .py to .exe converter?
I've tried a few converters, of which cx_Freeze and py2exe. Using cx_Freeze was too complicated (I couldn't find a good tutorial) and py2exe gave some errors. Before I'm going to try to understand one of these two or try another one, I want some input which converter you think is the best, and I need a good tutorial.
I have barely experience with cmd, and am quite a newbie if it comes to programming/python, so I am looking for the easiest-to-use converter.
If you say I really need some cmd experience, please direct me to a cmd tutorial/course.
you can use GUI2exe that's the easiest way im my opinion !
You wont learn much about the converter's but it gets the job done without any problems.
ps. GUI2exe isnt a converter , its a gui to use the converters!
What kind of erros does py2exe give you? That is what I use and it works like a charm for me.
I've used py2exe previously. I assume you've looked at the tutorial on the py2exe project page?
There is also a good one available on the Python Library page.
I used py2exe for complicated Python/Qt/PyQt applications. The biggest thing you'll need to know about that is that the MSVCP90.dll file is needed. You can get that from Microsoft. You'll then need to copy it and the other files mentioned in it's license to the Python DLLs directory. Detailed instructions are available on the py2exe tutorial (Step 5)
Try py2exe and cx-freeze. These are the two most common ones you'll find out there. Most others are generally a derivative of cx-freeze
I'm having some trouble with distributing my python programs. for linux it's easy enough, just tell people which packages they need and provide the source. for windows however it's a different story altogether. I can get my program compiled with py2exe. the problem there however is that it always seems to miss one dll file or the other.
my question therefore is, is there some easy way to package a python script for multiple platforms? right now I keep having to go on a wild goosechase after dll files I don't have. and this isn't even mentioning the 32bit vs. 64bit problem which leaves a lot to desire.
any and all pointers are welcome. the ideal solution would be some sort of script that would create two zipfiles. one being linux/source and one for windows64bit/windows32bit. I really don't care all that much about mac support, but it would be welcome.
If you support linux, you probably support mac in the same way.
I typically use py2exe to distribute to windows, but there are alternatives, such as cxfreeze, and others. I haven't bothered to care much about 64/32 bit and just deliver a 32 bit solution.
Here are a list of packagers:
http://www.freehackers.org/Packaging_a_python_program
First things first, I am a Python beginner, with a typical C++/Java background for object oriented stuff.
I was convinced to try Python for this current endeavor I am working on, and so far I like it. One issue I am having though is finding a good mp3 module.
I have tried TkSnack, which installed and ran fine with no errors(as long as my audio device wasn't busy) but it could never actually produce a sound, it just did nothing... I went online for help, and was disappointed with the amount of documentation.
So I decided to switch. I tried PyMad because it is in the standard repositories for Ubuntu as well. There was even less documentation on this, but I could make it play a sound. The only problem is that it requires a loop to constantly write/play the audio buffer. This makes it particularly hairy to handle playback control(in my opinion) cause I would have to run this in a separate thread or process, and somehow control the seek position for pause and such. This is a little too low level for why I am using Python. I liked the simplicity of TkSnack for its easy commands like "mysound.play()" or "mysound.pause()" rather than controlling a loop.
I also looked at pyMedia, which looks like it is the most up to date with documentation, but I can't get it to install on my machine. I get a "gcc exited with value 1" error or something like that when running the "python setup.py build" command.
So I am looking for any suggestions or help on one of these modules, or a completely different one, that is high level and easy to use for mp3s(and preferably other formats too) I am trying to have basic playback control(pause, stop, skip, seek) and I may also be streaming files too eventually(if I ever get there).
EDIT: I like the python bindings for Gstreamer, but is this a cross-platform solution?? I forgot to mention that as a requirement. But I always just associated GStreamer with Linux, would this work on other OSs?
EDIT: Wikipedia says yes.
Sorry I can't help you with PyMad or pyMedia, but I have other suggestions.
Existing music players written in Python:
Exaile
FUPlayer
Listen
All of the above use the Python bindings for the GStreamer multimedia framework. Docs for the bindings are scarce, but check here, here, here, and examples from the source distribution here.
I just had to deal with this, and from my research I think your best bets are pyglet and pygame. They're interface packages with built-in a/v support.