Andrey1994 / screen_recorder_sdk

Library to take screenshots and record videos
https://screen-recorder-sdk.readthedocs.io/en/latest/
MIT License
45 stars 15 forks source link

Doesn't get detected during a binary built [PyInstaller] #16

Closed hash3liZer closed 2 years ago

hash3liZer commented 2 years ago

HI, first of really great for pulling this off. Its really helpful to me. I've just found an issue using the library when doing the final compile in a program. The library doesn't get detected by PyInstaller or other compilation tools. The imports do get detected and works fine, however the ScreenRecorder.dll file doesn't get detected and is not placed in the compiled directory. I tried the following commands:

$ pyinstaller file.py
$ pyinstaller --hidden-import screen_recorder_sdk file.py

At the end, i'd to go to the directory where the library is installed and manually copy the whole and place in compilation directory.

Andrey1994 commented 2 years ago

yes, pyinstaller does smth strange in terms of collection package_data and binary files, you need to write smth in spec file in order to achieve it.

I managed to do it here https://github.com/Andrey1994/game_inspector but more likely submodule is not the best solution and in spec file I wrote smth like this https://github.com/Andrey1994/game_inspector/blob/master/game_inspector.spec#L9

Maybe I had to make some other changes but don't remember them now

hash3liZer commented 2 years ago

@Andrey1994 Ok, i just did something, i dunno how but it worked. Since, just binaries are not being detected, i added this option: --collect-binaries screen_recorder_sdk into my pyinstaller command. And it worked. Might wanna add it to documentation.