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

Paul Fishback fishbacp at mail.gvsu.edu
Tue Jun 15 17:37:27 EDT 2021


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.
Allendale, MI 49401
fishbacp at mail.gvsu.edu
616.331.2040
616.331.3120 (fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pythonmac-sig/attachments/20210615/40077ae7/attachment.html>


More information about the Pythonmac-SIG mailing list