Issue1349

classification
Title: access to jython classes not possible given the fully qualified name of the class
Type: Severity: normal
Components: Core Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: MartinTschoepe, otmarhumbel
Priority: Keywords:

Created on 2009-05-15.09:26:45 by MartinTschoepe, last changed 2009-05-18.12:54:40 by otmarhumbel.

Messages
msg4685 (view) Author: MartinTschöpe (MartinTschoepe) Date: 2009-05-15.09:26:44
when having a file "foo/bar/a.py" in the jython path defining a class A
then an access to 

foo.bar.a.A()

leads to an 

AttributeError: 'module' object has no attribute 'a'

even when

from foo.bar import a
a.A()

works. Furthermore

from foo.bar.a import A

doesn't work as well.

This behavior has been found with the Rc2 of jython 2.5 binary.
msg4693 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-05-18.12:50:23
Please find a sample CPython 2.5.1 session below:

C:\>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> foo.bar.a.A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> from foo.bar.a import A
>>> foo.bar.a.A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> import foo
>>> import foo.bar
>>> import foo.bar.a
>>> foo.bar.a.A()
A was created
<foo.bar.a.A instance at 0x01A4E0D0>
>>>
msg4694 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-05-18.12:51:12
And now the same statements in Jython 2.5 rc2:


C:\stuff\jython\jython-2.5rc2>jython
Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_13
Type "help", "copyright", "credits" or "license" for more information.
>>> foo.bar.a.A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> from foo.bar.a import A
>>> foo.bar.a.A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> import foo
>>> import foo.bar
>>> import foo.bar.a
>>> foo.bar.a.A()
A was created
<foo.bar.a.A instance at 0x1>
>>>
msg4695 (view) Author: Oti Humbel (otmarhumbel) Date: 2009-05-18.12:54:40
IMHO the behaviour is absolutely consistent.

Please let us know if you can find a difference all the same.
Thanks !
History
Date User Action Args
2009-05-18 12:54:40otmarhumbelsetstatus: open -> closed
resolution: works for me
messages: + msg4695
2009-05-18 12:51:12otmarhumbelsetmessages: + msg4694
2009-05-18 12:50:24otmarhumbelsetnosy: + otmarhumbel
messages: + msg4693
2009-05-15 09:26:45MartinTschoepecreate