How to convert kivymd file to .exe file in windows??

845 views
Skip to first unread message

RicRam

unread,
Jul 11, 2021, 8:14:28 AM7/11/21
to Kivy users support
While converting i am getting the error "Failed to execute script main" .
Can anyone please help me out??
I need to submit the application as a project in my college tomorrow, please make the required changes in the code!!

I am submitting my files and dependencies below !!
main.py
ram.py

Elliot Garbus

unread,
Jul 11, 2021, 12:09:21 PM7/11/21
to kivy-...@googlegroups.com

Look at the kivy log file. It will be in the directory: C:\Users\YourUserName\.kivy\logs

It will often provide a hint to what is wrong.

 

Here is the spec file I use for creating apps.  I create a directory at the same level as the source code under a project, call ProjectDist.  I mention this because I use relative paths to identify files.

 

This will build a ‘one folder bundle’  I package the exe and the directory using https://jrsoftware.org/isinfo.php  This creates a professional looking installer that also generates an uninstaller in Windows.

 

# -*- mode: python -*-


import os
from kivy_deps import sdl2, glew

spec_root = os.path.abspath(SPECPATH)
block_cipher =
None
app_name = 'Your App Name'
win_icon = '../Images/your_icon.ico'

a = Analysis(['../main.py'],
            
pathex=[spec_root],
            
binaries=[],
            
datas=[('../*.kv', '.'),                   # Change these to match your project
                    (
'../Images/*.png', './Images')],
            
hiddenimports=['win32timezone'],
            
hookspath=[],
            
runtime_hooks=[],
            
excludes=[],
            
win_no_prefer_redirects=False,
            
win_private_assemblies=False,
            
cipher=block_cipher,
            
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
            
cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
         
exclude_binaries=True,
         
name=app_name,
         
debug=False,
         
bootloader_ignore_signals=False,
         
strip=False,
         
upx=False,
         
console=False,
         
icon=win_icon)
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p)
for p in (sdl2.dep_bins + glew.dep_bins)],
              
strip=False,
              
upx=False,
              
name=app_name)

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/fef7f1d7-30b6-4d4d-80bd-00e36996e967n%40googlegroups.com.

 

RicRam

unread,
Jul 11, 2021, 1:14:08 PM7/11/21
to Kivy users support
Hey, I checked the logs and found out the error showing "C:\Users\ramkr\AppData\Local\Programs\Python\Python39\Scripts\output\main\kivymd\fonts\Roboto-Regular.ttf not found"

What should I do Elliot?
Could you please help....if you remember this code is also edited by you and I am very thankful to you for your help but maybe for the last time can you please create an executable file with my code? I have a presentation in my college and as a beginner I am really struggling!!

Elliot Garbus

unread,
Jul 11, 2021, 3:22:41 PM7/11/21
to kivy-...@googlegroups.com

Compare your spec file to the file I sent.  If you still have trouble share your spec file.

Check is the font file in the location where the logs say it is missing.  If it is not, try to reinstall  kivymd or serach your disk for that font file and put ca copy in that loacation.

 

Are you using a venv and described in the kivy install documentation?  I not, I recommend using a venv.

RicRam

unread,
Jul 12, 2021, 3:35:34 AM7/12/21
to Kivy users support
Yes you are right , Elliot I am using "venv".
So, what should I install?
What command to use?

Elliot Garbus

unread,
Jul 12, 2021, 9:33:59 AM7/12/21
to kivy-...@googlegroups.com
Share your spec file, and your log file. 
Make sure pyinstaller was installed into your venv. 
Make sure you run pyinstaller from your activated venv. 

Sent from my iPad

On Jul 12, 2021, at 12:35 AM, RicRam <ramkrushna...@gmail.com> wrote:

Yes you are right , Elliot I am using "venv".
Reply all
Reply to author
Forward
0 new messages