2017-02-12 2 views
0

Я создаю приложение с Python и cx_Freeze. Сама программа отлично работает, делая то, что она должна, но сценарий установки не будет работать очень хорошо. Сценарий установки является here--Странная ошибка cx_Freeze

from cx_Freeze import setup, Executable 
    import sys, cx_Freeze 

    includes = ["os", "tkinter", "shutil", "time", "random", "re"] 
    base = None 
    if sys.platform == "win64": base = "Win64GUI" 
    opts = {"include_files": ['open.bat', 'download.gif', 'mountaindew.gif', 'snipe.gif', 'Explosion.gif', 'dorito.gif', 'daoctopus.gif']} 
    exe = Executable(script = "daoctopus.py", 
       base = base) 
    excludes = [] 
    packages = [] 
    setup(name = "DA OCTOPUS", version = "4.0", 
     description = "DA OCTOPUS", author = "DA OCTOPUS Group -- ;]", 
     options={"build_exe": {"excudes": excludes, "packages": packages, "include_files": opts, "includes": includes}, 
     executables = [exe]) 

Но когда я бег:

start python.exe setup.py build 

ех не создаются, и когда я бег самого setup.py, он делает ошибку: показан ниже -

Traceback (most recent call last): 
    File "C:\Python33\Python\Workshop\Bob\Virii\DA_OCTOPUS\Essentials\setup.py", line 15, in <module> 
    executables = [exe]) 
    File "C:\Python33\Python\lib\site-packages\cx_Freeze\dist.py", line 361, in setup 
distutils.core.setup(**attrs) 
File "C:\Python33\Python\lib\distutils\core.py", line 109, in setup 
_setup_distribution = dist = klass(attrs) 
File "C:\Python33\Python\lib\site-packages\cx_Freeze\dist.py", line 23, in __init__ 
distutils.dist.Distribution.__init__(self, attrs) 
File "C:\Python33\Python\lib\distutils\dist.py", line 234, in __init__ 
for (opt, val) in cmd_options.items(): 
AttributeError: 'list' object has no attribute 'items' 

Это очень странно, и я спрашиваю, как это исправить ...

+0

Он ожидает словарь и вы даете это список здесь 'executables = [exe]'. – roganjosh

ответ

0

параметр «include_files» ожидает, что список. Так превратить ваш opts в списке или положить

"include_files": opts["include_files"] 

PS: Я надеюсь, что "excudes": excludes просто опечатка в сообщении, а не в коде ...

Смежные вопросы