0

I wrote python script which include tkinter, sqllite3, matplotlib and other libraries. When I bundle the script to exe file by using pyinstaller, it's finished successfully but when I run the exe file it's giving me this error: the error I get

Need to mention that I don't use any library name babel. I also add my code to the application below:


# Core PackAages
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.scrolledtext import *
import tkinter.filedialog
from tkcalendar import Calendar, DateEntry
from tkinter import messagebox
from tkintertable import TableCanvas, TableModel
from tkinter import ttk
import matplotlib.pyplot as plt
from fpdf import FPDF

#background


# Database
import sqlite3
import csv


4
  • Please add your code, command you use and error message as text, do not use images.
    – Ruli
    Commented Jan 18, 2021 at 15:30
  • I have done it :) Commented Jan 18, 2021 at 16:12
  • You say your code doesn't import babel, but it imports tkcalendar and it appears that tkcalendar imports babel. Look in the pyinstaller docs for advice on what to do about hidden imports. pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html
    – BoarGules
    Commented Jan 18, 2021 at 16:16
  • Please do not vandalize your post by removing the code, it is relevant to the question and helpful for people who might come to your post in the future with similar problem. Check out the licence, you agree with sharing your code when posting.
    – Ruli
    Commented Jan 18, 2021 at 16:34

2 Answers 2

2

You seem to have similar problem as here. The solution is simple, add hidden import:

pyinstaller.exe --hidden-import babel.numbers script.py
0
1

Add following code to your python script, while bundling with pyinstaller

import babel.numbers

Not the answer you're looking for? Browse other questions tagged or ask your own question.