Re: [Tutor] Python upgrade from 2.3 to 2.4
Srinivas Iyyer wrote: > So how should I upgrade from 2.3 to 2.4 without > loosing the neat libraries and modules that I have > been using on 2.3. these python modules and libraries > are backbone for my programming skills. so how could I > upgrade without loosing theh binaries and modules (eg. > BioPython module, EUtils etc. You will have to re-install the modules for Python 2.4. The two installations are independent - they each have their own set of installed modules. If the module includes binary files, make sure you get a version of the module compiled for Python 2.4. If the module contains only Python files then the same release will work for both Python versions. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] iterate over daterange
captnswing wrote: > Hello > I have a startdate and an enddate and I want to iterate over all days > in between the two > > there doesn't seem to be a range function for dates?!? > > i.e. currently I am going through integers with something like this: > > = > startdate = datetime.date(2006,1,1) > enddate = datetime.date(2006,10,19) > > for i in range((enddate-startdate).days + 1): > currentdate = startdate + datetime.timedelta(days=i) > > = > > this seems so 'unpythonic', there surely must be a better way, no? currentdate = datetime.date(2006,1,1) enddate = datetime.date(2006,1,19) while currentdate <= enddate: print currentdate currentdate += datetime.timedelta(days=1) seems a little better to me. Gustavo Niemeyer's dateutil package includes very flexible recurrence rules - see http://labix.org/python-dateutil#head-470fa22b2db72000d7abe698a5783a46b0731b57 Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Nearly there
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: 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
Re: [Tutor] Nearly there
Terry, Your suggestion works. It also works consistently if you fully define the path of 'filename'. eg 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 2k. 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? Thanks, John. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Terry Carroll Sent: 07 January 2006 00:24 To: tutor@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 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 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor