Open ceejayc7 opened 9 years ago
With a bit of further digging, it seems that py2exe isn't compiling the plugins inside of livestreamer/plugins/* which would most likely be why this error is occuring.
With that in mind, how would i force py2exe to compile all of the plugins available to livestreamer?
Nightly builds are available too. Or is there any other reason, why you are trying to compile it from source?
I'm actually creating a separate project that lists a bunch of streams which are live using the livestreamer.streams call across various streaming websites. My test.py script was just a way to pinpoint the py2exe problem that I was having.
I did figure out a way to force py2exe to compile the various plugins by using the following inside my setup.py
setup(console=[{"script":"test.py"}],options={"py2exe":{"includes":["livestreamer.plugins.*"]}})
After running py2exe and running the executable, I'm getting this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
File "livestreamer\api.pyc", line 11, in streams
File "livestreamer\session.pyc", line 65, in __init__
File "livestreamer\session.pyc", line 363, in load_builtin_plugins
File "livestreamer\session.pyc", line 373, in load_plugins
ImportError: No module named afreeca
Same ImportError as ceejayc7 using cx_Freeze with python3.
I've managed to find a workaround/possible fix.
The reason livestreamer runs into livestreamer.exceptions.NoPluginError
is because py2exe bundles all packages in a zip file, Library.zip, thus livestreamer cannot access its modules correctly.
The reason it can't find afreeca
is because it is the very first module/site plug-in aka can't load any of the site plug-ins.
Here's my setup.py
.
setup(script_args
= ['py2exe'], console = [{
'script': 'script.py'
}], options = {
'py2exe': {
"compressed": 0,
"skip_archive": True,
'optimize': 0,
"packages": ["livestreamer", "livestreamer_cli"],
"includes": ["livestreamer", "livestreamer.plugin", "livestreamer.plugins.*"]
}
})`
("packages"
and "includes"
might not be needed)
"compressed": 0
forces py2exe to not compress the zip file.
"skip_archive"
skips creation of the zip file altogether.
This allowed livestreamer to work. However, I now have second issue, I cannot get a window/GUI generated by opencv (cv2) to work by launching a py2exe-generated exe. Might just be a bug in my own code or with opencv, although it might be worth mentioning.
Thanks for replying after so much time, i am myself using pyinstaller and/or cx_freeze so i'll try your method in the following days/weeks and i'll let you know. =)
Making a simple script and trying to create an executable out of it.
test.py
setup.py
From cmdline:
No errors occur, executable is generated, but the following error happens when running test.exe