mirror of
https://github.com/arsenetar/dupeguru-cocoa.git
synced 2025-05-08 01:39:51 +00:00
Minor Changes
- Improve startup debugging of python errors - Fix issue with multiprocessing in newer python versions
This commit is contained in:
parent
c2ec4c3fe3
commit
8abf4de916
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
import codecs, io, locale
|
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
|
from hscommon.trans import install_gettext_trans_under_cocoa
|
||||||
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
|
# When built under virtualenv, the dependency collector misses this module, so we have to force it
|
||||||
# to see the module.
|
# to see the module.
|
||||||
import distutils.sysconfig
|
import distutils.sysconfig
|
||||||
|
@ -25,14 +25,17 @@ int main(int argc, char *argv[])
|
|||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
PyGILState_STATE gilState = PyGILState_Ensure();
|
PyGILState_STATE gilState = PyGILState_Ensure();
|
||||||
FILE* fp = fopen([mainpy UTF8String], "r");
|
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);
|
fclose(fp);
|
||||||
PyGILState_Release(gilState);
|
PyGILState_Release(gilState);
|
||||||
if (gilState == PyGILState_LOCKED) {
|
if (gilState == PyGILState_LOCKED) {
|
||||||
PyThreadState_Swap(NULL);
|
PyThreadState_Swap(NULL);
|
||||||
PyEval_ReleaseLock();
|
PyEval_ReleaseLock();
|
||||||
}
|
}
|
||||||
int result = NSApplicationMain(argc, (const char **) argv);
|
result = NSApplicationMain(argc, (const char **) argv);
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user