Python Forum
Issue python3.6 while inheriting telnet library
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue python3.6 while inheriting telnet library
#1
I am trying to create below hierarchy in my python code. But I am facing some issue when I am inheriting telnet library. This issue is coming in python 3.6.
import telnetlib
class A(telnetlib.Telnet):
    def __init__(self):
        print("init A")
        super(A, self).__init__()

class B(object):
    def __init__(self):
        print("init B")
        super(B, self).__init__()

class C(B):
    def __init__(self):
        print("init C")
        super(C, self).__init__()

class D(object):
    def __init__(self):
        print("init D")
        super(D, self).__init__()

class E(C,D):
    def __init__(self):
        print("init E")
        super(E, self).__init__()

class F(A,E):
    def __init__(self):
        print("init F")
        super(F, self).__init__()

if __name__ == '__main__':
    F()
Output in python3.6:-
Output:
init F init A
Output in python2.7:-
Output:
init F init A init E init C init B init D Exception AttributeError: "'F' object has no attribute 'sock'" in <bound method F.__del__ of <__main__.F object at 0x7f6a9f36a6d0>> ignored
Output in python3.6 without telnet library:-
Output:
init F init A init E init C init B init D
if I run the same code and derive class 'A' from object instead of telnetlib.Telnet the constructor calling works fine.

Can somebody please guide me here, What I am doing wrong. I am really stuck here.

The same code works perfectly fine with python 2.7.

Thanks in advance!

Regards, Sourabh Jaiswal
Reply


Messages In This Thread
Issue python3.6 while inheriting telnet library - by sourabhjaiswal92 - May-08-2018, 02:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Object inheriting from two classes? Melendroach 3 2,175 May-11-2021, 06:37 PM
Last Post: deanhystad
  MacOS BigSur Python3 - dyld: Library not loaded: trillionanswers 1 4,219 Mar-02-2021, 11:00 PM
Last Post: nilamo
  Issue with a library ebolisa 2 1,782 Feb-27-2021, 08:35 AM
Last Post: ebolisa
  Telnet command in Python 3.9 Dre83 0 1,970 Nov-11-2020, 11:42 AM
Last Post: Dre83
  Not able to use boto library with compressed content in python3 avinash2020 1 1,895 Aug-13-2020, 09:24 PM
Last Post: avinash2020
  Type conversion issue while using Descriptor in Python3 mailnsuresh 1 2,865 May-07-2020, 12:26 PM
Last Post: deanhystad
  Sending command using telnet mradovan1208 1 3,978 Apr-24-2020, 07:09 PM
Last Post: Larz60+
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,928 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Inheriting, given number from randint is not working beLIEve 0 1,525 Oct-12-2019, 06:50 PM
Last Post: beLIEve
  Pymssql library failing when upgrading to Python 3.7 - win32 issue stixmagiggins 5 7,472 Jun-24-2019, 06:46 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020