By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,519 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,519 IT Pros & Developers. It's quick & easy.

Has Python 2.4.1 changed implementation for __init__.py???

P: n/a
Hallo,
I just downloaded http://www.python.org/pypi/xexpr/0.02, installed
if (python setup.py install) and tried the example in the README file.

Than I got following error: AttributeError: 'module' object has no
attribute 'Read'

This is same behavior for all module using empty __init__.pr files,
like venster, Pyrex or libxmlmods...

Is there a change in the implementation, so that every module needs an
explicit list for exchanged modules? Or is there a switch or an
environment variable to change?
Thanks a lot
Werner
EXAMPLE
------------------------------------------------------------------------

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import xexpr
example = '<foo a="b" c="d"><bar><baz a="d" />Blah</bar></foo>'
xexpr.Read.to_xexpr(example) Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'Read'

Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Werner Merkl wrote:
I just downloaded http://www.python.org/pypi/xexpr/0.02, installed
if (python setup.py install) and tried the example in the README file.

Than I got following error: AttributeError: 'module' object has no attribute 'Read'

This is same behavior for all module using empty __init__.pr files,
like venster, Pyrex or libxmlmods...
if "xexpr" is a package with an empty __init__.py file, the behaviour you're
seeing is the expected behaviour. importing a toplevel module doesn't auto-
matically import any submodules.
Is there a change in the implementation, so that every module needs an
explicit list for exchanged modules?
what's an "exchanged module"?
EXAMPLE
------------------------------------------------------------------------

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import xexpr
example = '<foo a="b" c="d"><bar><baz a="d" />Blah</bar></foo>'
xexpr.Read.to_xexpr(example) Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'Read'


does it work better if you type

import xexpr.Read

before you call the to_xexpr function?

</F>

Jul 18 '05 #2

P: n/a
Fredrik Lundh wrote:
Werner Merkl wrote:

I just downloaded http://www.python.org/pypi/xexpr/0.02, installed
if (python setup.py install) and tried the example in the README file.

Than I got following error: AttributeError: 'module' object has no attribute 'Read'

This is same behavior for all module using empty __init__.pr files,
like venster, Pyrex or libxmlmods...

if "xexpr" is a package with an empty __init__.py file, the behaviour you're
seeing is the expected behaviour. importing a toplevel module doesn't auto-
matically import any submodules.

Oh, I see. I have to write:
import xexpr.Read

Now it works...
Is there a change in the implementation, so that every module needs an
explicit list for exchanged modules?

what's an "exchanged module"?

Oops! This should say "every module"...

Thanx a lot
Werner
EXAMPLE
------------------------------------------------------------------------

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>import xexpr
>example = '<foo a="b" c="d"><bar><baz a="d" />Blah</bar></foo>'
>xexpr.Read.to_xexpr(example)


Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'Read'


does it work better if you type

import xexpr.Read

before you call the to_xexpr function?

</F>

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.