[Tutor] How to unpack python-dateutil-2.0.tar.gz
steve at pearwood.info
Fri Oct 19 05:55:08 CEST 2012
On 19/10/12 14:30, Richard D. Moores wrote:
>> you want to get today's date out of the "date" unix system command.
>> [end quote]
> I missed that. It's the first clue I could find anywhere that the
> download for 3.x (x> 0) is only for a "Unix or a Unix-compatible
> system like Linux".
No, you have misunderstood.
The *date* command, as shown, is a unix system command. But dateutils
The relevant lines from the demo code are:
now = parse(commands.getoutput("date"))
which uses the commands module to send the command "date" to the
operating system, run it, and get the result, and only then gets
dateutil to parse the text.
You can replace those lines with:
now = parse("Fri Oct 19 13:16:40 EST 2012")
and I expect it will work.
>> Here's what `date` outputs under Unix/Linux:
>> [steve at ando ~]$ date
>> Fri Oct 19 13:16:40 EST 2012
>> What does it output on your computer?
> I showed you everything already.
Have you tried running `date` at the Windows command.com (or cmd.exe,
or something, I never remember which)? What does it print?
My guess is that it probably prints something like:
"Command not found"
which clearly cannot be parsed as a date.
More information about the Tutor