3729: Cannot run rbt post in RBTools 0.7.0

tanis*****@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
March 12, 2015
What version are you running?
RBTools 0.7

What's the URL of the page containing the problem?
rbt post

What steps will reproduce the problem?
(I think you have to set some unicode strings to the environment variables to reproduce this problem)
1. rbt post

What is the expected output? What do you see instead?
CRITICAL: environment can only contain strings

What operating system are you using? What browser?
Windows 7 SP1

Please provide any additional information below.
As the attachments.
#1 bruce*****@gmai***** (Google Code) (Is this you? Claim this profile.)
I'm seeing this as well: I'm running Windows 8.1 Update.
If I rename the svn binary, then it tries to run "hg root" and fails instead.
#2 JustinP*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Ditto, also Windows 8.1. I saw it after using easy_install as well as after using the new self-contained installer. Thanks for the latter, btw! The error message I receive is actually: "CRITICAL: environment can only contain strings".
chipx86
#3 chipx86
Can someone try changing these lines in rbtools/utils/process.py:

    env['LC_ALL'] = 'en_US.UTF-8'
    env['LANGUAGE'] = 'en_US.UTF-8'

to:

    env[b'LC_ALL'] = b'en_US.UTF-8'
    env[b'LANGUAGE'] = b'en_US.UTF-8'

See if that works. We'll then get a fix into the next release.
  • +NeedInfo
  • +Project-RBTools
    +Component-RBTools
    +Milestone-RBTools-Release0.8.x
#4 JustinP*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Different error message results: "CRITICAL: must be char, not unicode".
chipx86
#5 chipx86
Can you show the stack trace with that error?
#6 JustinP*******@gmai***** (Google Code) (Is this you? Claim this profile.)
>rbt post -d -g
>>> RBTools 0.7
>>> Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
>>> Running on Windows-8-6.2.9200
>>> Home = ...
>>> Current directory = ...
>>> Checking for a Subversion repository...
>>> Running: svn info --non-interactive
>>> Command exited with rc 1: ['svn', 'info', '--non-interactive']
svn: E155007: '...' is not a working copy
---
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Command exited with rc 1: ['git', 'config', 'core.bare']
---
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch...merge
>>> Running: git config --get branch...remote
>>> Running: git config --get remote.origin.url
>>> repository info: Path: ..., Base path: , Supports changesets: False
>>> Making HTTP GET request to http://.../reviews/api/

==> HTTP Authentication Required
Enter authorization information for "Web API" at ...
Traceback (most recent call last):
  File "C:\Python27\Scripts\rbt-script.py", line 9, in <module>
    load_entry_point('RBTools==0.7', 'console_scripts', 'rbt')()
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\main.py", line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", line 538, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\post.py", line 583, in main
    api_client, api_root = self.get_api(server_url)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", line 681, in get_api
    api_root = api_client.get_root()
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\client.py", line 18, in get_root
    return self._transport.get_root(*args, **kwargs)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\transport\sync.py", line 37, in get_root
    return self._execute_request(HttpRequest(self.server.url))
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\transport\sync.py", line 71, in _execute_request
    rsp = self.server.make_request(request)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\request.py", line 517, in make_request
    rsp = self._cache.make_request(r)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\cache.py", line 261, in make_request
    response = HTTPResponse(self.urlopen(request))
  File "C:\Python27\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 402, in open
    req = meth(req)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\request.py", line 184, in http_request
    self.password_mgr.find_user_password('Web API', self.url)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\api\request.py", line 331, in find_user_password
    password=self.rb_pass)
  File "C:\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", line 625, in credentials_prompt
    password = getpass.getpass('Password: ')
  File "C:\Python27\lib\getpass.py", line 95, in win_getpass
    msvcrt.putch(c)
TypeError: must be char, not unicode
#7 michael********@activee******** (Google Code) (Is this you? Claim this profile.)
see same issue -
Windows 7 PC, Python 2.7...

>rbt --version
RBTools 0.7

rbt status
CRITICAL: environment can only contain strings

>rbt status -d
>>> RBTools 0.7
>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>> Running on Windows-7-6.1.7601-SP1
>>> Home = C:\Users\xxxxx
>>> Current directory = xxxxxxx
>>> Checking for a Subversion repository...
>>> Unable to execute "svn help": skipping SVN
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", line 8, in <module>
    load_entry_point('RBTools==0.7', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\main.py", line
133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", l
ine 538, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\status.py", lin
e 37, in main
    client_name=self.options.repository_type)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", l
ine 566, in initialize_scm_tool
    client_name=client_name)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\clients\__init__.py", li
ne 385, in scan_usable_client
    repository_info = tool.get_repository_info()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\clients\git.py", line 16
6, in get_repository_info
    ignore_errors=True).rstrip("\n")
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\utils\process.py", line
65, in execute
    env=env)
  File "C:\Program Files (x86)\RBTools\Python27\lib\subprocess.py", line 709, in __init__
    errread, errwrite)
  File "C:\Program Files (x86)\RBTools\Python27\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
TypeError: environment can only contain strings

chipx86
#8 chipx86
@JustinPalmer77: Can you also try modifying rbtools/commands/__init__.py, line 625 (ish), and changing:

    return getpass.getpass('Password: ')

to:

    return getpass.getpass(b'Password: ')
#9 jeffrey.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Windows 7 x64, same problem, etc. With your latest suggestion from this morning (getpass.getpass), I can now successfully "rbt post". Thanks!
#10 JustinP*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Your latest suggestion resolves the defect for me as well. I eagerly await next release when I can tell people to use new installer.
chipx86
#11 chipx86
We'll try to get a release out shortly. Thanks for the testing and patience. Let me know if you notice any further issues related to this.
#12 michael********@activee******** (Google Code) (Is this you? Claim this profile.)
Now have this...

>rbt status
WARNING: You are not authenticated with the Review Board server at http://review.xx.xx, please login.
Username: aaaaaa.bbbbbb
CRITICAL: must be char, not unicode
chipx86
#13 chipx86
Can you provide a debug log (use --debug)
#14 michael********@activee******** (Google Code) (Is this you? Claim this profile.)
>rbt status -d
>>> RBTools 0.7
>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>> Running on Windows-7-6.1.7601-SP1
>>> Home = C:\Users\michael.killeen\AppData\Roaming
>>> Current directory = E:\repo_xxx
>>> Checking for a Subversion repository...
>>> Running: svn info --non-interactive
>>> Running: diff --version
>>> repository info: Path: https://cylondc:8443/svn/Firmware, Base path: /stm32, Supports changesets: False
>>> Making HTTP GET request to http://review.xxx.lan/api/
>>> Cached response for HTTP GET http://review.xxx.lan/api/ expired and was not modified
>>> Making HTTP GET request to http://review.xxx.lan/api/session/
>>> Cached response for HTTP GET http://review.xxx.lan/api/session/ expired and was modified
WARNING: You are not authenticated with the Review Board server at http://review.xxx.lan, please login.
Username: michael.killeen
Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", line 8, in <module>
    load_entry_point('RBTools==0.7', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\main.py", line
133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\__init__.py", l
ine 538, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\commands\status.py", lin
e 41, in main
    username = get_username(api_client, api_root, auth_required=True)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\utils\users.py", line 51
, in get_username
    session = get_authenticated_session(api_client, api_root, auth_required)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7-py2.7.egg\rbtools\utils\users.py", line 30
, in get_authenticated_session
    password = getpass.getpass('Password: ')
  File "C:\Program Files (x86)\RBTools\Python27\lib\getpass.py", line 95, in win_getpass
    msvcrt.putch(c)
TypeError: must be char, not unicode
chipx86
#15 chipx86
I've fixed several other issues on Windows. See https://reviews.reviewboard.org/r/6898/
  • -NeedInfo
    +PendingReview
  • +chipx86
#16 brandon*******@gmai***** (Google Code) (Is this you? Claim this profile.)
fyi, i had the same issue yesterday and today with the reported version. glad to see these things are aligning
chipx86
#17 chipx86
@brandon: Can you give 0.7.1 a try and see if it's working for you now?
  • -PendingReview
    +NeedInfo
#18 oda****@gmai***** (Google Code) (Is this you? Claim this profile.)
I have the same error on Win 7 when I'm trying to add a repository via the reviewboard admin page. I have checked the __init__.py file and the change is in the version I have, but I don't think this is relevant when using the reviewboard web app?
I cannot add a repository at the moment which is stopping me going further.
david
#19 david
The given error is coming from RBTools, so it's impossible to get the same one when trying to add a repository. Please open a separate bug.
david
#20 david
I'm going to assume that we cleaned up the last of these in 0.7.2. Please comment if not.
  • -NeedInfo
    +Fixed
#21 luoyo******@gmai***** (Google Code) (Is this you? Claim this profile.)
>>> Making HTTP GET request to https://reviewboard.mozilla.org/api/validation/diffs/
>>> Making HTTP POST request to https://reviewboard.mozilla.org/api/validation/diffs/
Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", line 8, in <module>
    load_entry_point('RBTools==0.7.2', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\main.py", line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\__init__.py", line 555, in run_from_argv
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\post.py", line 690, in main
    **validate_kwargs)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\decorators.py", line 27, in request_method
    *args, **kwargs)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\transport\sync.py", line 65, in execute_request_method
    return self._execute_request(request)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\transport\sync.py", line 74, in _execute_request
    rsp = self.server.make_request(request)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\request.py", line 521, in make_request
    content_type, body = request.encode_multipart_formdata()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\request.py", line 110, in encode_multipart_formdata
    mime_type = mimetypes.guess_type(filename)[0]
  File "C:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 297, in guess_type
    init()
  File "C:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 358, in init
    db.read_windows_registry()
  File "C:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "C:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)
#23 jyx1*****@gmai***** (Google Code) (Is this you? Claim this profile.)
$ rbt post -g --debug
>>> RBTools 0.7.2
>>> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
>>> Running on Windows-7-6.1.7601-SP1
>>> Home = C:\Users\jiayinxi\AppData\Roaming
>>> Current directory = d:\gitlab\comptest\testagent-wrap
>>> Checking for a Subversion repository...
>>> Unable to execute "svn help": skipping SVN
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git config --get remote.origin.url
>>> repository info: Path: git@gitlab.testbird.io:comptest/testagent-wrap.git, Base path: , Supports changesets: False
>>> Running: git config --get reviewboard.url
>>> Making HTTP GET request to http://reviewboard.testbird.io/api/
>>> Running: git rev-parse refs/heads/master
>>> Running: git merge-base a4eba8ce40cd4795c19e6bec6daf432bff7936a6 origin/master
>>> Running: git rev-parse df81c67a1249ca48dc6634440a1b5b7d411a104c
>>> Running: git status --porcelain --untracked-files=no
>>> Running: git rev-parse --git-dir
>>> Running: git -c core.quotepath=false -c diff.noprefix=false diff --no-color --full-index --ignore-submodules -M --no-ext-diff df81c67a1249ca48dc6634440a1b5b7d411a104c..a4eba8ce40cd4795c19e6bec6daf432bff7936a6
>>> Running: git log --reverse --pretty=format:%s%n%n%b ^df81c67a1249ca48dc6634440a1b5b7d411a104c a4eba8ce40cd4795c19e6bec6daf432bff7936a6
>>> Making HTTP GET request to http://reviewboard.testbird.io/api/review-requests/?only-links=create&only-fields=
>>> Making HTTP POST request to http://reviewboard.testbird.io/api/review-requests/
>>> Making HTTP GET request to http://reviewboard.testbird.io/api/review-requests/566/diffs/?only-fields=
>>> Making HTTP POST request to http://reviewboard.testbird.io/api/review-requests/566/diffs/
Traceback (most recent call last):
  File "c:/Program Files (x86)/RBTools/bin/../Python27/Scripts/rbt-script.py", line 8, in <module>
    load_entry_point('RBTools==0.7.2', 'console_scripts', 'rbt')()
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\main.py", line 133, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\__init__.py", line 555, in run_from_argv
    exit_code = self.main(*args) or 0
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\post.py", line 745, in main
    base_dir=base_dir)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\post.py", line 434, in post_request
    diff_content, **diff_kwargs)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\decorators.py", line 27, in request_method
    *args, **kwargs)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\transport\sync.py", line 65, in execute_request_method
    return self._execute_request(request)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\transport\sync.py", line 74, in _execute_request
    rsp = self.server.make_request(request)
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\request.py", line 521, in make_request
    content_type, body = request.encode_multipart_formdata()
  File "c:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\api\request.py", line 110, in encode_multipart_formdata
    mime_type = mimetypes.guess_type(filename)[0]
  File "c:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 297, in guess_type
    init()
  File "c:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 358, in init
    db.read_windows_registry()
  File "c:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "c:\Program Files (x86)\RBTools\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)
#24 pierre******@gmai***** (Google Code) (Is this you? Claim this profile.)
I have encountered the same issue with RBTools 0.7.2 on window 7 64 bit when running the command "rbt diff -d" from command line.
Does anyone able to provide a general fix, I have seen many folks complaining about that.
...
Traceback (most recent call last):
  File "C:\Program Files (x86)\RBTools\bin\..\Python27\Scripts\rbt-script.py", line 8, in <module>
    load_entry_point('RBTools==0.7.2', 'console_scripts', 'rbt')()
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\main.py"
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\__init__
    exit_code = self.main(*args) or 0
  File "C:\Program Files (x86)\RBTools\Python27\lib\site-packages\rbtools-0.7.2-py2.7.egg\rbtools\commands\diff.py"
    print(diff)
  File "C:\Program Files (x86)\RBTools\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\ufeff' in position 654: character maps to <undefined>