import module unbelieveable behaviour

Carl Banks pavlovevidence at gmail.com
Thu Jul 16 01:38:23 EDT 2009


On Jul 15, 10:16 pm, Peter Fodrek <peter.fod... at stuba.sk> wrote:
> On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
>
> > Peter Fodrek wrote:
> ......
> > What does
>
> > import nc
> > print nc.__file__
>
> python
> Python 2.6 (r26:66714, Feb  3 2009, 20:49:49)
> [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> import nc
> >>> print nc.__file__
>
> nc/__init__.pyc


What does it do if you run this from a script?

Also, what is sys.path[0] in both interactive and script?

Inside test.py, right before the line that imports nc.rez, add the
code "import sys; print sys.modules.get('nc')"; what does that output?

Is there an old nc.py or nc.pyc file anywhere?


Carl Banks

Carl Banks



More information about the Python-list mailing list