[Tutor] Further help needed!
John Corry
john.corry at ntlword.com
Wed Jan 4 22:01:42 CET 2006
I am using the following code to send a text file to the printer:-
import win32api
filename = "testprint.txt"
fileobj=open (filename, "w")
fileobj.write ("This is a test")
fileobj.close()
win32api.ShellExecute (
0,
"print",
filename,
None,
".",
0
)
This code works on windows XP + Windows 2000. However it does not work on
windows 98SE. I have tried this code on 3 seperate machines with windows
98SE. They all come up with the same error:
File
"C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\test\Script1.py", line 12, in ?
0
error: (31, 'ShellExecute', 'A device attached to the system is not
functioning.')
Is there another way to print out a text file on windows 98SE? Do I have to
do something different on the windows 98SE machine? Any help would be
greatly appreciated.
Thanks,
John.
More information about the Tutor
mailing list