4711: "putch() argument 1 must be char, not unicode" when authenticating


What version are you running?

RBTools 1.0, Python 3.6.5

What steps will reproduce the problem?

  1. Delete .rbtools-cookies
  2. Run rbt post
  3. Enter username

What is the expected output? What do you see instead?

Expected output would be prompting to enter password.
Actual output is "putch() argument 1 must be char, not unicode"

What operating system are you using?

Windows 7

Attach the debug out from the command.

C:\eclipse_workspace>rbt post -o --debug
>>> RBTools 1.0
>>> Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit
>>> Running on Windows-7-6.1.7601-SP1
>>> Home = C:\Users\cascara01\AppData\Roaming
>>> Current directory = C:\eclipse_workspace
>>> Command line: rbt post -o --debug
>>> Running: tf vc help
>>> Checking for a Subversion repository...
>>> Running: svn --non-interactive info
>>> Running: diff --version
>>> Running: svn --non-interactive --version -q
>>> Repository info: Path: http://visualsvn.{company}.co.uk/svn/280, Base path: /t
runk, Supports changesets: False
>>> Making HTTP GET request to https://reviewboard.{company}.co.uk/api/

Please log in to the Review Board server at reviewboard.{company}.co.uk.
Username: CascarA01
Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", l
ine 11, in <module>
    load_entry_point('RBTools==1.0', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\commands\main.py", line 120, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\commands\__init__.py", line 720, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\commands\post.py", line 758, in main
    api_client, api_root = self.get_api(server_url)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\commands\__init__.py", line 899, in get_api
    api_root = api_client.get_root()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\client.py", line 21, in get_root
    return self._transport.get_root(*args, **kwargs)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\transport\sync.py", line 49, in get_root
    return self._execute_request(HttpRequest(self.server.url))
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\transport\sync.py", line 86, in _execute_request
    rsp = self.server.make_request(request)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\request.py", line 601, in make_request
    request.url, body, headers, request.method))
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 154, in ur
    return opener.open(url, data, timeout)
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 435, in op
    response = meth(req, response)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\request.py", line 239, in http_response
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 467, in er
    result = self._call_chain(*args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 407, in _c
    result = func(*args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 909, in ht
    url, req, headers)
  File "C:\Program Files (x86)\RBTools\Python27\lib\urllib2.py", line 887, in ht
    return self.retry_http_basic_auth(host, req, realm)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\request.py", line 281, in retry_http_basic_auth
    response = self._do_http_basic_auth(host, request, realm)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\request.py", line 289, in _do_http_basic_auth
    user, password = self.passwd.find_user_password(realm, host)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\api\request.py", line 358, in find_user_password
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-1.0-py
2.7.egg\rbtools\commands\__init__.py", line 831, in credentials_prompt
    password = getpass.getpass('Password: ')
  File "C:\Program Files (x86)\RBTools\Python27\lib\getpass.py", line 95, in win
TypeError: putch() argument 1 must be char, not unicode

Please provide any additional information below.

I clean uninstalled RBTools 0.7 and installed RBTools 1.0 earlier today - this functionality worked on 0.7 but fails on 1.0.
It looks like RBTools is using its bundled Python 2.7 distribution but the latest RBTools release documents its compatibility with Python 3 - as string/unicode issues are common in Python 2/3 mixups is it likely that this is a Python compatibility issue?

#1 chipx86

Very likely. There's a handful of functions that are not flexible with string types in both generations of Python, and we expected to hit a few like this. We'll get this one fixed up. Probably just need to cast to the appropriate string type on each platform (str('Password: ')).

  • -New
  • +david
#2 ACascarino

Out of interest is there documentation on the testing and release process for RBTools? I'm just aware that this isn't a minor bug, and indeed hits every new user - is there anywhere I can help at all? I've a reasonable amount of experience with testing strategies and CI and would be happy to dive in if there's somewhere I can help out :)

#3 chipx86

There's no public document for this, but we've tested all the commands and have been dogfooding this for many months. This particular issue occurs only on Windows, though (which has its own very annoying and specific characteristics when it comes to string types), and as we're primarily doing development on Linux/Mac, we haven't hit this issue ourselves.

#4 david

Fixed in release-1.0.x (82ce727). This will ship in 1.0.1. Thanks!

  • -Confirmed