ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
342 stars 36 forks source link

Error generating setup.py on macOS when a directory name is specified as a resource #453

Closed alfwatt closed 2 years ago

alfwatt commented 2 years ago

Example Code: https://github.com/alfwatt/py2app-directory-resource

py2applet --make-setup TestDirectoryResource.py Directory
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/py2applet", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/py2app/script_py2applet.py", line 125, in main
    path = imp.find_module(os.path.basename(fn))[0]
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/imp.py", line 282, in find_module
    package_directory = os.path.join(entry, name)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not list
make: *** [setup.py] Error 1
alfwatt commented 2 years ago

Expected: Directory and all it's contents are included in the app bundle on MacOS:

TestDirectoryResrouce.app/Contents/Resources/Directory/README.md
alfwatt commented 2 years ago

Workaround: Include all subpaths in the argument list provided to py2applet

ronaldoussoren commented 2 years ago

Thanks for the clear report with a reproducer, that made it a lot easier to fix the problem.