Re-spawning with frozen applications
See original GitHub issueThe changes to the re-spawning code work great for calling scripts, but have some side-effects when CherryPy get’s frozen into an .exe
where it calls the .exe
as if it’s the python interpreter using the parameters it was frozen with.
For example:
2016-11-29 22:08:08,905::INFO::[_cplogging:219] [29/Nov/2016:22:08:08] ENGINE Re-spawning C:\Users\xxx\Documents\GitHub\SABnzbd-1.2.x2-win32-bin\SABnzbd-1.2.x2\SABnzbd-console.exe -E -OO -S C:\Users\xxx\Documents\GitHub\SABnzbd-1.2.x2-win32-bin\SABnzbd-1.2.x2\SABnzbd-console.exe
Our current release uses CherryPy 6.0.2 which only included sys.argv
.
Simple solution: check if it’s a frozen app and then don’t include the interpreter flags.
try:
args = self._get_true_argv()
except NotImplementedError:
"""It's probably win32"""
if getattr(sys, 'frozen', False):
args = [sys.executable] + sys.argv
else:
args = [sys.executable] + _args_from_interpreter_flags() + sys.argv
I currently can’t check how this would work on macOS when it gets frozen into an App. Since macOS does have the self._get_true_argv()
I am not sure what will happen but I imagine a similar thing.
- AFAIK these tools like py2exe never worked really well
They actually work quite well, we have 100.000+ happy users on Windows/macOS that don’t have to bother with command line things and get our app with CherryPy setup with just a few clicks 😊
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (14 by maintainers)
Top GitHub Comments
@Safihre thanks for the investigation and the link you provided. I’ll look into this later, meanwhile feel free to submit a PR. If this fix is all we need I’d move it to the beginning of
_args_from_interpreter_flags()
:On the other hand, we need to check whether there’s an option/need of surviving command line args. Also I’ll need your help with testing this against other OSes. TIA.
@Safihre I’m marking this as closed, feel free to re-open this issue or file a new one if needed.