Trouble importing modules in IDLE (Win32)

boblatest at googlemail.com boblatest at googlemail.com
Mon Aug 25 10:03:37 CEST 2008


On Aug 22, 2:45 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> boblat... 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.

No, they're the same:

IDLE 1.2.2
>>> import sys
>>> print sys.prefix
C:\Python25
>>>

PythonWin 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin'
for further copyright information.
>>> import sys
>>> print sys.prefix
C:\Python25
>>>

Thanks,
robert



More information about the Python-list mailing list