May-09-2024, 12:53 PM
(This post was last modified: May-09-2024, 12:53 PM by Wild_Tigra.)
Hello everyone, I’ll say right away that I’m new to programming, I mainly use GPT chat. The essence of the problem is that there is code in Python, and it works. But when I compile it into an exe file and transfer it to another machine, it stops sending it to print. in the code I use import win32print. When compiling, I don’t see anywhere a mention that such a method was added to my executable file.
There are no errors, just don’t print and that’s it, although the printer itself finds it, this is displayed in the log file.
Tell me, has anyone encountered this problem? how to solve or get around it in another way.
I apologize for my English, I used Google translator
Thank you.
There are no errors, just don’t print and that’s it, although the printer itself finds it, this is displayed in the log file.
Tell me, has anyone encountered this problem? how to solve or get around it in another way.
I apologize for my English, I used Google translator
def print_pdf(self, pdf_file_path): with open('logfile.txt', 'w') as file: try: default_printer = win32print.GetDefaultPrinter() print("test 1:", default_printer, file=file) printer_handle = win32print.OpenPrinter(default_printer) print("test 2:", printer_handle, file=file) print_pdf_alternative(pdf_file_path, default_printer) print("test 3:", printer_handle, file=file) win32print.ClosePrinter(printer_handle) except Exception as e: logging.error(f'Error occurred while printing: {str(e)}')in the log file on the new PC there is an entry only for test 1 and 2, on the PC where Python is installed all 3 tests pass and printing works
Thank you.