wxPython not using Cocoa on Macintosh

I’m using MacOS 12.6.2, with either (native Python 3.9 and wxPython vip pip) or (Python 3.10.9 and wxPython 4.2.0 via homebrew). Each Python gives the same result:

I’m trying to work with the “new” Python3 version of CHIRP. I GIT clone the python from https://github.com/kk7ds/chirp.git, and select the py3 branch.

  • When I run from my well-lived-in user account, I always receive an error when running from MacOS Terminal:

    This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.

  • I can get this to work by starting a login terminal in XQuartz, which successfully launches the CHIRP GUI.

  • When I run from a brand-new default-loaded login, CHIRP runs as a MacOS native Cocoa application.

Obviously, I have at least two workarounds. But I’d like to understand better what is happening. Has anybody a clue as to what I might have done to make the wxPython CHIRP application fail in my normal environment but work in a default environment?

I was thinking that I’d bollixed something in my environment (here is today’s):

__CFBundleIdentifier=com.apple.Terminal
TMPDIR=/var/folders/b1/r259xfps7f1ct32yfbs29jn40000gn/T/
XPC_FLAGS=0x0
LaunchInstanceID=8610FD07-7A99-4AEC-8F8E-C36196E578BD
TERM=xterm-256color
DISPLAY=/private/tmp/com.apple.launchd.kiqPTsImwi/org.xquartz:0
SECURITYSESSIONID=18806
SSH_AUTH_SOCK=/Users/declan/.gnupg/S.gpg-agent.ssh
XPC_SERVICE_NAME=0
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=445
TERM_SESSION_ID=BC7ECC46-A952-45DA-9D48-B1344E85C604
SHELL=/bin/zsh
HOME=/Users/declan
LOGNAME=declan
USER=declan
PATH=/usr/local/opt/libxml2/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Library/Apple/usr/bin
SHLVL=1
PWD=/Users/declan/chirp
OLDPWD=/Users/declan
CLICOLOR=1
MANPATH=/usr/local/share/man:
LANG=en_US.UTF-8
_=/usr/bin/env