Am 27.03.2012 16:39, schrieb David Lai:
Hi,
the faq I read so many times and also the  manule too.

So we need to overhaul the text as it seams you did not get the key message. Thanks for this feedback.

There are different areas of typical problems which can occur when using PyInstaller. For fixing problems in your application, it is *critical* to understand this.

1. Some required modules, shared libs or data files are not frozen (packaged, bundled) into the resulting exec. This kind of problems are to be solved within the "freeze" phase by

     * using `hiddenimport` in the `.spec`-file. (this is new feature
       in current development branch)
     * collecting files or modules within the `.spec`-file
     * implementing a new hook (or fixing an existing one)
     * fixing a bug in PyInstaller

   To check if all your files are frozen, use `utils/Archiveviewer.py`.

2. You application can not import some module, list modules, find data files, etc. This kind of problems has to be solved within our application by:

 * adapting your application to be frozen (see the manual)
 * If generic parts of your application are effected (e.g. commonly
   used packages like Tkinter, GTK, QT), adding a runtime-hook will
   help others users

Prior to solving "Type 2" problems, yo need to ensure there are no "Type 1" problems. You first of all you need to find out which type of problem you are facing. See the FAQ for how to do this.

Please note: If your application is complex, there may be several "Type 1" and several "Type 2" problems.

Okay yo far?


Meanwhile you solved (some of) your "Type 1" problems by using explicitly import statements in your main entry code.
I post the sample code because it's my original code and it runs OK not using 
pyinstaller . Why

So this sample code id in your application? It can nor work, since all modules are packaged into the executable. So scanning the directory does not work.

A possible solution to your problem may be:

In your .spec file, collect all modules (some like as in your sample code), write the module names into a file and and this file to your frozen app (see the manual for "adding data files"). In addition all all these modules as `hiddenimport`. Thus you'll get all modules into the frozen app and you'll get a list of all available modules.

The in your application, if it is frozen (see the manual), read this data-file to get a list of all modules and import them.

but I faced another error like sqlite3 can not find.

I assume, this is yet another problem.

But I still not know how the import things work with py installer.
Paron? I don't understand this.

--
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de

Attachment: smime.p7s
Description: S/MIME Kryptografische Unterschrift

Reply via email to