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

Invalid version #906

Closed
UzairJerry opened this issue Aug 23, 2023 · 10 comments
Closed

Invalid version #906

UzairJerry opened this issue Aug 23, 2023 · 10 comments

Comments

@UzairJerry
Copy link

UzairJerry commented Aug 23, 2023

whenever i start uiautomator for the first time its works fine but after that it gives me invalid version error so when i uninstall atx app and retry it works fine ... i have to uninstall atx app everytime now

photo_2023-08-23_11-42-32

/usr/local/bin/python3.11 /Users/itiesoft/PycharmProjects/finance-bot/test/test_mb.py
[D 230824 12:56:54 init:661] [pid:7776] [5477ce91] kill process(ps): uiautomator
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 486, in _jsonrpc_retry_call
return self._jsonrpc_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 519, in _jsonrpc_call
raise GatewayError(
uiautomator2.exceptions.GatewayError: (<Response [502]>, 'gateway error, time used 0.0s')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/itiesoft/PycharmProjects/finance-bot/test/test_mb.py", line 66, in
d.xpath(password).wait(timeout=60)
File "/usr/local/lib/python3.11/site-packages/uiautomator2/xpath.py", line 559, in wait
if self.exists:
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/xpath.py", line 508, in exists
return len(self.all()) > 0
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/xpath.py", line 449, in all
xml_content = source or self._source or self._parent.dump_hierarchy()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/xpath.py", line 178, in dump_hierarchy
self._last_source = self._d.dump_hierarchy()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/retry/api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/retry/api.py", line 33, in __retry_internal
return f()
^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 978, in dump_hierarchy
content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 479, in call
return self.server._jsonrpc_retry_call(self.method, params,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 488, in _jsonrpc_retry_call
self.reset_uiautomator(str(e)) # uiautomator可能出问题了,强制重启一下
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 640, in reset_uiautomator
ok = self._force_reset_uiautomator_v2(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 667, in _force_reset_uiautomator_v2
if self._is_apk_required():
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 711, in _is_apk_required
if self._package_version("com.github.uiautomator.test") is None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uiautomator2/init.py", line 735, in _package_version
return packaging.version.parse(m.group('name') if m else "")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/packaging/version.py", line 52, in parse
return Version(version)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/packaging/version.py", line 198, in init
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: ''

Process finished with exit code 1

@clacknya
Copy link

same problem with python 3.11

@liaozd
Copy link

liaozd commented Sep 16, 2023

same here, python3.11, and in ubuntu 23.04

@clacknya
Copy link

I found the solution: downgrading to uiautomator2-2.16.23 could fix it, which depends on packaging-20.9.

@limerick1718
Copy link

I found the solution: downgrading to uiautomator2-2.16.23 could fix it, which depends on packaging-20.9.

For me, cannot fix…… Any updates or other solutions?

@wrzssz
Copy link

wrzssz commented Sep 27, 2023

也可以这样

pip install packaging==21.3

或者降低uiautomator2的版本,或者降低packaging版本

@limerick1718
Copy link

也可以这样

pip install packaging==21.3

或者降低uiautomator2的版本,或者降低packaging版本

是的!我发现了!解决办法就是这个!

@iTheCreep
Copy link

也可以这样

pip install packaging==21.3

或者降低uiautomator2的版本,或者降低packaging版本

神医啊,成功解决!

@codeskyblue
Copy link
Member

fixed

@vinhomesoceanpark
Copy link

vinhomesoceanpark commented Apr 28, 2024

I am also suffering from this condition. I have downgraded the packaging to 20.9 or downgraded uiautomator2 but the problem still persists. Hope you check it out
Screenshot 2024-04-28 115811

@codeskyblue
Copy link
Member

uiautomator2 3.x fixed. Because the packaging lib is removed completely

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

8 participants