Python's import: why doesn't it work?

Dennis Lee Bieber wlfraed at ix.netcom.com
Mon Sep 30 01:24:56 CEST 2002


Jurie Horneman fed this fish to the penguins on Sunday 29 September 
2002 02:26 pm:

> Actually, I just tried this in a DOS shell under Windows 98:
> 
> python -v script.py >output.txt
> 
> It lists the verbose output straight to the DOS shell, not to
> output.txt. The output is useless, I can't scroll back.
>
        I suspect -v output uses stderr, not stdout.

        >output.txt redirects stdout

        Don't know if MS-DOS supports redirecting stderr. On linux you'd use

        python -v script.py 2>output.txt


        However, for this situation -- ie, trying to debug your import 
statement -- don't specify the full script on the command line. Do it 
interactively with the output going to the screen.

        Oh, BTW... you NEED TWO "v"... python -vv


>>> import tmp.some     #does not exist
# trying tmp.so
# trying tmpmodule.so
# trying tmp.py
# trying tmp.pyc
# trying /usr/lib/python2.2/tmp.so
# trying /usr/lib/python2.2/tmpmodule.so
# trying /usr/lib/python2.2/tmp.py
# trying /usr/lib/python2.2/tmp.pyc
# trying /usr/lib/python2.2/plat-linux-i386/tmp.so
# trying /usr/lib/python2.2/plat-linux-i386/tmpmodule.so
# trying /usr/lib/python2.2/plat-linux-i386/tmp.py
# trying /usr/lib/python2.2/plat-linux-i386/tmp.pyc
# trying /usr/lib/python2.2/lib-tk/tmp.so
# trying /usr/lib/python2.2/lib-tk/tmpmodule.so
# trying /usr/lib/python2.2/lib-tk/tmp.py
# trying /usr/lib/python2.2/lib-tk/tmp.pyc
# trying /usr/lib/python2.2/lib-dynload/tmp.so
# trying /usr/lib/python2.2/lib-dynload/tmpmodule.so
# trying /usr/lib/python2.2/lib-dynload/tmp.py
# trying /usr/lib/python2.2/lib-dynload/tmp.pyc
# trying /usr/lib/python2.2/site-packages/tmp.so
# trying /usr/lib/python2.2/site-packages/tmpmodule.so
# trying /usr/lib/python2.2/site-packages/tmp.py
# trying /usr/lib/python2.2/site-packages/tmp.pyc
# trying /usr/lib/python2.2/site-packages/Numeric/tmp.so
# trying /usr/lib/python2.2/site-packages/Numeric/tmpmodule.so
# trying /usr/lib/python2.2/site-packages/Numeric/tmp.py
# trying /usr/lib/python2.2/site-packages/Numeric/tmp.pyc
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named tmp.some
-- 
--
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <



More information about the Python-list mailing list