__import__ problem

K

Kottiyath

Hi all,
When I try to import a module via __import__, I am facing
ImportError. But, when I tried to import it via usual 'import', it
worked fine.
Please see below:
try:
import exact
except:
logging.exception('Error during importing')

try:
code = __import__('exact')
except:
logging.exception('Is it still happening?')

The error is as:
2008-12-06 20:06:59,328 ERROR Is it still happening?
Traceback (most recent call last):
File "C:\django\test\..\test\basic\views.py", line 166, in getValue
code = __import__('exact')
ImportError: No module named exact

Could you please let me know why this is happening? I tried to
__import__ 'sys etc, and it worked fine. Is it due to some issue in
the path?

Regards
K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top