Skip to content

fix poll_url in Python 3 - #370

Merged
KazuCocoa merged 1 commit into
appium:masterfrom
KazuCocoa:fix-poll-url
May 9, 2019
Merged

KazuCocoa merged 1 commit into
appium:masterfrom
KazuCocoa:fix-poll-url

Conversation

@KazuCocoa

Copy link
Copy Markdown
Member

closes #369

httplib is available only in Python 2 environment.
SImply, I replaced the http request checking with PoolManager.

I tested locally in both Python 2 and 3 env.
Added a simple test case to ensure it can load in both python 2 and 3 environments.

@KazuCocoa
KazuCocoa merged commit bcccf0b into appium:master May 9, 2019
@KazuCocoa
KazuCocoa deleted the fix-poll-url branch May 9, 2019 13:12
@johnkulovitz

johnkulovitz commented May 9, 2019 •

Copy link
Copy Markdown

Thanks for doing this fix! I'm getting a new error, however. The join function used in this seems to be giving an error about mixing strings and bytes in path components. I'll put my pytest error output below, and I can give any extra information you may need!

Edit: I fixed this issue by casting the module arg of the join to a string. Not sure if this is just a local issue for me, but glad it's working now. Thanks so much!

../../Library/Python/3.7/lib/python/site-packages/appium/webdriver/appium_service.py:158: in start
main_script = kwargs['main_script'] if 'main_script' in kwargs else self._get_main_script()
../../Library/Python/3.7/lib/python/site-packages/appium/webdriver/appium_service.py:92: in _get_main_script
if os.path.exists(os.path.join(modules_root, MAIN_SCRIPT_PATH)):
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py:94: in join
genericpath._check_arg_types('join', a, *p)


funcname = 'join', args = (b'/usr/local/lib/node_modules', 'appium/build/lib/main.js'), hasstr = True, hasbytes = True, s = 'appium/build/lib/main.js

def _check_arg_types(funcname, *args):
    hasstr = hasbytes = False
    for s in args:
        if isinstance(s, str):
            hasstr = True
        elif isinstance(s, bytes):
            hasbytes = True
        else:
            raise TypeError('%s() argument must be str or bytes, not %r' %
                            (funcname, s.__class__.__name__)) from None
    if hasstr and hasbytes:
      raise TypeError("Can't mix strings and bytes in path components") from None

E TypeError: Can't mix strings and bytes in path components

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/genericpath.py:151: TypeError

@mykola-mokhnach

Copy link
Copy Markdown
Contributor

@johnkulovitz Please report this as a separate bug

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

Successfully merging this pull request may close these issues.

Fix broken appium_service in Python 3

3 participants