Есть простенький таймер, который воспроизводит звук с помощью Piglet. Какую библиотеку стоит использовать чтобы не приходилось указывать путь до файла в самом коде или как вшить mp3 в .exe? Компилирую с помощью pyinstaller. Win 10, пайтон последней версии,
Package Version
-------------- ----------
altgraph 0.17
certifi 2020.4.5.1
chardet 3.0.4
colorama 0.4.3
future 0.18.2
geojson 2.5.0
idna 2.9
pefile 2019.4.18
pip 19.2.3
pyglet 1.5.5
PyInstaller 3.6
pyowm 2.10.0
python-vlc 3.0.9113
pywin32-ctypes 0.2.0
requests 2.23.0
setuptools 41.2.0
-------------- ----------
altgraph 0.17
certifi 2020.4.5.1
chardet 3.0.4
colorama 0.4.3
future 0.18.2
geojson 2.5.0
idna 2.9
pefile 2019.4.18
pip 19.2.3
pyglet 1.5.5
PyInstaller 3.6
pyowm 2.10.0
python-vlc 3.0.9113
pywin32-ctypes 0.2.0
requests 2.23.0
setuptools 41.2.0
Python:
while True:
try:
import time
from colorama import Fore, Back, Style
from colorama import init
import pyglet
song = pyglet.media.load('C:/Users/Public/Music/bud.mp3')
init()
print ('О чем вам напомнить?')
text = input()
print ('Через сколько?(в мин, с, ч)')
timer = (input())
check = timer.replace('с',' с').replace('мин', ' мин').replace('ч', ' ч').replace('c', ' с').split()
num = float(check[0])
draft = check[1]
if draft == 'ч':
time2 = num*3600
elif draft == 'мин':
time2 = num*60
elif draft == 'с':
time2 = num
time2 = int(time2)
while time2 > 0:
print ( Fore.WHITE+Back.BLACK+'Осталось '+str(time2)+'с')
time2 -= 1
time.sleep(1)
print (text)
song.play()
input ()
break
except:
print(Fore.WHITE+Back.RED+'Ошибка!'+Fore.BLACK+Back.WHITE+'')
continue