Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PyInstaller issues #927

Merged
merged 1 commit into from
Mar 19, 2019
Merged

Fix PyInstaller issues #927

merged 1 commit into from
Mar 19, 2019

Conversation

arossert
Copy link
Contributor

Following the discussion in #891, This PR is listing the modules directly from the filesystem.

According to this thread #1905, PyInstaller is not supporting the pkgutil.iter_modules so the dynamic module loading is not working.

I have added a code to list the modules directly from the source code that needs to be included in the bundle for this to work.
It is using a small PyInstaller hook to fetch the providers source files:

from PyInstaller.utils.hooks import collect_submodules, collect_data_files

hiddenimports = collect_submodules('faker.providers')
datas = (collect_data_files('text_unidecode') +
         collect_data_files('faker.providers', include_py_files=True))

If this PR will be approved, I will submit a PR in PyInstaller to include this hook.

It is not working for me using cx_freeze, I have no experience with it and I could not get it to work, always give me an exception:

ImportError: No module named providers

From a small test, it seems that pkgutil.iter_modules is working in cx_freeze but I still got this error (even when I try to explicitly include the module).

I think that it will be better to find a generic way for all the "code freezers" work but not sure that it is possible.

…sing pkgutil.iter_modules which is not suported
@fcurella
Copy link
Collaborator

Thank you @arossert

I wouldn't worry too much about cx_freeze. From what I see, your change should be fully backward compatible.

@fcurella fcurella merged commit eb7d9c8 into joke2k:master Mar 19, 2019
@arossert
Copy link
Contributor Author

arossert commented Mar 19, 2019

Thanks, do you know when the next version with this fix will be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants