Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherited classes not initialized properly in Python3 when constructor uses super() #921

Closed
ygorelik opened this issue May 17, 2019 · 1 comment

Comments

@ygorelik
Copy link
Collaborator

Current Behavior

Inherited classes are not initialized properly in Python3 when constructor uses super().

Example from errors.py:

class YServiceError(YError):
    '''
    Exception for Service Side Validation
    '''
    def __init__(self, error_code=None, error_msg=None):
        super(YServiceError, self).__init__(
            error_code=error_code, error_msg=error_msg)

This code works fine in Python2, but python3 requires different syntax:

class YServiceError(YError):
    '''
    Exception for Service Side Validation
    '''
    def __init__(self, error_code=None, error_msg=None):
        super().__init__(
            error_code=error_code, error_msg=error_msg)

System Information

YDK-0.5.5 and YDK-0.8.3

@dasomeom
Copy link

dasomeom commented Jul 30, 2019

This was also noted in Python 3.7.3 virtual environment on Mac platform.
The error log:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1758, in <module>
    main()
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1752, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1147, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/deom/gnmi-client/run.py", line 6, in <module>
    cli.main()
  File "/Users/deom/gnmi-client/gnmi_client/cli.py", line 15, in main
    return client.main()
  File "/Users/deom/gnmi-client/gnmi_client/gnmi_client.py", line 386, in main
    self.connect_to_device()
  File "/Users/deom/gnmi-client/gnmi_client/logger.py", line 24, in wrapper
    return_val = func(*args, **kwargs)
  File "/Users/deom/gnmi-client/gnmi_client/gnmi_client.py", line 319, in connect_to_device
    self.provider = gNMISession(repo, "domingo", 57400, "admin", "admin")
  File "/Users/deom/v3/lib/python3.7/site-packages/ydk/gnmi/path/gnmi_session.py", line 39, in __init__
    server_certificate, private_key)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. ydk_gnmi_.path.gNMISession(repo: ydk::path::Repository, address: str, port: int, username: str, password: str, server_certificate: str='', private_key: str='')

Invoked with: <ydk_.path.Repository object at 0x106863960>, 'domingo', 57400, 'admin', 'admin', '', ''

ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue Aug 29, 2019
ygorelik pushed a commit to ygorelik/ydk-gen that referenced this issue Sep 4, 2019
@ygorelik ygorelik closed this as completed Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants