package questions

Daniel daniel.watrous at gmail.com
Fri May 22 20:29:24 CEST 2009


On May 22, 11:29 am, Scott David Daniels <Scott.Dani... at Acm.Org>
wrote:
> Daniel wrote:
> > Hello,
>
> > I've posted about this before, but after reading the docs, I have a
> > few more questions
> > here are the docs:http://docs.python.org/tutorial/modules.html#packages
> > here is my previous post:
> >http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> > I've setup some directories for the sound package, exactly as shown in
> > the examples in the docs.  In the surround file I put the lines
>
> > from . import echo
> > from .. import formats
> > from ..filters import equalizer
>
> > again, exactly as in the docs.  When I run surround.py, I get the
> > following result:
> > C:\sound\effects>python surround.py
> > Traceback (most recent call last):
> >   File "surround.py", line 1, in <module>
> >     from . import echo
> > ...
>
> (1) You really should identify your OS and Python version.  I am fairly
> certain it is some form of Windows, but ....
> Try something like:
>      C:\sound\effects> cd C:\
>      C:\> python -m sound.effects.surround
>
> (2) you can run
>      python -v surround.py
> or
>      python -vv surround.py
> To see files opened (or attempted and opened for -vv) in order to
> discover what exactly is tried and in what order on imports.
> Warning: the output is huge.
>
> --Scott David Daniels
> Scott.Dani... at Acm.Org

I'm on WinXP using Python 2.5  Sorry I didn't mention that at first.

C:\sound\effects>cd ..\..\

C:\>python -m sound.effects.surround
Traceback (most recent call last):
  File "C:\Python25\lib\runpy.py", line 95, in run_module
    filename, loader, alter_sys)
  File "C:\Python25\lib\runpy.py", line 52, in _run_module_code
    mod_name, mod_fname, mod_loader)
  File "C:\Python25\lib\runpy.py", line 32, in _run_code
    exec code in run_globals
  File "C:\POP\sound\effects\surround.py", line 5, in <module>
    from . import echo
ValueError: Attempted relative import in non-package

Do you want me to post the output from the -vv.  I couldn't see that
it actually tried to load it.  Here's a relevant portion (I think):
# C:\Python25\lib\linecache.pyc matches C:\Python25\lib\linecache.py
import linecache # precompiled from C:\Python25\lib\linecache.pyc
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "surround.py", line 1, in <module>
    from . import echo
ValueError: Attempted relative import in non-package
# clear __builtin__._

It appears to finish loading everything for python and then
immediately fails due to the import call.



More information about the Python-list mailing list