Reputation: 3652
I have the following code
from win32 import win32print
for p in win32print.EnumPrinters(win32print.PRINTER_ENUM_LOCAL, None, 1):
_, _, name, _ = p
print (name)
The code works. I'm trying to create an exe file from it as follows:
cd C:\Users\xralf\AppData\Local\Programs\Python\Python38-32\Scripts
pyinstaller.exe --onefile C:\Users\xralf\Desktop\enumprinters.py
cd dist
enumprinters.exe
It writes the following error message:
ImportError: DLL load failed while importing win32print: The specified module could not be found.
How can I fix it?
Upvotes: 2
Views: 1185
Reputation: 12672
There are three ways I know maybe can solve your problem:
pyinstaller
.pywin32
.pyinstaller --add-binary 'the_path_of_dll:.' myscript.py
python 3.8
,Please use the old version.I heard that pyinstaller
worked not very well in python 3.8
.Upvotes: 1