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

sdhyok sdhyok at yahoo.com
Sun Aug 24 06:52:11 CEST 2003


Here is my situation.
To add more functionalities to a standard library(datetime) in python,
I am implementing my own code called vp.datetime 
(directory structure, vp/datetime.py).
To make it clear the file extends functions of the standard datetime,
I like to use the same name with its standard library.

The problem is that I have to use the standard library inside
my extended code. But, whenever I try "import datetime",
it assumes my extended module, not the standard module
because of python's default path searching order.

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?

Shin, Daehyok




More information about the Python-list mailing list