Skip to content

Commit

Permalink
Fix prettyprint loading as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarst committed Mar 20, 2019
1 parent fc8deec commit 92e1e2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions eliot/prettyprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ def _nicer_unicode_repr(o, original_repr=repr):
else:
return original_repr(o)

pprint = load_module(b"unicode_pprint", pprint)
pprint.repr = _nicer_unicode_repr
try:
pprint = load_module(b"unicode_pprint", pprint)
pprint.repr = _nicer_unicode_repr
except NotImplementedError:
# Oh well won't have nicer output.
import pprint


# Fields that all Eliot messages are expected to have:
REQUIRED_FIELDS = {TASK_LEVEL_FIELD, TASK_UUID_FIELD, TIMESTAMP_FIELD}
Expand Down
2 changes: 1 addition & 1 deletion eliot/tests/test_pyinstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_importable(self):
"""The Eliot package can be imported inside a PyInstaller packaged binary."""
output_dir = mkdtemp()
with NamedTemporaryFile(mode="w") as f:
f.write("import eliot\n")
f.write("import eliot; import eliot.prettyprint\n")
f.flush()
check_call(
["pyinstaller", "--distpath", output_dir,
Expand Down

0 comments on commit 92e1e2f

Please sign in to comment.