pyinstaller

Vlastimil Brom vlastimil.brom at gmail.com
Wed Jul 27 09:12:46 EDT 2016


2016-07-27 3:15 GMT+02:00 Larry Martell <larry.martell at gmail.com>:
> 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'
>
> I tried to post to the pyinstaller group, but it said my post had to
> be approved by the moderator, and it apparently never was. I have no
> idea who the moderator is, so there was no one I could contact about
> that. I posted an issue to github
> (https://github.com/pyinstaller/pyinstaller/issues/2060) and some
> suggestions were made, but none fixed the problem. I am on RHEL 7.2
> with Python 2.7.5, and it's reproducible, just by having a 1 line
> script that has "import requests". Thanks for any help you could
> provide.
>
>
>
>
>>
>> On Jun 21, 2016 16:57, "Larry Martell" <larry.martell at gmail.com> wrote:
>>>
>>> Anyone here have any experience with pyinstaller? I am trying to use
>>> it, but I'm not having much success. I tried posting to the
>>> pyinstaller ML but it said my post had to be approved first, and that
>>> hasn't happened in a while. I'll post details if someone here thinks
>>> they can help.
>>> --

Hi,
is there a direct reference to that function in your code?

On win7, python 3.5, if I use just a trivial stub source file like:

import requests
print(requests.packages.chardet.detect(b"qwe"))

and freeze it with
_path_to_\Python3\Scripts\pyinstaller.exe _path_to_\test_chardet.py
--clean --noconfirm --onedir

the resulting executable works ok, (it prints {'encoding': 'ascii',
'confidence': 1.0} just like the source version).

However, I remember, that I had problems in the past with freezing
(sub)modules or (sub)packages, that were not actually used in the
source but should be made available for interactive usage on runtime
within the app. I believe, manually referencing such objects helped in
such cases, but I can't remember the details.

Otherwise, it may be some version or platform dependent issue, of course.

regards,
 vbr



More information about the Python-list mailing list