2017-09-07 4 views
0

何を持っていない私は、実行可能ファイルにPythonのファイルを変換しようとしていますが、私は私のコマンドラインでcx_Freeze属性エラー:「リスト」オブジェクトは、属性「アイテムの

python setup.py build 

を実行したとき、私は

を言ってエラーが出ます
Attribute Error: 'list' object has no attribute 'items' 

セットアップファイルまたは私のメインファイルに問題がありますか?

import sys 
from cx_Freeze import setup, Executable 

includefiles = ['Arcade Funk.mp3', 'game over.wav', 'FrogTown.wav','pixel ufo.png','introBackground.png','pixel playButton.png','pixel instructionButton.png','pixel playButtonHighlighted.png','pixel instructionButtonHighlighted.png','instructionPage.png','crashBackground.png','space background long.png','pixel earth.png','pixel asteroid.png', 'pixel icon.png','Montserrat-ExtraBold.otf','Montserrat-Bold.otf','arial.ttf'] 
includes = [] 
excludes = ['Tkinter'] 
packages = ['pygame'] 
build_exe_options = {'includes':[includes],'packages':[packages], 'excludes':[excludes], 'include_files':[includefiles]} 

base = None 
if sys.platform == 'win64': 
    base = 'Win64GUI' 
elif sys.platform == 'win32': 
    base = 'Win32GUI' 

setup( name = 'Earth Invaders', 
     version = '0.1', 
     description = 'Slider Game: Space', 
     options = {'build_exe': [build_exe_options]}, 
     executables = [Executable('EarthInvaders.py', base=base)] 
) 
+0

[はAttributeError: 'リスト' オブジェクトが属性「アイテムの掲載を持っていません]の可能な重複(HTTPS ://stackoverflow.com/questions/46087979/attributeerror-list-object-has-no-attribute-item-ask) – Addison

答えて

0

コードに余分な括弧が含まれているため、不要な追加リストが宣言されています。

build_exe_options = {'includes':includes, 'packages':packages, 'excludes':excludes, 'include_files':includefiles} 

をそして、あなたのオプションの引数は、次のようになります:

あなたbuild_exe_options宣言は読みください

 options = {'build_exe': build_exe_options}, 
関連する問題