On 19/10/12 14:30, Richard D. Moores wrote:
[quote]
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
is not.
The relevant lines from the demo code are:
import commands
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@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.
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor