2012-12-07 25 views
6

मैंने केवल एक बार पहले PyInstaller का उपयोग किया है, और यह WxPython के साथ बहुत सीधे आगे काम किया है। मैं वर्तमान में एक अलग परियोजना बनाने की कोशिश कर रहा हूं। कमांड लाइन से चलने पर प्रोजेक्ट अच्छी तरह से काम करता है। इसके निर्माण के बाद, हालांकि, यह मुख्य विंडो (WxPython) कभी लॉन्च नहीं करता है।मैं एक गैर-कार्यशील PyInstaller निर्माण कैसे डिबग कर सकता हूं?

मैंने बिल्ड स्पेस में डीबग और कंसोल झंडे को सही पर सेट किया है। मैंने Pybstaller मैन्युअल द्वारा निर्दिष्ट वर्बोज़ विकल्प ([('v', '', 'OPTION')]) भी जोड़ा है।

 
# -*- mode: python -*- 
# basedir = os.path.realpath(os.path.dirname(__file__)) 
basedir = os.getcwd() 

# Build the icons toc. 
icons_toc = [] 
for dir in os.walk(os.path.join(basedir, 'icons')): 
    for icon in dir[2]: 
     icons_toc.append(
      (
       os.path.join('icons', icon), 
       os.path.join(dir[0], icon), 
       'DATA', 
      ) 
     ) 

a = Analysis(
    ['application.py'], 
    pathex=['.', './lib', '../broadpy/lib', '../broadpy/vendor'], 
    hiddenimports=[], 
    hookspath=None 
) 
a.datas += icons_toc 

pyz = PYZ(a.pure) 

exe = EXE(
    pyz, 
    a.scripts + [('v', '', 'OPTION')], 
    a.binaries, 
    a.zipfiles, 
    a.datas, 
    name=os.path.join(
     'dist', 'Address cleaner.exe' 
    ), 
    debug=True, 
    strip=None, 
    upx=True, 
    console=True 
) 

app = BUNDLE(
    exe, 
    name=os.path.join('dist', 'Address cleaner.app') 
) 

अब जब मैं बनाया निष्पादन योग्य चलाने के लिए, मैं इस उत्पादन मिलता है:: तो अब मैं वहाँ देखने

C:\Users\tomas\Dropbox\Broadnet\address_cleaner>"C:\Users\tomas\Dropbox\Broadnet\address_cleaner\dist\Address cleaner.exe" 
_MEIPASS2 is NULL 
archivename is C:\Users\tomas\Dropbox\Broadnet\address_cleaner\dist\Address cleaner.exe 
Extracting binaries 
Executing self as child with Setting up to run child 
Creating child process 
Waiting for child process to finish... 
_MEIPASS2 is C:/Users/tomas/AppData/Local/Temp/_MEI30762/ 
archivename is C:\Users\tomas\Dropbox\Broadnet\address_cleaner\dist\Address cleaner.exe 
Already in the child - running! 
manifestpath: C:/Users/tomas/AppData/Local/Temp/_MEI30762/Address cleaner.exe.manifest 
Activation context created 
Activation context activated 
C:/Users/tomas/AppData/Local/Temp/_MEI30762/python27.dll 
Manipulating evironment 
PYTHONPATH=C:/Users/tomas/AppData/Local/Temp/_MEI30762;C:/Users/tomas/Dropbox/Broadnet/address_cleaner/dist 
PYTHONHOME=C:/Users/tomas/AppData/Local/Temp/_MEI30762/ 
v 
# installing zipimport hook 
import zipimport # builtin 
# installed zipimport hook 
importing modules from CArchive 
import marshal # builtin 
extracted iu 
import imp # builtin 
import nt # builtin 
extracted struct 
import _struct # builtin 
extracted archive 
Installing import hooks 
out00-PYZ.pyz 
Running scripts 
import zlib # builtin 
import errno # builtin 
import _weakref # builtin 
import _codecs # builtin 
import _sre # builtin 
import _collections # builtin 
import operator # builtin 
import itertools # builtin 
import _bisect # builtin 
import _heapq # builtin 
import thread # builtin 
import math # builtin 
import binascii # builtin 
import _hashlib # dynamically loaded from C:\Users\tomas\AppData\Local\Temp\_MEI30762\_hashlib.pyd 
import _random # builtin 
import cStringIO # builtin 
Traceback (most recent call last): 
    File "", line 65, in 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in importHook 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in doimport 
    File "C:\Users\tomas\Dropbox\Broadnet\address_cleaner\build\pyi.win32\buildspec\out00-PYZ.pyz\win32com", line 5, in 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in importHook 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 459, in doimport 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 248, in getmod 
    File "C:\Users\tomas\Downloads\pyinstaller-2.0\PyInstaller\loader\iu.py", line 105, in getmod 
ImportError: DLL load failed: The specified module could not be found. 
RC: -1 from pyi_rth_win32comgenpy 
OK. 
Deactivating activation context 
Releasing activation context 
Done 
# clear __builtin__._ 
# clear sys.path 
# clear sys.argv 
# clear sys.ps1 
# clear sys.ps2 
# clear sys.exitfunc 
# clear sys.exc_type 
# clear sys.exc_value 
# clear sys.exc_traceback 
# clear sys.last_type 
# clear sys.last_value 
# clear sys.last_traceback 
# clear sys.path_hooks 
# clear sys.path_importer_cache 
# clear sys.meta_path 
# clear sys.flags 
# clear sys.float_info 
# restore sys.stdin 
# restore sys.stdout 
# restore sys.stderr 
# cleanup __main__ 
# cleanup[1] cStringIO 
# cleanup[1] __future__ 
# cleanup[1] _collections 
# cleanup[1] encodings 
# cleanup[1] site 
# cleanup[1] atexit 
# cleanup[1] shutil 
# cleanup[1] _heapq 
# cleanup[1] _weakref 
# cleanup[1] abc 
# cleanup[1] _bisect 
# cleanup[1] _weakrefset 
# cleanup[1] tempfile 
# cleanup[1] binascii 
# cleanup[1] sre_constants 
# cleanup[1] collections 
# cleanup[1] _codecs 
# cleanup[1] _warnings 
# cleanup[1] math 
# cleanup[1] operator 
# cleanup[1] fnmatch 
# cleanup[1] codecs 
# cleanup[1] re 
# cleanup[1] _struct 
# cleanup[1] thread 
# cleanup[1] keyword 
# cleanup[1] signal 
# cleanup[1] random 
# cleanup[1] itertools 
# cleanup[1] encodings.aliases 
# cleanup[1] exceptions 
# cleanup[1] heapq 
# cleanup[1] sre_compile 
# cleanup[1] _sre 
# cleanup[1] _random 
# cleanup[1] hashlib 
# cleanup[1] bisect 
# cleanup[1] sre_parse 
# cleanup[1] _hashlib 
# cleanup[2] copy_reg 
# cleanup[2] iu 
# cleanup[2] os.path 
# cleanup[2] archive 
# cleanup[2] struct 
# cleanup[2] errno 
# cleanup[2] imp 
# cleanup[2] _abcoll 
# cleanup[2] ntpath 
# cleanup[2] nt 
# cleanup[2] genericpath 
# cleanup[2] stat 
# cleanup[2] zipimport 
# cleanup[2] warnings 
# cleanup[2] UserDict 
# cleanup[2] types 
# cleanup[2] zlib 
# cleanup[2] linecache 
# cleanup[2] os 
# cleanup[2] marshal 
# cleanup sys 
# cleanup __builtin__ 
# cleanup ints: 41 unfreed ints 
# cleanup floats: 31 unfreed floats 
Back to parent... 
Freeing status for C:\Users\tomas\Dropbox\Broadnet\address_cleaner\dist\Address cleaner.exe 

iu.py से उठाया अपवाद है, लेकिन मैं अभी भी नहीं है यहाँ कल्पना है विचार क्यों मुझे यह भी रहस्यमय लगता है कि मेरे डाउनलोड/पीई-इंस्टॉलर फ़ोल्डर में एक पायथन फ़ाइल चलती है, भले ही मैं उस फ़ोल्डर को हटा दूं।

तो सारांशित करने के लिए - मुझे यह पता लगाने के लिए क्या कदम उठाने होंगे कि एप्लिकेशन स्टार्टअप पर क्यों क्रैश हो रहा है? के रूप में मैं एक और परियोजना को सफलतापूर्वक निर्माण कर रहा हूँ


मैं उन अकेले तथ्यों के Windows 8 कोई नहीं पर PyInstaller 2.0 उपयोग कर रहा हूँ अजगर 2.7.3 के साथ, इस त्रुटि का कारण बनता है।

उत्तर

0

मुझे पता है कि यह उत्तर इस तरह के मुद्दों को डीबग करने का उत्तर नहीं देता है, इसलिए मैं इसे सही के रूप में चिह्नित नहीं करूंगा, लेकिन मैं एप्लिकेशन बनाने में कामयाब रहा और मैंने सोचा कि मुझे कैसे साझा करना चाहिए। मैं तीन बातें, जिनमें से प्रत्येक त्रुटि के कारण हो सकता है किया था, लेकिन हम कभी पता नहीं चलेगा:

  • मैं आधिकारिक अजगर 2.7.3 के साथ ActivePython 2.7.3 बदल दिया।
  • मैंने शुद्ध पाइथन ड्रॉप-इन प्रतिस्थापन pymysql के साथ MySQLdb को प्रतिस्थापित किया।
  • मैंने Levenshtein को उसी तरह की विधि difflib.SequenceMatcher.ratio के साथ बदल दिया।
1

Pyinstaller sometimes needs explicit references in the .spec file to correctly package dependencies

अधिक जानकारी के लिए, ensuring proper import statements so that pyinstaller recognizes them देखें।

उदाहरण के लिए, यदि वे आपके पाइथन मॉड्यूल के बाहर से आयात किए जाते हैं (उदाहरण के लिए एक जार या सी ++ फ़ाइल से आयात किया जाता है, जो कि पाइंस्टॉलर नहीं पढ़ेगा) महत्वपूर्ण निर्भरताओं को याद करना बहुत आसान है।

dependency walker लापता डीएलएल को व्यवस्थित रूप से ट्रैक करने के लिए रक्षा की आपकी पहली पंक्ति हो सकती है। बस इसे डाउनलोड करें और फिर अपने exe या संबद्ध dlls को लोड करें यह देखने के लिए कि कौन से लोग निर्भरताएं खो रहे हैं। फिर, यह सिर्फ एक जंगली हंस पीछा कर रहा है और उन्हें मैन्युअल रूप से .exe के साथ अपनी निर्देशिका में जोड़ रहा है (एक निर्देशिका में अपनी पैकेजिंग मानते हुए)।

# line 409 of Pyinstaller.loader.pyi_importers.py 
try: module = imp.load_module(fullname, fp, filename, self._c_ext_tuple) 
except Exception as e: 
    print fullname # at least tells you what module couldn't be imported 
    raise e 

फिर, जानते हुए भी जहां:

एक तरफ ध्यान दें के रूप में, pyinstaller 2.1 (अजगर 2.7.6) के लिए, मैं जब आयात करने में कम से कम कोशिश करते हैं और प्रिंट जो मॉड्यूल मुसीबत निर्माता था pyi_importers.py फ़ाइल को संशोधित समस्या आई, तो आप गायब डीएलएल को रूट करने के लिए निर्भरता वॉकर के साथ समस्या को इंगित कर सकते हैं।

+0

मेरे पास वही समस्या थी, धन्यवाद। –

+0

WinXP पर एक पीईडी मॉड्यूल (विशेष रूप से पैकी के लिए) को पुन: संकलित करने के लिए मेरी समस्या का निर्धारण किया गया था, और इसे मेरे विंडोज 7 पायथन इंस्टॉलेशन में कॉपी कर रहा था। अब मेरे पाइंस्टॉलर exe है कि मैं विंडोज 7 पर भी विंडोज़ XP और विंडोज 7 –

+0

पर काम करता हूं आप मेरी [समस्या] को हल करने में मदद कर सकते हैं (http://stackoverflow.com/questions/41073132/pyinstaller-app-is-accessing -txt-फ़ाइलें बल्कि नहीं-लेखन करने वाली उन-काम करता है पहले एपी)। – Phillip