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

Library import to robot failing when python3.11 used #117

Open
pawezka opened this issue Apr 26, 2024 · 1 comment
Open

Library import to robot failing when python3.11 used #117

pawezka opened this issue Apr 26, 2024 · 1 comment

Comments

@pawezka
Copy link
Contributor

pawezka commented Apr 26, 2024

There is a error during importing library on python3.11:

[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'system_exit' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'start_application' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'application_started' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'switch_to_application' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'ensure_application_should_close' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'log_java_system_properties' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'set_java_tool_options' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'
[ ERROR ] Error in library 'RemoteSwingLibrary': Adding keyword 'reinitiate' failed: Calling dynamic method 'get_keyword_arguments' failed: AttributeError: module 'inspect' has no attribute 'getargspec'

It is because of:

    def _get_args(self, method_name):
        spec = inspect.getargspec(getattr(self, method_name))
        args = spec[0][1:]
        if spec[3]:
            for i, item in enumerate(reversed(spec[3])):
                args[-i - 1] = args[-i - 1] + '=' + str(item)
        if spec[1]:
            args += ['*' + spec[1]]
        if spec[2]:
            args += ['**' + spec[2]]
        return args

getargspec method was deprecated since python3.0 and was removed in python3.11:
https://docs.python.org/3/whatsnew/3.11.html

@pawezka
Copy link
Contributor Author

pawezka commented Jun 27, 2024

#118

this pull request should fix this issue on python 3.11

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

1 participant