D
Daniel
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...read/thread/3a352159f6828eb9/cda8395d36827d20
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
ValueError: Attempted relative import in non-package
C:\sound\effects>
Why doesn't this work as suggested in the docs. The only way that I
found to get around this is to add directories to the path, but I
can't help but think that it shouldn't be necessary to modify the path
for packages to work.
Just to be sure, here are directory listings showing the I have the
__init__.py files in place
C:\sound\effects>dir
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound\effects
05/22/2009 10:07 AM <DIR> .
05/22/2009 10:07 AM <DIR> ..
05/22/2009 10:06 AM 0 echo.py
05/22/2009 10:16 AM 189 surround.py
05/22/2009 10:04 AM 0 __init__.py
3 File(s) 189 bytes
2 Dir(s) 50,860,060,672 bytes free
C:\POP\sound\effects>dir ..\
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound
05/22/2009 10:04 AM <DIR> .
05/22/2009 10:04 AM <DIR> ..
05/22/2009 10:07 AM <DIR> effects
05/22/2009 10:06 AM <DIR> filters
05/22/2009 10:04 AM <DIR> formats
05/22/2009 10:04 AM 0 __init__.py
1 File(s) 0 bytes
5 Dir(s) 50,859,077,632 bytes free
C:\sound\effects>dir ..\filters
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound\filters
05/22/2009 10:06 AM <DIR> .
05/22/2009 10:06 AM <DIR> ..
05/22/2009 10:06 AM 0 equalizer.py
05/22/2009 10:04 AM 0 __init__.py
2 File(s) 0 bytes
2 Dir(s) 50,859,077,632 bytes free
Please share any feedback. Thanks.
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...read/thread/3a352159f6828eb9/cda8395d36827d20
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
ValueError: Attempted relative import in non-package
C:\sound\effects>
Why doesn't this work as suggested in the docs. The only way that I
found to get around this is to add directories to the path, but I
can't help but think that it shouldn't be necessary to modify the path
for packages to work.
Just to be sure, here are directory listings showing the I have the
__init__.py files in place
C:\sound\effects>dir
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound\effects
05/22/2009 10:07 AM <DIR> .
05/22/2009 10:07 AM <DIR> ..
05/22/2009 10:06 AM 0 echo.py
05/22/2009 10:16 AM 189 surround.py
05/22/2009 10:04 AM 0 __init__.py
3 File(s) 189 bytes
2 Dir(s) 50,860,060,672 bytes free
C:\POP\sound\effects>dir ..\
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound
05/22/2009 10:04 AM <DIR> .
05/22/2009 10:04 AM <DIR> ..
05/22/2009 10:07 AM <DIR> effects
05/22/2009 10:06 AM <DIR> filters
05/22/2009 10:04 AM <DIR> formats
05/22/2009 10:04 AM 0 __init__.py
1 File(s) 0 bytes
5 Dir(s) 50,859,077,632 bytes free
C:\sound\effects>dir ..\filters
Volume in drive C is Default
Volume Serial Number is 8CD7-71F6
Directory of C:\sound\filters
05/22/2009 10:06 AM <DIR> .
05/22/2009 10:06 AM <DIR> ..
05/22/2009 10:06 AM 0 equalizer.py
05/22/2009 10:04 AM 0 __init__.py
2 File(s) 0 bytes
2 Dir(s) 50,859,077,632 bytes free
Please share any feedback. Thanks.