Problem work exe after convert from py

i have a problem with this code
it is working good in pycharm but cannot convert it to exe
when i convert it not open or have a problem
can you help me please
this is my code
import openpyxl
from barcode import Code128
from barcode.writer import ImageWriter
from PIL import Image, ImageDraw, ImageFont
from arabic_reshaper import arabic_reshaper
from bidi.algorithm import get_display
import textwrap
import subprocess
import win32print
import os

Determine the main file path

main_file_path = os.path.join(os.path.expanduser(“~”), “PycharmProjects”, “BarCode”, “testbarcode1.xlsx”)

while True:
# Receive data from the user
data = input(" S c a n : ")
if data.lower() == “exit”:
print(“Exiting program…”)

    number = int(input(" Quantity : "))
except ValueError:
    print("Invalid input. Please try again.")

# Read the main file
main_workbook = openpyxl.load_workbook(main_file_path)
main_sheet =

# Search for the data in the main file and copy it to the print file
found = False
for row in main_sheet.iter_rows(values_only=True):
    if str(data) in map(str, row):
        found = True

        # Create a barcode for the data
        barcode_value = data
        barcode = Code128(barcode_value, writer=ImageWriter())

        # Save the barcode as an image
        barcode_file_path = os.path.join(os.path.expanduser("~"), "PycharmProjects", "BarCode", f"barcode_{barcode_value}.png")

        # Create the barcode image
        barcode_image = barcode.render()
        barcode_image = barcode_image.resize((200, 100))

        # Create an image containing the numerical value
        font = ImageFont.truetype('arial.ttf', size=50)
        data_image ='RGB', (500, 50), color='white')
        data_image_draw = ImageDraw.Draw(data_image)
        data_image_draw.text((50, 1), str(number), fill='black', font=font, align="center")

        # Add the value of column B
        font_b = ImageFont.truetype('arial.ttf', size=14)
        column_b_text = f"{row[1]}"
        reshaped_text = arabic_reshaper.reshape(column_b_text)
        bidi_text = get_display(reshaped_text)
        max_width = 40  # Set the maximum width of each line
        wrapped_text = textwrap.wrap(bidi_text, width=max_width)
        column_b_text = '\n'.join(wrapped_text)

        column_b_image ='RGB', (200, 50), color='white')
        column_b_image_draw = ImageDraw.Draw(column_b_image)
        column_b_image_draw.text((0, 0), column_b_text, fill='black', font=font_b, align="center")

        # Desired size of the final image
        desired_width = 500
        desired_height = 400

        # Create the composite image
        merged_image ='RGB', (200, barcode_image.height + data_image.height + column_b_image.height))
        merged_image.paste(barcode_image, (0, 0))
        merged_image.paste(data_image, (0, barcode_image.height))
        merged_image.paste(column_b_image, (0, barcode_image.height + data_image.height))

        # Resize the final image
        merged_image = merged_image.resize((desired_width, desired_height), resample=Image.LANCZOS)

        # Save the final image
        final_image_path = os.path.join(os.path.expanduser("~"), "PycharmProjects", "BarCode", f"final_image_{data}.png")

        # Get the default printer name
        default_printer = win32print.GetDefaultPrinter()

        # Print the final composite image on the default printer['mspaint', '/p', final_image_path, default_printer])

        break  # Exit the loop after finding the data

# Check if the data is not found
if not found:
    print("Data not found in the main file.")

i have this problem in CMD
PS C:\Users\Administrator\PycharmProjects\test> python ./
S c a n : 112733
Quantity : 52
(‘112733’, ‘Ahmed Salah Sadek 192.16852.014.522146.55d Ahmed’)
Traceback (most recent call last):
File “C:\Users\Administrator\PycharmProjects\test\”, line 46, in
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\barcode\”, line 65, in save
output = self.render(options)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\barcode\”, line 257, in render
return Barcode.render(self, options, text)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\barcode\”, line 105, in render
raw = self.writer.render(code)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\barcode\”, line 227, in render
self._callbacks[“paint_text”](xpos, ypos)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\barcode\”, line 374, in _paint_text
width, height = font.getsize(subtext)
AttributeError: ‘FreeTypeFont’ object has no attribute ‘getsize’
PS C:\Users\Administrator\PycharmProjects\test>

Help us help you. Read this first and learn how to format code so we can help you. About the Python Help category