Python Forum
Python 3.7.7 Bug? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python 3.7.7 Bug? (/thread-25156.html)



Python 3.7.7 Bug? - DJPatchyIce - Mar-21-2020

Is anyone else experiencing an import bug in the latest 3.7 version

Example:

File a
 import b
 
 print(b.something.a)
(AttributeError: type object 'something' has no attribute 'a')

File b
class something:
      a = 0
I am using a virtual environment currently experimenting with other interpreters to make sure its just 3.7 and not me


RE: Python 3.7.7 Bug? - Gribouillis - Mar-22-2020

Try print(b) to see which file was actually read.


RE: Python 3.7.7 Bug? - snippsat - Mar-22-2020

Works fine for me Python 3.7.
C:\code
λ ptpython
>>> import b

>>> b
<module 'b' from 'C:\\code\\b.py'>
>>> b.something
<class 'b.something'>
>>> b.something.a
0

>>> b.something.a = 99
>>> print(b.something.a)
99
A better Python REPL like ptpython or IPython can help when inspect any module or package.
I like ptpython as it show all attributes automatic,IPython press Ctrl-Backspace,.
[Image: LKnPan.png]