I made a bot that does some stuff with image processing and gives me values but I can't convert .py to .exe for running every windows. I am using these libraries.
import tkinter as tk
import time
import threading
import pywinauto
from PIL import Image, ImageGrab
import cv2
import pytesseract
Also my codes using a specific path like this
def takeSnapShot(sFileName):
try:
imagee = ImageGrab.grab()
name = sFileName + ".jpg"
imagee.save(name, 'JPEG', quality=2880)
except:
print("Error!")
def sayioku():
takeSnapShot(r"D:\klasor\gelen")
img = cv2.imread(r"D:\klasor\gelen.jpg")
img_crop = img[120:168, 1377:1422]
cv2.imwrite(r'D:\klasor\gelencroped.jpg', img_crop)
img = Image.open(r'D:\klasor\gelencroped.jpg')
thresh = 200
fn = lambda x: 0 if x > thresh else 255
r = img.convert('L').point(fn, mode='1')
r.save(r'D:\klasor\gelenblackandwhite.jpg', quality=95)
im = Image.open(r'D:\klasor\gelenblackandwhite.jpg')
pytesseract.pytesseract.tesseract_cmd = r'D:\teseract\tesseract.exe'
data = pytesseract.image_to_string(im, lang='eng', config='--psm 10 --oem 3 -c tessedit_char_whitelist=0123456789')
try:
kata = int(data)
except:
print('This is not integer')
return kata
I am using 3 images as an attachment also I am using tkinter as GUI, threading to work my while loop inside GUI without overload. It works fine with simple libraries and codes but I couldn't figure it out in my case.
I used this links to make .exe.
https://www.youtube.com/watch?v=t51bT7WbeCM&t=66s
https://www.youtube.com/watch?v=jfs_WJiJOUU&t=651s
https://www.youtube.com/watch?v=8pNwpy5bnBU
https://stackoverflow.com/questions/34453458/how-to-use-pyinstaller
This error message gives me using pyinstaller. If I follow to steps of link 3 it gives me Execute script error message
appdata\local\programs\python\python38-32\lib\site-
packages\win32com\client\makepy.py:369: SyntaxWarning: "is not" with a
literal. Did you mean "!="?
if path is not '' and not os.path.exists(path):
I need to change these paths for all users. How can I make sure all users have the same path or change the path for users automatically.