MarketSquare / MarketSquare/remoteswinglibrary

Library import to robot failing when python3.11 used

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
32
Forks
41
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the _get_args method shown in the issue and inspect how RemoteSwingLibrary discovers keyword arguments. Verify the behavior under Python 3.11 and confirm that importing the library registers the listed keywords without errors; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.