I have an application that I package with pyinstaller to windows package. I wanted to use the filelock.py to secure file writes. That file comes as a single .py file instead of a packages and that requires apparently a slightly different approach to integrate in pyinstaller.
I have this structure in my datas list in the specfile:
...
datas=[...
('C:\\Users\\user\\anaconda3\\envs\\ms-mint\\lib\\site-packages\\pymzml', '.\\pymzml'),
('C:\\Users\\user\\anaconda3\\envs\\ms-mint\\lib\\site-packages\\filelock.py', '.\\filelock'),
...]
the first one is an example for a "normal" package. And the second is the not-working example for filelock.
I think the problem is that filelock does not follow a standard structure where the program is located in a subfolder /filelock/filelock.py instead only the file is installed when using pip pip install filelock.
If your script does "import filelock", then pyinstaller will go find the file and include in the package, just like it finds "import sys" and "import os". You don't have to tell it where to find it.