[Tutor] Nearly there
john.corry at ntlword.com
Sat Jan 7 11:57:26 CET 2006
Your suggestion works. It also works consistently if you fully define the
path of 'filename'.
filename = "c:/test/testprint.txt"
You are right, shell execute seems to need the full path name with windows
98SE. It is strange that it does not need the full path for win xp + win
Onto my next problem.
My text file is printing out in portrait. Is there any instruction that I
can use so that notepad prints it in landscape?
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On
Behalf Of Terry Carroll
Sent: 07 January 2006 00:24
To: tutor at python.org
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
> import win32api
> filename = "testprint.txt"
> fileobj=open (filename, "w")
> fileobj.write ("This is a test")
> win32api.ShellExecute (
I'm wondering if ShellExecute needs a full path to find it under W98.
Try this; add to the top of your code:
and change your ShellExecute to this:
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 at python.org
More information about the Tutor