Skip to content

fix UnicodeEncodeError raised from run_cmd with Python 2.7#2801

Merged
vanzod merged 6 commits intoeasybuilders:4.xfrom
boegel:run_cmd_fix_log_output_non_utf8
Mar 7, 2019
Merged

fix UnicodeEncodeError raised from run_cmd with Python 2.7#2801
vanzod merged 6 commits intoeasybuilders:4.xfrom
boegel:run_cmd_fix_log_output_non_utf8

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Mar 6, 2019

Fix for this issues that occurred when installing libreadline on top of Python 2.7.5 when using 4.x branch and eb --trace libreadline-7.0-GCCcore-7.3.0.eb:

== installing...
  >> running command:
	[started at: 2019-03-06 08:33:27]
	[output logged in /tmp/eb-Tmn2Kx/easybuild-run_cmd-6ll1rS.log]
	make install
ERROR: Traceback (most recent call last):
  File "/home/kehoste/easybuild-framework/easybuild/main.py", line 112, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
  File "/home/kehoste/easybuild-framework/easybuild/framework/easyblock.py", line 2861, in build_and_install_one
    result = app.run_all_steps(run_test_cases=run_test_cases)
  File "/home/kehoste/easybuild-framework/easybuild/framework/easyblock.py", line 2771, in run_all_steps
    self.run_step(step_name, step_methods)
  File "/home/kehoste/easybuild-framework/easybuild/framework/easyblock.py", line 2637, in run_step
    step_method(self)()
  File "/home/kehoste/easybuild-easyblocks/easybuild/easyblocks/generic/configuremake.py", line 294, in install_step
    (out, _) = run_cmd(cmd, log_all=True, simple=False)
  File "/home/kehoste/easybuild-framework/easybuild/tools/run.py", line 88, in cache_aware_func
    res = func(cmd, *args, **kwargs)
  File "/home/kehoste/easybuild-framework/easybuild/tools/run.py", line 217, in run_cmd
    cmd_log.write(output)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4570-4572: ordinal not in range(128)

This problem was reproduced in the tests before fixing the issue...

@boegel boegel added bug fix python3 Python 3 compatibility labels Mar 6, 2019
@boegel boegel added this to the 4.0 milestone Mar 6, 2019
Comment thread easybuild/tools/run.py
Comment thread test/framework/run.py Outdated
Comment thread test/framework/run.py Outdated
Comment thread test/framework/run.py Outdated
Comment thread test/framework/run.py Outdated
@vanzod vanzod merged commit 0981a1b into easybuilders:4.x Mar 7, 2019
@boegel boegel deleted the run_cmd_fix_log_output_non_utf8 branch March 7, 2019 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix python3 Python 3 compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants