[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] mixer.music in runtime
C:\test>zsetup.py py2exe
running py2exe
*** searching for required modules ***
Traceback (most recent call last):
File "C:\test\zSetup.py", line 168, in <module>
cmdclass = {"py2exe": build_installer},
File "C:\Python25\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python25\lib\distutils\dist.py", line 974, in run_commands
self.run_command(cmd)
File "C:\Python25\lib\distutils\dist.py", line 994, in run_command
cmd_obj.run()
File "C:\test\zSetup.py", line 139, in run
py2exe.run(self)
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 218, in run
self._run()
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 269, in _run
self.find_needed_modules(mf, required_files, required_modules)
File "C:\Python25\Lib\site-packages\py2exe\build_exe.py", line 1172, in find_n
eeded_modules
mf.import_hook(mod)
File "C:\Python25\Lib\site-packages\py2exe\mf.py", line 649, in import_hook
return Base.import_hook(self,name,caller,fromlist)
File "C:\Python25\Lib\site-packages\py2exe\mf.py", line 131, in import_hook
m = self.load_tail(q, tail)
File "C:\Python25\Lib\site-packages\py2exe\mf.py", line 197, in load_tail
raise ImportError, "No module named " + mname
ImportError: No module named pygame.mixer.music
--- René Dudfield <renesd@xxxxxxxxx> wrote:
> hey,
>
> thanks... I'm not near a windows machine at the moment... so I can't
> test. Strangely the py2exe stuff works for me.
>
> However... what I meant before to try would be this... in your setup.
>
> excludes = []
> includes = ["pygame.mixer.music", "pygame.mixer_music", "pygame"]
>
> opts = {
> "py2exe": {
> "includes":includes,
> "excludes":excludes
> }
> }
>
> setup(...
> options=opts
> )
>
>
>
>
>
> On Wed, May 21, 2008 at 10:44 AM, Keith Nemitz <musenik@xxxxxxxxx> wrote:
> >
> > I've uploaded a minimal app that has the problem.
> >
> > http://p4.hostingprod.com/@mousechief.com/musicFailSetup.exe
> >
> >
> > Here's the two relevant files:
> >
> > ------------------------------------- audio py
> >
> >
> >
> > import pygame,os
> >
> > musicNames = [];
> > #soundNames = ["sangria","sonar","drop","badswap","chaching","wall"];
> > soundNames = [];
> > soundLib = {};
> >
> > mixer = music = None; #Hogari_Hisaaki-Yasuko_Yamano-Beagle.ogg
> > nextMusic = 0;
> > musicVolume = 1.0; #0.4;
> > musicFlag = True;
> >
> > lastSound = "";
> > lastSndTime = 0;
> > loopSound = None;
> >
> >
> > def InitSounds():
> > global mixer, music, musicNames;
> >
> > #try:
> > import pygame.mixer as pymix
> > mixer = pymix;
> > import pygame.mixer_music
> > music = pymix.music;
> > #except (ImportError, pygame.error):
> > # return;
> >
> > tp = os.path.join('data','music');
> > tl = os.listdir(tp);
> > for fname in tl:
> > if (fname[-4] == '.'):
> > musicNames.append(fname);
> > music.set_volume(musicVolume);
> >
> > PlayMusic();
> > while music.get_busy():
> > pass
> > pass
> >
> >
> > def PlayMusic(name, loopCount=1):
> > if (not music or not musicFlag): return;
> > #check music loop preference if loop: loop = -1;
> > loop = loopCount;
> >
> > if music.get_busy():
> > #we really should fade out nicely and
> > #wait for the end music event, for now, CUT
> > music.stop();
> >
> > fullname = os.path.join('data', 'music', name);
> > if (os.access(fullname,os.F_OK)):
> > music.load(fullname);
> > else:
> > fullname = os.path.join('data', 'sounds', name);
> > music.load(fullname);
> > music.play(loop);
> > return;
> >
> >
> >
> > ------------------------------------- setup.py
> >
> > # A setup script showing how to extend py2exe.
> > #
> > # In this case, the py2exe command is subclassed to create an installation
> > # script for InnoSetup, which can be compiled with the InnoSetup compiler
> > # to a single file windows installer.
> > #
> > # By default, the installer will be created as dist\Output\setup.exe.
> >
> > from distutils.core import setup
> > import py2exe
> > import sys
> > import shutil
> >
> > ################################################################
> > # arguments for the setup() call
> >
> > brigiton = dict(
> > script = "main.py",
> > dest_base = r"prog\brigiton",
> > icon_resources = [(1,"DHSGiT.ico")])
> >
> > zipfile = r"lib\shardlib"
> >
> > options = {"py2exe": {"compressed": 0,
> > "optimize": 2}, }
> >
> > #dataList = []; #glob.glob("data\\*");
> > #scan data folder for files and append in form "data\file
> >
> > ################################################################
> > import os
> >
> > class InnoScript:
> > def __init__(self,
> > name,
> > lib_dir,
> > dist_dir,
> > windows_exe_files = [],
> > lib_files = [],
> > data_files = [],
> > version = "1.0.2.0"): #another one down below.
> > self.lib_dir = lib_dir
> > self.dist_dir = dist_dir
> > if not self.dist_dir[-1] in "\\/":
> > self.dist_dir += "\\"
> > self.name = name
> > self.version = version
> > self.windows_exe_files = [self.chop(p) for p in windows_exe_files]
> > self.lib_files = [self.chop(p) for p in lib_files]
> >
> > def chop(self, pathname):
> > assert pathname.startswith(self.dist_dir)
> > return pathname[len(self.dist_dir):]
> >
> > def create(self, pathname="dist\\brigiton.iss"):
> > self.pathname = pathname
> > ofi = self.file = open(pathname, "w")
> > print >> ofi, "; WARNING: This script has been created by py2exe. Changes to this
> script"
> > print >> ofi, "; will be overwritten the next time py2exe is run!"
> > print >> ofi, r"[Setup]"
> > print >> ofi, r"AppName=%s" % self.name
> > print >> ofi, r"AppVerName=%s %s" % (self.name, self.version)
> > print >> ofi, r"DefaultDirName={pf}\%s" % self.name
> > print >> ofi, r"DefaultGroupName=%s" % self.name
> > print >> ofi
> >
> > print >> ofi, r"[Dirs]"
> > print >> ofi, r'Name: "{app}\prog\data"'
> > print >> ofi, r'Name: "{app}\prog\data\music"'
> >
> > print >> ofi
> >
> > print >> ofi, r"[Files]"
> > print >> ofi, r'Source: "prog\data\music\*"; DestDir: "{app}\prog\data\music"; Flags:
> > ignoreversion'
> >
> >
> > print >> ofi, r'Source: "prog\msvcr71.dll"; DestDir: "{app}\prog"; Flags:
> ignoreversion'
> > #print >> ofi, r'Source: "prog\libpng12-0.dll"; DestDir: "{app}\prog"; Flags:
> > ignoreversion'
> > #print >> ofi, r'Source: "prog\jpeg.dll"; DestDir: "{app}\prog"; Flags: ignoreversion'
> > #print >> ofi, r'Source: "prog\libvorbisfile-3.dll"; DestDir: "{app}\prog"; Flags:
> > ignoreversion'
> > #print >> ofi, r'Source: "prog\libogg-0.dll"; DestDir: "{app}\prog"; Flags:
> ignoreversion'
> > #print >> ofi, r'Source: "prog\libvorbis-0.dll"; DestDir: "{app}\prog"; Flags:
> > ignoreversion'
> > print >> ofi, r'Source: "prog\libfreetype-6.dll"; DestDir: "{app}\lib"; Flags:
> > ignoreversion'
> > #print >> ofi, r'Source: "prog\zlib1.dll"; DestDir: "{app}\lib"; Flags: ignoreversion'
> >
> >
> > for path in self.windows_exe_files + self.lib_files:
> > print >> ofi, r'Source: "%s"; DestDir: "{app}\%s"; Flags: ignoreversion' % (path,
> > os.path.dirname(path))
> > print >> ofi
> >
>
=== message truncated ===