Anomalous “object.__init__() takes exactly one argument” from a class that inherit from another

I cannot understand what can cause this anomalous call of object.__init__ I will really appreciate a help.

Here the code. I’m including all the code, except for useless text because I don’t know what cause the error

class IdXY(bclasses.GenStructData):
  _dtype_names=('idx', 'x', 'y');
  _dtype_nfld=len(_dtype_names);
  _dtype_formats=(str, float, float);
  _dtype_nlines=1;
  _dtype_delimiter=' ';
  _str_format="{idx:>12} {x:10f} {y:10f}";

  (idx,idn, x,y)='-',0, 0.,0.;
  withid=True;

  def _check_def(self, check_value=True):
    """Function to check if the class is defined correctly
""";
    _name_='IdXY object';
    if(self._dtype_nlines!=1): raise ValueError(_name_+": `_dtype_nlines` for this king of object can be just 1. Use the multi-lines version");
    if(not self.withid):
      if('idx' in self._dtype_names):
        if(self._dtype_names.index('idx')==0):
          self._dtype_names=self._dtype_names[1:];
          self._dtype_formats=self._dtype_formats[1:];
        else: raise SkZpipeError(_name_+"...", exclocus=_name_);
    super()._check_def(check_value=check_value); #=>bclasses.GenStructData


 ###__INIT__###
  def __init__(self, data=None, withid=None, idn=0):
    """IdXY object with 2D coordinates and eventually an ID.
""";
    _name_='IdXY object';
    if(data is None): raise ValueError(_name_+": No data to create the object");
    self.idx="-";
    if(withid is not None): self.withid=withid;

    print(self.__class__.__mro__, flush=True); #added to check
    super().__init__(data=data);

Then there is not important code. Running I got:

> IdXY("1 2 3")
(<class 'skzpipe.parameters.classes.fileclass.basefile.IdXY'>, <class 'skzpipe.parameters.classes.bclasses.GenStructData'>, <class 'object'>)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/skz/SkZ_pipeline/SkZpipe/skzpipe/parameters/classes/fileclass/basefile.py", line 562, in __init__
    super().__init__(data=data);
TypeError: object.__init__() takes exactly one argument (the instance to initialize)

Why does the code jump to object.__init__() instead of executing GenStructData.__init__()? GenStructData doesn’t use super.

Something is anomalous because:

> issubclass(skzpipe.parameters.classes.fileclass.basefile.IdXY,
> skzpipe.parameters.classes.bclasses.GenStructData) 
> False

And I defined IdXY as a subclass of GenStructData. But:

> skzpipe.parameters.classes.fileclass.basefile.IdXY.__mro__
> (<class 'skzpipe.parameters.classes.fileclass.basefile.IdXY'>, <class 'skzpipe.parameters.classes.bclasses.GenStructData'>, <class 'object'>)

EDIT: GenStructData has a __init__

class GenStructData():
    _dtype_names=((), ());
    _dtype_datanames=None;
    _dtype_nlines=len(_dtype_names);
    _dtype_formats=((), )*_dtype_nlines;
    _dtype_nfield=tuple(len(x) for x in _dtype_names);
    _dtype_delimiter=(None,)*_dtype_nlines;
    _str_format=("", "");
    _str_len=(None, None);

  ###__INIT__###
    def _check_def(self, check_value=True):
      pass;

  def __init__(self, data=None, check_default=True, attributes=None):
    """An object from multi-lined structured data. This is not a class for direct use.""";
    _name_='GenStructData object';
    if(data is None or not isinstance(data,(str,list,tuple,GenStructData,numpy.ndarray))):
       raise TypeError(_name_+": Wrong type for `data` to create the object <{data}>".format(data=data));
    if(not self._dtype_datanames): 
      self._dtype_datanames=self._dtype_names;
    self._check_def(check_value=check_default);
    [...]

Answer

The cause was a no pythonic way to solve an Attribute Error caused by nested imports.

bclasses.py (where GenStructData is defined) started with

"""Generic classes.""";

 import os, re, math, io, copy;
 import multiprocessing as multiprc;
 import psutil, numpy;
 from sys import stdout, stderr;

 #Predefinition to avoid Attribute Error
 class GenStructData:
   pass;


 from ...exceptions import *
 from .. import basicpar as bpar
 from .. import options as _opt
 from ... import functions as funct

Moving from ... import functions as funct inside the 2 part of the code that use it (as it should be done, actually) and removing the empty definition solved the problem

skzpipe.parameters.classes.fileclass.basefile.IdXY(“1 2 3”)
1 2.000000 3.000000

issubclass(skzpipe.parameters.classes.fileclass.basefile.IdXY,skzpipe.parameters.classes.bclasses.GenStructData)
True

The initial empty definition somehow messed up with the internal structure.
The anomaly is that also IdXY has a empty predefinition but its __init__ was called correctly