[Pythonmac-SIG] py2app: Can successfully create app with alias mode but version built for deployment returns an error message

Christopher Barker pythonchb at gmail.com
Thu Jun 17 15:35:12 EDT 2021


On Thu, Jun 17, 2021 at 9:24 AM <jack.jansen at cwi.nl> wrote:

> I think `.pyx` files are Cython sources,
>

Yes, they are. But Cython is designed to show the source line number when
there are errors. So this has been compiled.

That error is vaguely familiar to me, I got it recently— I think the fix
was to clean out and recompile the Cython files.

However, if Pandas is working outside py2app, then it did get built
properly.

I’d look at the app bundle and see what’s different from the regular
install.

Ideally, it would copy only the complied modules.

-CHB


and I think these need to be compiled on installation (which should have
> happend during py2app?).
>
> When you google for “pandas py2app” you’ll 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 <fishbacp at mail.gvsu.edu> wrote:
>
> 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 at 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.
> <https://www.google.com/maps/search/1+Campus+Dr.+Allendale,+MI+49401?entry=gmail&source=g>
> Allendale, MI 49401
> <https://www.google.com/maps/search/1+Campus+Dr.+Allendale,+MI+49401?entry=gmail&source=g>
> fishbacp at mail.gvsu.edu
> 616.331.2040
> 616.331.3120 (fax)
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG
>
-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pythonmac-sig/attachments/20210617/60a0eb9f/attachment-0001.html>


More information about the Pythonmac-SIG mailing list