I'm confused. I was going to try linkchecker, and it dies with a
traceback ending in
File "/usr/local/lib/python2.4/calendar.py", line 32, in _localized_mont h
_months = [datetime.date(2 001, i+1, 1).strftime for i in range(12)]
AttributeError: 'module' object has no attribute 'date'
Sure enough, there is no datetime.date, but there is a datetime.Date:
Python 2.4 (#2, Feb 19 2005, 20:35:23)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright" , "credits" or "license" for more information. import datetime dir(datetime)
['Date', 'DateTime', ...]
However, the Library Reference clearly states that datetime.date
should exist. Granted, it's been a while since I used python in
anger, but isn't this what it says? http://www.python.org/doc/2.4/lib/node243.html http://www.python.org/doc/2.4/lib/datetime-date.html
Moreover, the datetime.date class is supposed to have a strftime()
method. datetime.Date does not.
I'm beginning to wonder if the FreeBSD python package is at fault.
Or what is really going on here?
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.n o/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow 3 2545
Harald Hanche-Olsen wrote: I'm beginning to wonder if the FreeBSD python package is at fault.
Maybe - at my system, it has no Date or DateTime
Python 2.4.1a0 (#2, Feb 9 2005, 12:50:04)
[GCC 3.3.5 (Debian 1:3.3.5-8)] on linux2
Type "help", "copyright" , "credits" or "license" for more information. import datetime dir(datetime)
['MAXYEAR', 'MINYEAR', '__doc__', '__file__', '__name__', 'date',
'datetime', 'datetime_CAPI' , 'time', 'timedelta', 'tzinfo']
Maybe this is a clash between a custom datetime module and the python one?
What does
python2.4 -v -c "import datetime"
give you?
--
Regards,
Diez B. Roggisch
[Harald Hanche-Olsen] I'm confused. I was going to try linkchecker, and it dies with a traceback ending in
File "/usr/local/lib/python2.4/calendar.py", line 32, in _localized_mont h _months = [datetime.date(2 001, i+1, 1).strftime for i in range(12)] AttributeError: 'module' object has no attribute 'date'
Sure enough, there is no datetime.date, but there is a datetime.Date:
Python 2.4 (#2, Feb 19 2005, 20:35:23) [GCC 3.4.2 [FreeBSD] 20040728] on freebsd5 Type "help", "copyright" , "credits" or "license" for more information. import datetime dir(datetime)
['Date', 'DateTime', ...]
However, the Library Reference clearly states that datetime.date should exist. Granted, it's been a while since I used python in anger, but isn't this what it says?
http://www.python.org/doc/2.4/lib/node243.html http://www.python.org/doc/2.4/lib/datetime-date.html
Moreover, the datetime.date class is supposed to have a strftime() method. datetime.Date does not.
I'm beginning to wonder if the FreeBSD python package is at fault.
Or what is really going on here?
As you've deduced, you're certainly not getting Python's builtin
datetime module. Therefore you must be getting some other datetime
module. Run Python with the "-v" switch to get output telling you how
imports are resolved. That will show you where this other datetime
module is coming from. Remember that Python searches along sys.path
to resolve imports, taking the first thing it finds with the right
name. You almost certainly have something _called_ datetime earlier
in your PYTHONPATH than where the standard Python libraries appear.
+ Tim Peters <ti********@gma il.com>:
| As you've deduced, you're certainly not getting Python's builtin
| datetime module.
Argh. Yeah, I've had one lying around in my personal python directory
since 2000, had totally forgotten it was there. This one ...
*** Author: Jeff Kunce <ku****@mail.co nservation.stat e.mo.us>
*** Download from: http://starship.skyport.net/crew/jjkunce
Removed it, now all is well.
Thanks for pointing out the blindingly obvious.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.n o/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gerrit Holl |
last post by:
Posted with permission from the author.
I have some comments on this PEP, see the (coming) followup to this message.
PEP: 321
Title: Date/Time Parsing and Formatting
Version: $Revision: 1.3 $
Last-Modified: $Date: 2003/10/28 19:48:44 $
Author: A.M. Kuchling <amk@amk.ca>
Status: Draft
Type: Standards Track
|
by: John Hunter |
last post by:
>>> from datetime import date
>>> dt = date(1005,1,1)
>>> print dt.strftime('%Y')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: year=1005 is before 1900; the datetime strftime() methods require year >= 1900
Does anyone know of a datetime string formatter that can handles
strftime format strings over the full range that datetime objects
support?
|
by: MarkAurit |
last post by:
Im having difficulty coming up with a good algorithm to express the following
comparison:
"if <a given date> falls between the (current date - 5 days) and the
(current date)"
Obviously. DateTime.Now and something like (AddDays(DateTime.Now,-5) are used
for the inner and outer ranges, its how to express the "between" that has me.
/* what Id like to do, in pseudo code */
dateToTest=DateTime.Parse("mm/dd/yy");
|
by: Ante Perkovic |
last post by:
Hi,
How to declare datetime object and set it to my birthday, first or
last day of this month or any other date.
I can't find any examples in VS.NET help!
BTW, what is the difference between date and datetime classes?
Please, help
|
by: Mike Rooney |
last post by:
Hi everyone, this is my first post to this list. I am trying to create a
subclass of datetime.date and pickle it, but I get errors on loading it
back. I have created a VERY simple demo of this:
import datetime
class MyDate(datetime.date):
"""
This should be pickleable.
| |
by: kyosohma |
last post by:
Hi,
I am working on a timesheet application in which I need to to find the
first pay period in a month that is entirely contained in that month
to calculate vacation time. Below are some example date ranges:
December 31, 2006 January 13, 2007 # doesn't earn
January 14, 2007 January 27, 2007 # does earn
January 28, 2007 February 10, 2007 # doesn't
|
by: Christian Heimes |
last post by:
Rick King schrieb:
datetime.date is a C extension class. Subclassing of extension classes
may not always work as you'd expect it.
Christian
|
by: Will Rocisky |
last post by:
Actually I am trying to save both date and time in one cell but they
are given separately by user.
|
by: w41ter |
last post by:
I'm writing a very simple python program to read in an ascii csv file with multiple records formatted like this:
"2010.3.13, 0.0.0, 10.1, 12.2, 9.9, 10.1, 2500" # i.e. a list of daily stock prices with date,time,open,high,low,close,volume fields
I use this python code to read each line from the ascii file named f:
for line in f: d,t,o,h,l,c,v = line.split(',') # where d stands for date, etc
Much to my pleasant shock, the ascii...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |