I maintain a project that has mp3 files, the structure is like this:
The xinqing.py is the main file.
My setup.py
file is written like this:
import setuptools
setuptools.setup(
name="xinqing",
version="0.0.10",
author="heihei",
author_email="heihei@hh.com",
description="A class describes a person.",
long_description="A class describes a person.",
long_description_content_type="text/markdown",
packages=setuptools.find_packages(include=["xinqing","xinqing/*"]),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>3',
include_package_data=True
)
And my MANIFEST.in
file is written like this:
recursive-include xinqing/ *.mp3 *.wav
I use the mp3 file in the main file in this way:
cur_file_path = os.path.abspath(__file__)
cur_file_folder = os.path.dirname(cur_file_path)
mp3_folder = cur_file_folder
mp3_file_path = os.path.join(mp3_folder, "typing_long.mp3")
p = multiprocessing.Process(target=playsound, args=(mp3_file_path,))
# I also tried to use vlc, but they all reported files not found error when I published them to pypi
# sound = vlc.MediaPlayer(os.path.join(mp3_folder,'typing_long.mp3'))
When I published them to PyPI, and installed them using pip install xinqing
, and write code
from xinqing import Xinqing
xq=Xinqing()
xq.do_what()
Then will report the files not found error.
The commands that I published them to PyPI are
python setup.py bdist_wheel
twine upload dist/*
I think the reason is that I do not handle the mp3 source files correctly.
So how to resolve this problem?