py2app: Can successfully create app with alias mode but version built for deployment returns an error message

Paul Fishback <[email protected]> Tue, 15 Jun 2021 17:37:27 -0400
Newsgroups gmane.comp.python.apple
Message-ID <CAPYR40LcS0NR8XKTa-Ca8uOaH7QvUhafekDvT8nCeu85UqWYog@mail.gmail.com>
--===============8410218299035305052==
Content-Type: multipart/alternative; boundary="0000000000006fac3905c4d4c87a"

--0000000000006fac3905c4d4c87a
Content-Type: text/plain; charset="UTF-8"

I'm using Python 3.9 on a Mac running Big Sur and am trying to create an
app, MyApplication.app, from a script using py2app. I'm following the
process outlined at https://py2app.readthedocs.io/en/latest/tutorial.html .
The app itself uses tkinter for creating a GUI. My setup file looks like
the following, where 'background.png' is an image that appears on the
screen at program startup, and 'pandas' and 'cmath' are included due to
previous error messages:

from setuptools import setup

APP = ['MyApplication_6_14.py']
DATA_FILES = []
OPTIONS = {'resources':['background.png'],'packages': ['pandas','cmath']}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

I can create and run the application in alias mode, and no error messages
arise when I build for deployment. However, when I attempt to run the
deployed version from the command line via,

./dist/MyApplication.app/Contents/MacOS/MyApplication

I receive a fairly lengthy error message below, where Python_May_2021 is
the file location:

fishbacp@fishbacpK0ML85 Python_May_2021 %
./dist/MyApplication_6_15.app/Contents/MacOS/MyApplication_6_15

Traceback (most recent call last):

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/__boot__.py",
line 115, in <module>

    _run()

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/__boot__.py",
line 84, in _run

    exec(compile(source, path, "exec"), globals(), globals())

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/MyApplication_6_15.py",
line 6, in <module>

    import pandas as pd

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pandas/__init__.py",
line 179, in <module>

    import pandas.testing

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pandas/testing.py",
line 5, in <module>

    from pandas._testing import (

  File
"/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pandas/_testing.py",
line 29, in <module>

    import pandas._libs.testing as _testing

  File "pandas/_libs/testing.pyx", line 1, in init pandas._libs.testing

ValueError: source code string cannot contain null bytes

I'm curious to know if anyone has insights regarding the last line in the
above message.

Thanks

PaulF
-- 
Professor of Mathematics, Grand Valley State University
Past-President, Pi Mu Epsilon National Honorary Mathematics Society, Inc.

Department of Mathematics (MAK C-2-408)
Grand Valley State University
1 Campus Dr.
Allendale, MI 49401
[email protected]
616.331.2040
616.331.3120 (fax)

--0000000000006fac3905c4d4c87a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"color:rgb(36,39,41);font-family:-apple-syst=
em,system-ui,&quot;Segoe UI&quot;,&quot;Liberation Sans&quot;,sans-serif;fo=
nt-size:15px">I&#39;m using Python 3.9 on a Mac running Big Sur and am tryi=
ng to create an app, MyApplication.app, from a script using py2app. I&#39;m=
 following the process outlined at=C2=A0</span><a href=3D"https://py2app.re=
adthedocs.io/en/latest/tutorial.html" rel=3D"nofollow noreferrer" style=3D"=
margin:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant=
-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-a=
pple-system,system-ui,&quot;Segoe UI&quot;,&quot;Liberation Sans&quot;,sans=
-serif;font-size:15px;vertical-align:baseline;box-sizing:inherit">https://p=
y2app.readthedocs.io/en/latest/tutorial.html</a><span style=3D"color:rgb(36=
,39,41);font-family:-apple-system,system-ui,&quot;Segoe UI&quot;,&quot;Libe=
ration Sans&quot;,sans-serif;font-size:15px">=C2=A0. The app itself uses tk=
inter for creating a GUI. My setup file looks like the following, where &#3=
9;background.png&#39; is an image that appears on the screen at program sta=
rtup, and &#39;pandas&#39; and &#39;cmath&#39; are included due to previous=
 error messages:</span><div><font color=3D"#242729" face=3D"-apple-system, =
system-ui, Segoe UI, Liberation Sans, sans-serif"><span style=3D"font-size:=
15px"><br></span></font></div><div><pre class=3D"gmail-lang-py gmail-s-code=
-block gmail-hljs gmail-python" style=3D"margin-top:0px;margin-bottom:0px;p=
adding:12px;border:0px;font-variant-numeric:inherit;font-variant-east-asian=
:inherit;font-stretch:inherit;line-height:1.30769;font-size:13px;vertical-a=
lign:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;=
border-radius:5px"><code style=3D"margin:0px;padding:0px;border:0px;font-st=
yle:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;l=
ine-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:i=
nherit;background-color:transparent;white-space:inherit"><span class=3D"gma=
il-hljs-keyword" style=3D"margin:0px;padding:0px;border:0px;font-style:inhe=
rit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-heig=
ht:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">=
from</span> setuptools <span class=3D"gmail-hljs-keyword" style=3D"margin:0=
px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weig=
ht:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;ver=
tical-align:baseline;box-sizing:inherit">import</span> setup

APP =3D [<span class=3D"gmail-hljs-string" style=3D"margin:0px;padding:0px;=
border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font=
-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:bas=
eline;box-sizing:inherit">&#39;MyApplication_6_14.py&#39;</span>]
DATA_FILES =3D []
OPTIONS =3D {<span class=3D"gmail-hljs-string" style=3D"margin:0px;padding:=
0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;=
font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align=
:baseline;box-sizing:inherit">&#39;resources&#39;</span>:[<span class=3D"gm=
ail-hljs-string" style=3D"margin:0px;padding:0px;border:0px;font-style:inhe=
rit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-heig=
ht:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit">=
&#39;background.png&#39;</span>],<span class=3D"gmail-hljs-string" style=3D=
"margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;=
font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:in=
herit;vertical-align:baseline;box-sizing:inherit">&#39;packages&#39;</span>=
: [<span class=3D"gmail-hljs-string" style=3D"margin:0px;padding:0px;border=
:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stret=
ch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;=
box-sizing:inherit">&#39;pandas&#39;</span>,<span class=3D"gmail-hljs-strin=
g" style=3D"margin:0px;padding:0px;border:0px;font-style:inherit;font-varia=
nt:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;fon=
t-family:inherit;vertical-align:baseline;box-sizing:inherit">&#39;cmath&#39=
;</span>]}

setup(
    app=3DAPP,
    data_files=3DDATA_FILES,
    options=3D{<span class=3D"gmail-hljs-string" style=3D"margin:0px;paddin=
g:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inheri=
t;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-ali=
gn:baseline;box-sizing:inherit">&#39;py2app&#39;</span>: OPTIONS},
    setup_requires=3D[<span class=3D"gmail-hljs-string" style=3D"margin:0px=
;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight=
:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;verti=
cal-align:baseline;box-sizing:inherit">&#39;py2app&#39;</span>],
)</code></pre><div><font color=3D"#242729" face=3D"-apple-system, system-ui=
, Segoe UI, Liberation Sans, sans-serif"><span style=3D"font-size:15px">I c=
an create and run the application in alias mode, and no error messages aris=
e when I build for deployment. However, when I attempt to run the deployed =
version from the command line via,</span></font></div><div><font color=3D"#=
242729" face=3D"-apple-system, system-ui, Segoe UI, Liberation Sans, sans-s=
erif"><span style=3D"font-size:15px"><br></span></font></div><div><div>./di=
st/MyApplication.app/Contents/MacOS/MyApplication</div></div><div><br></div=
><div>I receive a fairly lengthy error message below, where Python_May_2021=
 is the file location:</div><div><br></div><div>





<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000">fishbacp@fishbacpK0ML85 =
Python_May_2021 % ./dist/MyApplication_6_15.app/Contents/MacOS/MyApplicatio=
n_6_15</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000">Traceback (most recent c=
all last):</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/__boot__.py&quot;,=
 line 115, in &lt;module&gt;</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>_run()</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/__boot__.py&quot;,=
 line 84, in _run</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>exec(compile(source, path, &quot;e=
xec&quot;), globals(), globals())</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/MyApplication_6_15=
.py&quot;, line 6, in &lt;module&gt;</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>import pandas as pd</font></span><=
/p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pand=
as/__init__.py&quot;, line 179, in &lt;module&gt;</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>import pandas.testing</font></span=
></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pand=
as/testing.py&quot;, line 5, in &lt;module&gt;</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>from pandas._testing import (</fon=
t></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;/Users/fishbacp/Desktop/Python=
_May_2021/dist/MyApplication_6_15.app/Contents/Resources/lib/python3.9/pand=
as/_testing.py&quot;, line 29, in &lt;module&gt;</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 =C2=A0 </span>import pandas._libs.testing as _te=
sting</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000"><span class=3D"gmail-App=
le-converted-space">=C2=A0 </span>File &quot;pandas/_libs/testing.pyx&quot;=
, line 1, in init pandas._libs.testing</font></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:no=
rmal;font-family:Menlo"><span class=3D"gmail-s1" style=3D"font-variant-liga=
tures:no-common-ligatures"><font color=3D"#ff0000">ValueError: source code =
string cannot contain null bytes</font></span></p></div><div><font color=3D=
"#242729" face=3D"-apple-system, system-ui, Segoe UI, Liberation Sans, sans=
-serif"><span style=3D"font-size:15px"><br clear=3D"all"></span></font><div=
>I&#39;m curious to know if anyone has insights regarding the last line in =
the above message.</div><div><br></div><div>Thanks</div><div><br></div><div=
>PaulF</div>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-smartmai=
l=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=
=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr">=
<div><div dir=3D"ltr"><font face=3D"arial, sans-serif">Professor of Mathema=
tics, Grand Valley State University=C2=A0</font></div><div dir=3D"ltr"><fon=
t><font face=3D"arial, sans-serif">Past-President, Pi Mu Epsilon National H=
onorary Mathematics Society, Inc.</font><br></font><br><div style=3D"font-f=
amily:arial">Department of Mathematics (MAK C-2-408)</div><div style=3D"fon=
t-family:arial">Grand Valley State University</div><div style=3D"font-famil=
y:arial">1 Campus Dr.<br>Allendale, MI 49401<br><font color=3D"#0000ff"><a =
href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
.edu</a></font></div><div><font color=3D"#0000ff"><span style=3D"font-famil=
y:arial"><span title=3D"Call with Google Voice"><span title=3D"Call with Go=
ogle Voice"><span title=3D"Call with Google Voice">616.331.2040</span></spa=
n></span></span><br></font><span style=3D"font-family:arial"><font color=3D=
"#0000ff"><span title=3D"Call with Google Voice"><span title=3D"Call with G=
oogle Voice"><span title=3D"Call with Google Voice">616.331.3120</span></sp=
an></span> </font>(fax)</span><br></div></div></div></div></div></div></div=
></div></div></div></div></div></div></div></div></div></div></div>

--0000000000006fac3905c4d4c87a--

--===============8410218299035305052==
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

--===============8410218299035305052==--