This issue bother me for almost 2 weeks.
[sample code]
g = globals()
modules = []
for strPath, lstDirs, lstFiles in os.walk(controllers_dir):
if lstFiles == []:
continue
modules.extend([(f[:-3], os.path.join(strPath, f)) for f in lstFiles if f.endswith('.py')])
for (name, file) in modules:
if name not in g:
import_module(name, file)
def import_module(name, file):
m = load_source(name, file)
g[name] = m
File "/opt/buildengr/build/pyi.linux2/application/out01-PYZ.pyz/web.db", line 1007, in import_driver ImportError: Unable to import sqlite3 or pysqlite2.dbapi2 or sqlite
so the issue is so weird now, if i used release version, running executable is OK but can not import some modules and find_module; if i used development version, running executable throws exception but can import modules, still can't fine_module.
-- 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
Hi, the faq I read so many times and also the manule too.
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:To check if all your files are frozen, use `utils/Archiveviewer.py`.
- 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
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?
I post the sample code because it's my original code and it runs OK not using pyinstaller . Why
but I faced another error like sqlite3 can not find.
But I still not know how the import things work with py installer.