Re: py2app: Can successfully create app with alias mode but version built for deployment returns an error message
[email protected] Thu, 17 Jun 2021 18:08:37 +0200
| Newsgroups | gmane.comp.python.apple |
|---|---|
| Message-ID | <[email protected]> |
--===============3790154624342649873== Content-Type: multipart/alternative; boundary="Apple-Mail=_1A7E361F-69A8-46C0-B577-6B53A90B99F4" --Apple-Mail=_1A7E361F-69A8-46C0-B577-6B53A90B99F4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 A quick guess: maybe pandas doesn=E2=80=99t like to be included into a = py2app application in this way? I think `.pyx` files are Cython sources, = and I think these need to be compiled on installation (which should have = happend during py2app?). When you google for =E2=80=9Cpandas py2app=E2=80=9D you=E2=80=99ll find = people reporting similar (but not identical) problems to what you = report. But note that some of the stuff google finds is very old, so use your = common sense, the world may have changed a lot since the link was = written. > On 15 Jun 2021, at 23:37, Paul Fishback <[email protected]> = wrote: >=20 > 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 = <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: >=20 > from setuptools import setup >=20 > APP =3D ['MyApplication_6_14.py'] > DATA_FILES =3D [] > OPTIONS =3D {'resources':['background.png'],'packages': = ['pandas','cmath']} >=20 > setup( > app=3DAPP, > data_files=3DDATA_FILES, > options=3D{'py2app': OPTIONS}, > setup_requires=3D['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, >=20 > ./dist/MyApplication.app/Contents/MacOS/MyApplication >=20 > I receive a fairly lengthy error message below, where Python_May_2021 = is the file location: >=20 > 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/Conte= nts/Resources/__boot__.py", line 115, in <module> > _run() > File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/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/Conte= nts/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/Conte= nts/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/Conte= nts/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/Conte= nts/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 >=20 > I'm curious to know if anyone has insights regarding the last line in = the above message. >=20 > Thanks >=20 > PaulF > --=20 > Professor of Mathematics, Grand Valley State University=20 > Past-President, Pi Mu Epsilon National Honorary Mathematics Society, = Inc. >=20 > Department of Mathematics (MAK C-2-408) > Grand Valley State University > 1 Campus Dr. > Allendale, MI 49401 > [email protected] <mailto:[email protected]> > 616.331.2040 > 616.331.3120 (fax) > _______________________________________________ > Pythonmac-SIG maillist - [email protected] > https://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG --Apple-Mail=_1A7E361F-69A8-46C0-B577-6B53A90B99F4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">A = quick guess: maybe pandas doesn=E2=80=99t like to be included into a = py2app application in this way? I think `.pyx` files are Cython sources, = and I think these need to be compiled on installation (which should have = happend during py2app?).<div class=3D""><br class=3D""></div><div = class=3D"">When you google for =E2=80=9Cpandas py2app=E2=80=9D you=E2=80=99= ll find people reporting similar (but not identical) problems to what = you report.</div><div class=3D""><br class=3D""></div><div class=3D"">But = note that some of the stuff google finds is very old, so use your common = sense, the world may have changed a lot since the link was = written.</div><div class=3D""><br class=3D""></div><div class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 15 Jun 2021, at 23:37, Paul Fishback <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" = class=3D""><span = style=3D"color:rgb(36,39,41);font-family:-apple-system,system-ui,"Seg= oe UI","Liberation Sans",sans-serif;font-size:15px" = class=3D"">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 </span><a = href=3D"https://py2app.readthedocs.io/en/latest/tutorial.html" = rel=3D"nofollow noreferrer" = style=3D"margin:0px;padding:0px;border:0px;font-variant-numeric:inherit;fo= nt-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;fon= t-family:-apple-system,system-ui,"Segoe UI","Liberation = Sans",sans-serif;font-size:15px;vertical-align:baseline;box-sizing:in= herit" = class=3D"">https://py2app.readthedocs.io/en/latest/tutorial.html</a><span = style=3D"color:rgb(36,39,41);font-family:-apple-system,system-ui,"Seg= oe UI","Liberation Sans",sans-serif;font-size:15px" = class=3D""> . 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:</span><div class=3D""><font = color=3D"#242729" face=3D"-apple-system, system-ui, Segoe UI, Liberation = Sans, sans-serif" class=3D""><span style=3D"font-size:15px" class=3D""><br= class=3D""></span></font></div><div class=3D""><pre = class=3D"gmail-lang-py gmail-s-code-block gmail-python gmail-hljs" = style=3D"margin-top:0px;margin-bottom:0px;padding:12px;border:0px;font-var= iant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;= line-height:1.30769;font-size:13px;vertical-align:baseline;box-sizing:inhe= rit;width:auto;max-height:600px;overflow:auto;border-radius:5px"><code = 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;background-colo= r:transparent;white-space:inherit" class=3D""><span = class=3D"gmail-hljs-keyword" = 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">from</span> = setuptools <span class=3D"gmail-hljs-keyword" = 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">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:baseline;box-sizing:inherit">'MyApplication= _6_14.py'</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">'resources'</s= pan>:[<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">'background.pn= g'</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:inherit;vertical-align:baseline;box-sizing:inherit">'packages'</sp= an>: [<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">'pandas'</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:inherit;vertical-align:baseline;box-sizing:inherit">'cmath'</span>= ]} setup( app=3DAPP, data_files=3DDATA_FILES, 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">'py2app'</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;vertical-align:baseline;box-sizing:inherit">'py2app'</span= >], )</code></pre><div class=3D""><font color=3D"#242729" = face=3D"-apple-system, system-ui, Segoe UI, Liberation Sans, sans-serif" = class=3D""><span style=3D"font-size:15px" class=3D"">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,</span></font></div><div = class=3D""><font color=3D"#242729" face=3D"-apple-system, system-ui, = Segoe UI, Liberation Sans, sans-serif" class=3D""><span = style=3D"font-size:15px" class=3D""><br = class=3D""></span></font></div><div class=3D""><div = class=3D"">./dist/MyApplication.app/Contents/MacOS/MyApplication</div></di= v><div class=3D""><br class=3D""></div><div class=3D"">I receive a = fairly lengthy error message below, where Python_May_2021 is the file = location:</div><div class=3D""><br class=3D""></div><div class=3D""><div = style=3D"margin: 0px; font-variant-numeric: normal; = font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo;" class=3D""><span = class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D"">fishbacp@fishbacpK0ML85 Python_May_2021 % = ./dist/MyApplication_6_15.app/Contents/MacOS/MyApplication_6_15</font></sp= an></div><div style=3D"margin: 0px; font-variant-numeric: normal; = font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo;" class=3D""><span = class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D"">Traceback (most recent call = last):</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/__boot__.py", line 115, in = <module></font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> = </span>_run()</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/__boot__.py", line 84, in _run</font></span></div><div = style=3D"margin: 0px; font-variant-numeric: normal; = font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo;" class=3D""><span = class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> = </span>exec(compile(source, path, "exec"), globals(), = globals())</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/MyApplication_6_15.py", line 6, in = <module></font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>import pandas = as pd</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/lib/python3.9/pandas/__init__.py", line 179, in = <module></font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>import = pandas.testing</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/lib/python3.9/pandas/testing.py", line 5, in = <module></font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>from = pandas._testing import (</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "/Users/fishbacp/Desktop/Python_May_2021/dist/MyApplication_6_15.app/Conte= nts/Resources/lib/python3.9/pandas/_testing.py", line 29, in = <module></font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>import = pandas._libs.testing as _testing</font></span></div><div style=3D"margin: = 0px; font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D""><span = class=3D"gmail-Apple-converted-space"> </span>File = "pandas/_libs/testing.pyx", line 1, in init = pandas._libs.testing</font></span></div><div style=3D"margin: 0px; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo;" class=3D""><span class=3D"gmail-s1" = style=3D"font-variant-ligatures:no-common-ligatures"><font = color=3D"#ff0000" class=3D"">ValueError: source code string cannot = contain null bytes</font></span></div></div><div class=3D""><font = color=3D"#242729" face=3D"-apple-system, system-ui, Segoe UI, Liberation = Sans, sans-serif" class=3D""><span style=3D"font-size:15px" class=3D""><br= clear=3D"all" class=3D""></span></font><div class=3D"">I'm curious to = know if anyone has insights regarding the last line in the above = message.</div><div class=3D""><br class=3D""></div><div = class=3D"">Thanks</div><div class=3D""><br class=3D""></div><div = class=3D"">PaulF</div>-- <br class=3D""><div dir=3D"ltr" = class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div = dir=3D"ltr" class=3D""><div class=3D""><div dir=3D"ltr" class=3D""><div = class=3D""><div dir=3D"ltr" class=3D""><div class=3D""><div dir=3D"ltr" = class=3D""><div class=3D""><div dir=3D"ltr" class=3D""><div = class=3D""><div dir=3D"ltr" class=3D""><div class=3D""><div dir=3D"ltr" = class=3D""><font face=3D"arial, sans-serif" class=3D"">Professor of = Mathematics, Grand Valley State University </font></div><div = dir=3D"ltr" class=3D""><font class=3D""><font face=3D"arial, sans-serif" = class=3D"">Past-President, Pi Mu Epsilon National Honorary Mathematics = Society, Inc.</font><br class=3D""></font><br class=3D""><div = style=3D"font-family:arial" class=3D"">Department of Mathematics (MAK = C-2-408)</div><div style=3D"font-family:arial" class=3D"">Grand Valley = State University</div><div style=3D"font-family:arial" class=3D"">1 = Campus Dr.<br class=3D"">Allendale, MI 49401<br class=3D""><font = color=3D"#0000ff" class=3D""><a href=3D"mailto:[email protected]" = target=3D"_blank" class=3D"">[email protected]</a></font></div><div = class=3D""><font color=3D"#0000ff" class=3D""><span = style=3D"font-family:arial" class=3D""><span title=3D"Call with Google = Voice" class=3D""><span title=3D"Call with Google Voice" class=3D""><span = title=3D"Call with Google Voice" = class=3D"">616.331.2040</span></span></span></span><br = class=3D""></font><span style=3D"font-family:arial" class=3D""><font = color=3D"#0000ff" class=3D""><span title=3D"Call with Google Voice" = class=3D""><span title=3D"Call with Google Voice" class=3D""><span = title=3D"Call with Google Voice" = class=3D"">616.331.3120</span></span></span> </font>(fax)</span><br = class=3D""></div></div></div></div></div></div></div></div></div></div></d= iv></div></div></div></div></div></div></div> _______________________________________________<br = class=3D"">Pythonmac-SIG maillist - <a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a><br class=3D""><a = href=3D"https://mail.python.org/mailman/listinfo/pythonmac-sig" = class=3D"">https://mail.python.org/mailman/listinfo/pythonmac-sig</a><br = class=3D"">unsubscribe: = https://mail.python.org/mailman/options/Pythonmac-SIG<br = class=3D""></div></blockquote></div><br class=3D""></div></body></html>= --Apple-Mail=_1A7E361F-69A8-46C0-B577-6B53A90B99F4-- --===============3790154624342649873== 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 --===============3790154624342649873==--