|
New ticket
#4954
by
mark.falconer
For
Beanbag, Inc.
▸
RBTools
rbtools 2.0 does not read .reviewboardrc with encoding UTF8-BOM
What version are you running?
RBTools 2.0.1 (Python 3.8.10)
What steps will reproduce the problem?
- On Windows, add a .reviewboardrc to a repository using notepad.
- run rbt post to post a diff
What is the expected output? What do you see instead?
Expected: The diff is posted
Actual: The diff fails
What operating system are you using?
Win10
Attach the debug out from the command.
$ rbt post --debug
Traceback (most recent call last):
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\utils\filesystem.py", line 220, in parse_config_file
config = _load_python_file(filename, config)
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\utils\filesystem.py", line 52, in _load_python_file
exec(compile(f.read(), filename, 'exec'), config)
File "D:\Workspace\DataNG Documents\.reviewboardrc", line 1
REVIEWBOARD_URL = 'http://dev-revbrd01.hrh.local/'
^
SyntaxError: invalid character in identifier
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\RBTools\bin\..\Python\Scripts\rbt-script.py", line 33, in <module>
sys.exit(load_entry_point('RBTools==2.0.1', 'console_scripts', 'rbt')())
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\commands\main.py", line 124, in main
command.run_from_argv([RB_MAIN, command_name] + args)
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\commands\__init__.py", line 744, in run_from_argv
parser = self.create_arg_parser(argv)
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\commands\__init__.py", line 731, in create_arg_parser
self.config = load_config()
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\utils\filesystem.py", line 250, in load_config
parsed_config = parse_config_file(filename)
File "C:\Program Files\RBTools\Python\lib\site-packages\rbtools-2.0.1-py3.8.egg\rbtools\utils\filesystem.py", line 222, in parse_config_file
raise Exception('Syntax error in config file: %s\n'
Exception: Syntax error in config file: D:\Workspace\DataNG Documents\.reviewboardrc
Line 1 offset 18
Please provide any additional information below.
Notepad creates files with encoding UTF8-BOM. Changing the encoding to remove the BOM works. Creating the file using rbt works.
I am raising this for 2 reasons:
-
The documentation states that .reviewboardrc should be a valid python file. Running "C:\Program Files\RBTools\Python\python" .reviewboardrc completes successfully (i.e. does nothing, but no errors), indicating that it is.
-
RBTools versions before 2.0 worked successfully.
I think the config file should be read with encoding utf-8-sig
https://www.howtosolutions.net/2019/04/python-fixing-unexpected-utf-8-bom-error-when-loading-json-data/
New
Priority:Medium
Type:Defect
|