1
+
# PyInstaller example
2
+
3
+
Table of contents:
4
+
* [Package app](#package-app)
5
+
* [When it succeeds](#when-it-succeeds)
6
+
* [Fatal error](#fatal-error)
7
+
* [Debug app](#debug-app)
8
+
* [More details](#more-details)
9
+
10
+
11
+
## Package app
12
+
13
+
This is an example of using [PyInstaller](http://www.pyinstaller.org/)
14
+
packager to build executable from one of CEF Python's examples
15
+
(wxpython.py). Only Windows platform is currently supported.
16
+
17
+
To install required packages type:
18
+
```
19
+
pip install --upgrade pyinstaller pycrypto
20
+
```
21
+
22
+
To package example type:
23
+
```
24
+
python pyinstaller.py
25
+
```
26
+
27
+
28
+
## When it succeeds
29
+
30
+
If packaging succeeds you should see "dist/cefapp/" directory open
31
+
in explorer on Windows. In there you will find "cefapp.exe" executable
32
+
that you can launch.
33
+
34
+

35
+
36
+
37
+
## Fatal error
38
+
39
+
If there is a "Fatal Error!" message box appearing when running app
40
+
then see the next section for how to debug app.
41
+
42
+

43
+
44
+
45
+
## Debug app
46
+
47
+
In case of a fatal error to debug app pass "--debug" flag when
48
+
packaging app:
49
+
50
+
```
51
+
python pyinstaller.py --debug
52
+
```
53
+
54
+
After packaging completes on Windows it will open a new CMD window
55
+
and run the cefapp.exe inside it. You should see detailed logs
56
+
in console like these:
57
+
58
+
```
59
+
[6708] PyInstaller Bootloader 3.x
60
+
[6708] LOADER: executable is \examples\pyinstaller\dist\cefapp\cefapp.exe
61
+
[6708] LOADER: homepath is \examples\pyinstaller\dist\cefapp
62
+
[6708] LOADER: _MEIPASS2 is NULL
63
+
[6708] LOADER: archivename is \examples\pyinstaller\dist\cefapp\cefapp.exe
64
+
[6708] LOADER: No need to extract files to run; setting extractionpath to homepath
65
+
[6708] LOADER: SetDllDirectory(\examples\pyinstaller\dist\cefapp)
66
+
[6708] LOADER: Already in the child - running user's code.
67
+
[6708] LOADER: Python library: \examples\pyinstaller\dist\cefapp\python27.dll
68
+
[6708] LOADER: Loaded functions from Python library.
69
+
[6708] LOADER: Manipulating environment (sys.path, sys.prefix)
70
+
[6708] LOADER: sys.prefix is C:\github\CEFPYT~2\examples\PYINST~1\dist\cefapp
71
+
[6708] LOADER: Setting runtime options
72
+
[6708] LOADER: Initializing python
73
+
[6708] LOADER: Overriding Python's sys.path
74
+
[6708] LOADER: Post-init sys.path is \examples\pyinstaller\dist\cefapp
75
+
[6708] LOADER: Setting sys.argv
76
+
[6708] LOADER: setting sys._MEIPASS
77
+
[6708] LOADER: importing modules from CArchive
78
+
[6708] LOADER: extracted pyimod00_crypto_key
79
+
[6708] LOADER: callfunction returned...
80
+
[6708] LOADER: extracted struct
81
+
[6708] LOADER: callfunction returned...
82
+
[6708] LOADER: extracted pyimod01_os_path
83
+
[6708] LOADER: callfunction returned...
84
+
[6708] LOADER: extracted pyimod02_archive
85
+
[6708] LOADER: callfunction returned...
86
+
[6708] LOADER: extracted pyimod03_importers
87
+
[6708] LOADER: callfunction returned...
88
+
[6708] LOADER: Installing PYZ archive with Python modules.
89
+
[6708] LOADER: PYZ archive: out00-PYZ.pyz
90
+
[6708] LOADER: Running pyiboot01_bootstrap.py
91
+
[6708] LOADER: Running wxpython.py
92
+
Traceback (most recent call last):
93
+
File "wxpython.py", line 11, in <module>
94
+
File "c:\python27\lib\site-packages\PyInstaller-3.3-py2.7.egg\
95
+
PyInstaller\loader\pyimod03_importers.py", line 396,
96
+
in load_module exec(bytecode, module.__dict__)
97
+
File "site-packages\cefpython3\__init__.py", line 50, in <module>
98
+
File "c:\python27\lib\site-packages\PyInstaller-3.3-py2.7.egg\
99
+
PyInstaller\loader\pyimod03_importers.py", line 687,
100
+
in load_module module = imp.load_module(fullname, fp, filename,
101
+
ext_tuple)
102
+
File "cefpython_py27.pyx", line 283, in init cefpython_py27
103
+
(cefpython_py27.cpp:110881)
104
+
ImportError: No module named json
105
+
[6708] Failed to execute script wxpython
106
+
[6708] LOADER: OK.
107
+
[6708] LOADER: Cleaning up Python interpreter.
108
+
```
109
+
110
+
111
+
## More details
112
+
113
+
The corresponding issue in the tracker is [Issue #135](https://github.com/cztomczak/cefpython/issues/135).
114
+
115
+
See also the [Build executable](https://github.com/cztomczak/cefpython/blob/master/docs/Tutorial.md#build-executable)
116
+
section in Tutorial.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4