0

I followed this post to hide the vast majority of the files in my PyInstaller compilation, going from 108 files/folders to just 6. But one of those 6 is the PIL folder, since you have to do a from-import on it to access Image, and I would love to hide that folder as well.

I've experimented with adding it to sys.path in my hook, changing my imports to from <foldernamehere>.PIL import Image, and setting os.chdir immediately before and after the import but nothing has worked. The error is always the same:

ImportError: cannot import name '_imaging' from 'PIL' (<pathtobasefolder>\PIL\__init__.pyc)

One important thing to note is that I do not import PIL immediately. It's only imported after launch when the user performs specific actions, since it serves no purpose otherwise. I'm not sure how much that affects things.

Is this possible? Maybe importlib can be used, or maybe editing PyInstaller's native hooks would work?

1 Answers1

-1

Use the following command : pip install -U Pillow

Ishaat171
  • 1
  • 1