How to import a standard module in source file with same name?

Christos TZOTZIOY Georgiou tzot at
Sun Aug 24 07:18:27 CEST 2003

On 23 Aug 2003 21:52:11 -0700, rumours say that sdhyok at
(sdhyok) might have written:

[snip of problem description as per the subject]

>Under the condition that the absolute path to the standard module
>is variable in different machines 
>(so, imp.find_module may not be a solution),
>is there an elegant way to solve this problem?

You might try changing the case... call it DateTime for example; there
must be some magic in the C code (if you work on Windows) that matches
in a case-sensitive way.  Or you can do (in the importing module,
possibly your main program):

import datetime
import vp.datetime
vp.datetime.datetime = datetime
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.

More information about the Python-list mailing list