Trouble importing modules in IDLE (Win32)

Diez B. Roggisch deets at nospam.web.de
Fri Aug 22 08:45:53 EDT 2008


boblatest at googlemail.com schrieb:
> Hello,
> 
> I wrote aprogram that imports odbc and dbi. Originally I used PyWin,
> but now I prefer IDLE for working in Windows. Anyway, when I start my
> program from IDLE, it can't import the odbc and dbi modules. However,
> when I restart the shell and type "import odbc" at the prompt by, I
> don't get an error. When I try to run the program now, I get the error
> again. When I now type "import odbc" at the prompt, I get the error as
> well.
> 
> In short:
> In a freshly (re)started shell, I can use "import odbc" by hand. I
> can't import odbc from within a script, or by hand after trying to
> start such a script. Screen capture follows.
> 
> robert
> 
>>>> ================================ RESTART ================================
>>>> import odbc # <<-no error here!
>>>> ================================ RESTART ================================
>>>> # script started here
> 
> Traceback (most recent call last):
>   File "H:\PythonProjekte\ADBExpress.py", line 1, in <module>
>     import odbc
> ImportError: DLL load failed: Das angegebene Modul wurde nicht
> gefunden.
> 
> 

In both shell and idle, do

 >>> import sys
 >>> print sys.prefix

Most probably these differ, and you need to install the odbc-module to 
the python idle uses.

Diez



More information about the Python-list mailing list