Minor Changes

- Improve startup debugging of python errors
- Fix issue with multiprocessing in newer python versions
This commit is contained in:
Andrew Senetar 2021-08-14 18:19:14 -05:00
parent c2ec4c3fe3
commit 8abf4de916
No known key found for this signature in database
GPG Key ID: FEB896EB6CF6254B
2 changed files with 10 additions and 3 deletions

View File

@ -6,6 +6,10 @@
import codecs, io, locale
# Force multiprocessing to use fork instead of spawn (as spawn currently causes issues)
import multiprocessing
multiprocessing.set_start_method('fork')
from hscommon.trans import install_gettext_trans_under_cocoa
install_gettext_trans_under_cocoa()
@ -16,4 +20,4 @@ from inter.app import PyDupeGuru
# When built under virtualenv, the dependency collector misses this module, so we have to force it
# to see the module.
import distutils.sysconfig
import distutils.sysconfig

View File

@ -25,14 +25,17 @@ int main(int argc, char *argv[])
Py_Initialize();
PyGILState_STATE gilState = PyGILState_Ensure();
FILE* fp = fopen([mainpy UTF8String], "r");
PyRun_SimpleFile(fp, [mainpy UTF8String]);
int result = PyRun_SimpleFile(fp, [mainpy UTF8String]);
if (result != 0) {
return result;
}
fclose(fp);
PyGILState_Release(gilState);
if (gilState == PyGILState_LOCKED) {
PyThreadState_Swap(NULL);
PyEval_ReleaseLock();
}
int result = NSApplicationMain(argc, (const char **) argv);
result = NSApplicationMain(argc, (const char **) argv);
Py_Finalize();
return result;
}