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

jack.jansen at cwi.nl jack.jansen at cwi.nl
Thu Jun 17 12:08:37 EDT 2021


A quick guess: maybe pandas doesn’t 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 “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 <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.
> Allendale, MI 49401
> fishbacp at mail.gvsu.edu <mailto: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pythonmac-sig/attachments/20210617/a37c7c8c/attachment.html>


More information about the Pythonmac-SIG mailing list