KivyMD: OSError: File .....\kivymd\fonts/Roboto-Regular.ttf not found

Hello, I created a package for windows with pyinstaller (pyinstaller --onefile myscript.py). After that, when I try to open the .exe file within dist directory, I get that error

OSError: File C:\Users\HP\AppData\Local\Temp\_MEI131442\kivymd\fonts/Roboto-Regular.ttf not found

The app doesn’t startup. It immediately crash. I also tried to create the package from example scripts. No luck, get the same error whenever I try to open .exe

Is there any fix? Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I’ve fixed the issue. If anyone facing the same problem in windows, open kivymd/init.py and modify the lines as @HeaTTheatR suggested. Now if you want to use pyinstaller to pack the app, just add the kivymd folder with your script. You can use this tool auto-py-to-exe (pip install auto-py-to-exe) which have GUI of pyinstaller that will help to ease the task.

Thanks everyone.

And for anyone who doesn’t want to have the kivymd directory copied into every build and are having trouble with it check this out .

@k4mrul Try replacing strings:

with

fonts_path = os.path.join(path, 'fonts/')
images_path = os.path.join(path, 'images/')

to

fonts_path = os.path.join(path, f'fonts{os.sep}')
images_path = os.path.join(path, f'images{os.sep}')

in kivymd/font_definitions.py module.