ctypes MemoryError when attempting to launch notarized app

Glyph <[email protected]> Sat, 27 Oct 2018 22:27:43 -0700
Newsgroups gmane.comp.python.apple,gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
--===============6552720424594490894==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_B72F980F-5AB8-44B7-A75F-91F80F4B45B5"


--Apple-Mail=_B72F980F-5AB8-44B7-A75F-91F80F4B45B5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

I adjusted my code-signing to use the new, stricter requirements imposed =
by app notarization.  I managed to get it successfully notarized, but =
the app is now non-functional as a result: at startup, I get:

Traceback (most recent call last):
  File "my.app/Contents/Resources/__boot__.py", line 93, in <module>
    _setup_ctypes()
  File "my.app/Contents/Resources/__boot__.py", line 86, in =
_setup_ctypes
    from ctypes.macholib import dyld
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in =
_find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in =
_load_backward_compatible
  File "ctypes/__init__.pyc", line 538, in <module>
  File "ctypes/__init__.pyc", line 273, in _reset_cache

(If anyone wants to follow along in the traceback, this is using =
python.org <http://python.org/> 3.6.6.)

This happens before any of my code even runs, so I can't just try to =
avoid ctypes.

Curiously, this is the same traceback that comes from =
https://forum.kodi.tv/showthread.php?tid=3D329171 =
<https://forum.kodi.tv/showthread.php?tid=3D329171>, which suggests it's =
something fundamental to strict shared-library sandboxing that ctypes =
trips over when trying to initialize itself.

Does anyone have experience with this, or ideas about what to do?

-glyph=

--Apple-Mail=_B72F980F-5AB8-44B7-A75F-91F80F4B45B5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">I =
adjusted my code-signing to use the new, stricter requirements imposed =
by app notarization. &nbsp;I managed to get it successfully notarized, =
but the app is now non-functional as a result: at startup, I get:<div =
class=3D""><br class=3D""></div><div class=3D""><div class=3D"">Traceback =
(most recent call last):</div><div class=3D"">&nbsp; File =
"my.app/Contents/Resources/__boot__.py", line 93, in =
&lt;module&gt;</div><div class=3D"">&nbsp; &nbsp; =
_setup_ctypes()</div><div class=3D"">&nbsp; File =
"my.app/Contents/Resources/__boot__.py", line 86, in =
_setup_ctypes</div><div class=3D"">&nbsp; &nbsp; from ctypes.macholib =
import dyld</div><div class=3D"">&nbsp; File "&lt;frozen =
importlib._bootstrap&gt;", line 971, in _find_and_load</div><div =
class=3D"">&nbsp; File "&lt;frozen importlib._bootstrap&gt;", line 955, =
in _find_and_load_unlocked</div><div class=3D"">&nbsp; File "&lt;frozen =
importlib._bootstrap&gt;", line 656, in _load_unlocked</div><div =
class=3D"">&nbsp; File "&lt;frozen importlib._bootstrap&gt;", line 626, =
in _load_backward_compatible</div><div class=3D"">&nbsp; File =
"ctypes/__init__.pyc", line 538, in &lt;module&gt;</div><div =
class=3D"">&nbsp; File "ctypes/__init__.pyc", line 273, in =
_reset_cache</div><div class=3D""><div class=3D""><br =
class=3D""></div><div class=3D"">(If anyone wants to follow along in the =
traceback, this is using <a href=3D"http://python.org" =
class=3D"">python.org</a>&nbsp;3.6.6.)</div><div class=3D""><br =
class=3D""></div><div class=3D"">This happens before any of my code even =
runs, so I can't just try to avoid ctypes.</div><div class=3D""><br =
class=3D""></div><div class=3D"">Curiously, this is the same traceback =
that comes from&nbsp;<a =
href=3D"https://forum.kodi.tv/showthread.php?tid=3D329171" =
class=3D"">https://forum.kodi.tv/showthread.php?tid=3D329171</a>, which =
suggests it's something fundamental to strict shared-library sandboxing =
that ctypes trips over when trying to initialize itself.</div><div =
class=3D""><br class=3D""></div><div class=3D"">Does anyone have =
experience with this, or ideas about what to do?</div><div class=3D""><br =
class=3D""></div><div class=3D"">-glyph</div></div></div></body></html>=

--Apple-Mail=_B72F980F-5AB8-44B7-A75F-91F80F4B45B5--

--===============6552720424594490894==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pythonmac-SIG maillist  -  [email protected]
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

--===============6552720424594490894==--