pyinstaller

Larry Martell larry.martell at gmail.com
Wed Jul 27 07:25:35 EDT 2016


On Wed, Jul 27, 2016 at 2:23 AM, Christian Gollwitzer <auriocus at gmx.de> wrote:
> Am 27.07.16 um 03:15 schrieb Larry Martell:
>>
>> On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown <nextstate at gmail.com> wrote:
>>>
>>> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs
>>> and see if I can help if you have not solved it already.
>>>
>>> What is the issue you are having?
>>
>>
>> If I import the requests module, then when I run the executable I get:
>>
>> ImportError: No module named 'requests.packages.chardet'
>
>
> That's a classic issue. pyinstaller does static analysis of the program,
> which modules must be included. If the code computes a module dynamically,
> it can not always succeed. The solution is to tell pyinstaller to add this
> module. In previous versions, you could add these by "pyinstaller
> --hidden-import=requests.packages.chardet" or similar. If this doesn't work,
> you need to edit the spec file. See here:
>
> https://pythonhosted.org/PyInstaller/when-things-go-wrong.html#listing-hidden-imports

Yes, I had seen that and I tried it with:

--hidden-import=requests.packages.chardet

and I got the same error at run time:

$ dist/pyi_test/pyi_test
Traceback (most recent call last):
File "pyi_test.py", line 1, in
import requests
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/init.py", line 58, in
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/utils.py", line 26, in
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/compat.py", line 7, in
File "requests/packages/init.py", line 95, in load_module
ImportError: No module named 'requests.packages.chardet'



More information about the Python-list mailing list