2012-10-03 3 views
1

저는 Python 2.7, Boto 2.6 및 py2exe를 사용하여 Amazon의 Dynamodb와 상호 작용하는 Windows 실행 파일을 만듭니다. 응용 프로그램은 py2exe를 사용하여 컴파일되지만 AWS와 상호 작용할 때마다 무기한 중단됩니다.Boto with py2exe

여기 py2exe에

from distutils.core import setup 
import py2exe 
import sys 

setup(windows=[{"script" : "smart_gui.py"}], 
options={"py2exe" : { 
"includes" : ["sip", "PyQt4", "simplejson", "email","lxml","http", "urllib", 
"email"], 
"packages":["gzip", "email"], 
"excludes":["Carbon","_scproxy", "Carbon.Files"]}}) 

내 setup.py이며,이 라인은 무기한 손으로 할 수있는 프로그램을 발생합니다. 여기

table = self.dynamo.get_table(self.conf['users_table']) 

The following modules appear to be missing 
['Crypto.PublicKey._fastmath', 'builtins', 'cchardet', 'certifi', 'email.Charset', 
'email.Encoders', 'email.Errors', 'email.Generator', 'email.Header', 
'email.Iterators', 'email.MIMEAudio', 'email.MIMEBase', 'email.MIMEImage', 
'email.MIMEMessage', 'email.MIMEMultipart', 'email.MIMEText', 'email.Message', 
'email.Parser', 'email.Utils', 'email.base64MIME', 'email.quopriMIME', 'http.client', 
'http.cookiejar', 'http.cookies', 'kerberos', 'oauthlib.common', 'oauthlib.oauth1', 
'oauthlib.oauth1.rfc5849', 'packages.ssl_match_hostname.CertificateError', 
'packages.ssl_match_hostname.match_hostname', 'queue', 'simplejson._speedups', 
'test.test_support', 'urllib.parse', 'urllib.request'] 

Make sure you have the license if you distribute any of them, and 
make sure you don't distribute files belonging to the operating system. 

OLEAUT32.dll - C:\Windows\system32\OLEAUT32.dll 
USER32.dll - C:\Windows\system32\USER32.dll 
MSVCP90.dll - C:\Users\karl\Desktop\Smart_Select\MSVCP90.dll 
SHELL32.dll - C:\Windows\system32\SHELL32.dll 
KERNEL32.dll - C:\Windows\system32\KERNEL32.dll 
WINMM.dll - C:\Windows\system32\WINMM.dll 
COMDLG32.dll - C:\Windows\system32\COMDLG32.dll 
ADVAPI32.dll - C:\Windows\system32\ADVAPI32.dll 
NETAPI32.dll - C:\Windows\system32\NETAPI32.dll 
WS2_32.dll - C:\Windows\system32\WS2_32.dll 
WINSPOOL.DRV - C:\Windows\system32\WINSPOOL.DRV 
GDI32.dll - C:\Windows\system32\GDI32.dll 
IMM32.dll - C:\Windows\system32\IMM32.dll 
VERSION.dll - C:\Windows\system32\VERSION.dll 
ole32.dll - C:\Windows\system32\ole32.dll 
ntdll.dll - C:\Windows\system32\ntdll.dll 

가 어떻게 BOTO이 py2exe에 작업을 얻을 수 py2exe에의와 관계있는 출력입니까?

답변

1

py2app는 모든 종속성을 site-packages.zip에 저장하고 boto는 zip 아카이브에서 직접 cacerts.txt를 읽습니다. '일하지 마라').

py2app의 마법을 압축 해제하는 런타임이 무엇인지 명확하지 않지만 가장 쉬운 해결책은 py2app setup.py의 데이터 파일로 cacerts.txt를 복사하는 것입니다. 내 주요 기능에 다음

DATA_FILES = [                                
#Add the cert                               
('backup_cacert', ['cacerts.txt'])                          
]    

는 무언가 같은 :

import boto.connection                              
try:                                   
    open(boto.connection.DEFAULT_CA_CERTS_FILE)                        
except IOError as e:                                                                            
    boto.connection.DEFAULT_CA_CERTS_FILE = os.path.join(os.path.dirname(__file__), 'backup_cacert', 'cacerts.txt')                          
try:                                   
    open(boto.connection.DEFAULT_CA_CERTS_FILE)                        
except IOError as e:                               
    raise e