NSInvalidArgumentException from launching experiment on Terminal

HI I have a problem with launching psychopy experiment program on Terminal. I’m using macOS Mojave and psychopy version is 1.90.3.

I followed the instruction manual described in http://psychopy.org/installation.html, especially the one with Anaconda as below.

conda create -n psypy3 python=3.5
conda activate psypy3
conda install numpy scipy matplotlib pandas pyopengl pillow lxml openpyxl xlrd configobj pyyaml gevent greenlet msgpack-python psutil pytables requests[security] cffi seaborn wxpython cython pyzmq pyserial
conda install -c conda-forge pyglet pysoundfile python-bidi moviepy pyosf
pip install zmq json-tricks pyparallel sounddevice pygame pysoundcard psychopy_ext psychopy

The problem happens whenever I add psychopy.gui.Dlg() element in my code. For example,

from psychopy import gui
G = gui.Dlg()

Running this code on Terminal (e.g., python test.py) throws an error message:

2018-11-04 00:21:22.984 python[95602:2374252] -[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7fa788710f80
2018-11-04 00:21:22.987 python[95602:2374252] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7fa788710f80'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff4390d43d __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x00007fff6f81a720 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff4398a255 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff438acad0 ___forwarding___ + 1486
	4   CoreFoundation                      0x00007fff438ac478 _CF_forwarding_prep_0 + 120
	5   libwx_osx_cocoau_core-3.0.0.4.0.dylib 0x0000001313f37b5e _ZN5wxApp9DoInitGuiEv + 478
	6   _core.cpython-35m-darwin.so         0x000000131385beae _ZN10sipwxPyApp9OnInitGuiEv + 110
	7   libwx_osx_cocoau_core-3.0.0.4.0.dylib 0x0000001313f875a2 _ZN5wxApp10InitializeERiPPw + 242
	8   libwx_baseu-3.0.0.4.0.dylib         0x000000131458ce53 _Z12wxEntryStartRiPPw + 179
	9   _core.cpython-35m-darwin.so         0x000000131385b456 _ZN7wxPyApp13_BootstrapAppEv + 518
	10  _core.cpython-35m-darwin.so         0x000000131385ff82 _ZL26meth_wxPyApp__BootstrapAppP7_objectS0_ + 114
	11  python                              0x000000010926c55e PyCFunction_Call + 62
	12  python                              0x0000000109333ec7 PyEval_EvalFrameEx + 18583
	13  python                              0x000000010932dfaf _PyEval_EvalCodeWithName + 335
	14  python                              0x00000001092396aa function_call + 106
	15  python                              0x00000001091f5b35 PyObject_Call + 69
	16  python                              0x0000000109218694 method_call + 148
	17  python                              0x00000001091f5b35 PyObject_Call + 69
	18  python                              0x0000000109292415 slot_tp_init + 117
	19  python                              0x0000000109296ac1 type_call + 209
	20  python                              0x00000001091f5b35 PyObject_Call + 69
	21  python                              0x000000010933416b PyEval_EvalFrameEx + 19259
	22  python                              0x0000000109333fb8 PyEval_EvalFrameEx + 18824
	23  python                              0x000000010932dfaf _PyEval_EvalCodeWithName + 335
	24  python                              0x00000001092396aa function_call + 106
	25  python                              0x00000001091f5b35 PyObject_Call + 69
	26  python                              0x0000000109218694 method_call + 148
	27  python                              0x00000001091f5b35 PyObject_Call + 69
	28  python                              0x0000000109292415 slot_tp_init + 117
	29  python                              0x0000000109296ac1 type_call + 209
	30  python                              0x00000001091f5b35 PyObject_Call + 69
	31  python                              0x000000010933416b PyEval_EvalFrameEx + 19259
	32  python                              0x000000010932dfaf _PyEval_EvalCodeWithName + 335
	33  python                              0x0000000109380758 PyRun_FileExFlags + 248
	34  python                              0x000000010937feee PyRun_SimpleFileExFlags + 382
	35  python                              0x00000001093a4d86 Py_Main + 3622
	36  python                              0x00000001091e6861 main + 497
	37  libdyld.dylib                       0x00007fff708e8085 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

Could you tell me what should I possibly check for this?