python 3.5 raiaing an error when import the class Manager in this module sayning name Manager is not define

Rhodri James rhodri at kynesim.co.uk
Thu Jul 13 09:23:33 EDT 2017


On 12/07/17 16:19, WoFy The 95s wrote:
> On Wednesday, 12 July 2017 18:57:11 UTC+5:30, Peter Otten  wrote:
>> WoFy The 95s wrote:
>>
>>> i tried from idle interpreter
>>>
>>> from person import Manager
>>>
>>>
>>>
>>>>>> from person import Manager
>>> Traceback (most recent call last):
>>> File "<pyshell#95>", line 1, in <module>
>>> from person import Manager
>>> ImportError: cannot import name 'Manager'
>>
>>
>> Enter
>>
>> import person
>> person.__file__
>>
>> in idle's shell. There may be another file called person.py which is
>> imported instead of the one you intended.

[snip]

> 
>>>> import person
>>>> tom = person.Manager('Parias lunkamba', 'mgr', 500000)
>>>> Traceback (most recent call last):
>    File "<pyshell#125>", line 1, in <module>
>      tom = person.Manager('parias lunkamba', 'mgr', 500000)
> AttributeError: module 'person' has no attribute 'Manager'
> 
> why the module in python 3.5 doesn't recognize the Manager class?

It does for me.  Have you tried Peter's suggestion of typing

 >>> import person
 >>> person.__file__

into IDLE?  It is very likely that you are not picking up the 
"person.py" that you think you are.

-- 
Rhodri James *-* Kynesim Ltd



More information about the Python-list mailing list