Hi. I am trying to freeze a simple wx app with music21,
When i run the wx script (test.py) on its own, it works ok, but when i
have freezed the test.py with the following setup.py and then run the
test.exe file i got the following error:
cx_Freeze: Python error in main script
Traceback (most recent call last):
File
"C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py",
line 27, in <module>
exec(code, m.__dict__)
File "test.py", line 1, in <module>
File "C:\Python27\lib\site-packages\music21\__init__.py", line
180, in <module>
from music21 import * # @UnresolvedImport
AttributeError: 'module' object has no attribute 'audioSearch'
OK
the music21 module are in the C:\Python27\lib\site-packages but not
part of sys.path, therefore i append it to the path at the the top of
the setup.py, but i think that not is enough, so please help:
from cx_Freeze import setup, Executable
import os
import sys
sys.path.append("C:\Python27\Lib\site-packages\music21")
includes = []
excludes = []
exe = Executable(
# what to build
script="test.py",
base="Win32GUI",
targetName = "test.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False
)
setup(
name = "wxSampleApp",
version = "0.1",
author = "No Author",
description = "An example wxPython script",
options = {"build_exe": {"includes": includes,
"excludes": excludes}},
executables = [exe]
)
My test.py is as follows:
from music21 import converter
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(200,100))
s = converter.parse("tinyNotation: 3/4 E4 r f# g=lastG
trip{b-8 a g} c")
#s = converter.parse("cavatina.xml")
self.Show(True)
app = wx.App(False)
frame = MainWindow(None, "Sample editor")
app.MainLoop()
Best regards
Benny Andersen
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
cx-freeze-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users