Newbie DateTime Question

Gordon McMillan gmcm at hypernet.com
Wed May 31 16:26:46 EDT 2000


Arnaldo Riquelme <javanet at dynacap.com> wrote:
>
>I'm using the mxDateTime module, and I'm trying to convert a 
string into a
>Datetime format
>
>import DateTime
>
>>>>atime = '19990222'
>
>>>>DateTime.DateTimeFrom(atime)
>
>and this is what I get
>
>Traceback (innermost last):
>  File "<interactive input>", line 1, in ?
>  File "DateTime\DateTime.py", line 208, in DateTimeFrom
>NameError: Case mismatch for module name Parser
>(filename C:\Program Files\Python\DLLs\parser.pyd)
>
>Can anyone give a hand with this module.

You have fallen victim to an excess of cleverness.

The DateTime directory should be on your PYTHONPATH. (I use 
a .pth file pointing to the directory containing the DateTime 
directory).

When you have it set right, "import DateTime" causes 
DateTime.__init__.py to run, which contains the line "from 
DateTime import *" (which refers to DateTime/DateTime.py), and 
then sets things up so Parser.py will be found in the DateTime 
directory).

However, if you're not set up right, the import "succeeds", (doesn't 
through an exception), but fails to get anything right. So when it 
hits the "import Parser", Python thinks you mean parser.pyd, not 
DateTime/Parser.py.

Never-name-your-child-"Daddy"-ly y'rs

- Gordon




More information about the Python-list mailing list