I'm also curious, although not surprised - since this is why I tend not to try to print using the API!, but another possibility is that Win98 doesn't recognise the dot shortcut for a path.
You may need to fill in the explicit path info: > win32api.ShellExecute ( > 0, > "print", > os.path.abspath(filename), > None, > ".", <--- try the full path here too. > 0 > ) HTH, Alan G. ----- Original Message ----- From: "Terry Carroll" <[EMAIL PROTECTED]> To: <tutor@python.org> Sent: Saturday, January 07, 2006 12:23 AM Subject: Re: [Tutor] Nearly there > This is itching at me, too. > > On Fri, 6 Jan 2006, John Corry wrote: > >> Can anyone understand or tell me why this works but the following code >> does >> not:- >> >> import win32api >> filename = "testprint.txt" >> fileobj=open (filename, "w") >> fileobj.write ("This is a test") >> fileobj.close() >> win32api.ShellExecute ( >> 0, >> "print", >> filename, >> None, >> ".", >> 0 >> ) > > I'm wondering if ShellExecute needs a full path to find it under W98. > > Try this; add to the top of your code: > > import os.path > > and change your ShellExecute to this: > > win32api.ShellExecute ( > 0, > "print", > os.path.abspath(filename), > None, > ".", > 0 > ) > > > I have no idea if this will work; and the error message you're getting, > >> The code above gives me the error: (31, 'ShellExecute', 'A device >> attached >> to the system is not functioning.') > > doesn't seem to indicate it, but it's one less thing. > > I'd love to know the answer when you get it. > > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor