0

I made an Alarm clock with tkinter, that i want to convert to an exe file. What i would like to know is how will pyinstaller deal with the paths to the sound files in my main program if i give this file to someone else that doesn't have my directories and subdirectories so that tkinter can find the mp3 files. thanks.

For example, the code below, calls the media player VLC to play my sound files which are placed in the path shown. IF pyinstaller, packs that, that code will not be changed, i don't think. Will it? So if my friend tries to test the alarm, he will get an error, because he has no directory named Godzilla on his computer.

Is there something i can do about this?

def sound():                    
    global clicked
    try:
        subprocess.call(["cvlc", "/home/godzilla/Desktop/Python/Tkinter/Sounds/" + clicked.get()+'.mp3'],timeout=10)
    except:
        return
stovfl
  • 14,998
  • 7
  • 24
  • 51
Lucy Lu
  • 41
  • 8
  • Possible duplicate of [Determining application path in a Python EXE generated by pyInstaller](https://stackoverflow.com/questions/404744/determining-application-path-in-a-python-exe-generated-by-pyinstaller) – stovfl Sep 20 '19 at 19:05
  • Well i read that, and i dont understand it, it looks too advanced. These possible duplicate flags, are not always helpful. I would appreciate some feedback with my code....in simple english not in python terminology.. – Lucy Lu Sep 20 '19 at 19:34
  • Feel free, not to agree that it truly is a duplicate, [edit] your Question to highlight the differences. Read [Why are some questions marked as duplicate?](https://stackoverflow.com/help/duplicates) – stovfl Sep 20 '19 at 19:37
  • Read also [pyinstaller.readthedocs - runtime-information - l#using-file](https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#using-file) – stovfl Sep 20 '19 at 19:42
  • It might be a duplicate, but i dont understand what they are talking about. therefore, it does not help me. ..All i want is the code to replace the above path line in my code, so i can understand what is happening. Perhaps since you understand pyinstaller (since you said it is a duplicate), you care to help ? – Lucy Lu Sep 20 '19 at 19:43
  • Simple copy the accepted answer and do `print(config_path)` and **see** what you get. You have also to understand [pyinstaller.readthedocs - adding-data-files](https://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-data-files) – stovfl Sep 20 '19 at 19:50

0 Answers0