[Tutor] Printing error on Win 98SE
John Corry
john.corry at ntlword.com
Mon Jan 2 15:55:19 CET 2006
Hi + Happy New Year,
With help from several people from the mailing list I have been able to
print out text files on my windows XP machine. I have tried using the same
program on my windows 98SE machine and I get the following error:
PythonWin 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bit (Intel)] on
win32.
Portions Copyright 1994-2004 Mark Hammond (mhammond at skippinet.com.au) - see
'Help/About PythonWin' for further copyright information.
Traceback (most recent call last):
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.')
>>>
I can manually right click the text file and left click print and the file
will print to the printer.
The code that I am using is below:
import win32api
filename = "testprint.txt"
fileobj=open (filename, "w")
fileobj.write ("This is a test")
fileobj.close()
win32api.ShellExecute (
0,
"print",
filename,
None,
".",
0
)
Any help would be greatly appreciated.
Thanks,
John.
More information about the Tutor
mailing list