Code Monkey home page Code Monkey logo

Comments (14)

tonybaloney avatar tonybaloney commented on June 25, 2024 1

I can reverse the fix so I guess that counts as squashing the bug!
From future import Unicode literals is a bad idea. That is the gist of it

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024 1

Issue raised in tox. Code update submitted in tox-dev/tox#724 and merged into master. Expected in 2.9.2 release

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Tracked down to the _change_colour method inside asciimatics causing the issue. The stdout.write method is being sent bytes instead of a str.

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Raised related peterbrittain/asciimatics#129

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

After discussion with the asciimatics team, it is not a problem with asciimatics, that is a red-herring.

Noticed this issue in the Tox queue which is the exact issue I'm having. Except I've redirected tw to my own mock interface, so I can't see why it's trying to write anything to the console anyway.
tox-dev/tox#426

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Summarising the Tox bug discussion, this is fixed if you don't try and run badly configured environments from Python 3 virtualenv.
So, if anyone else hit's this issue, try specifying -e py27,py36 as the environments, instead of trying to build all and see if that fixes it.

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Resolved in 1.3.0, related to unicode formatting of substrings

from retox.

pquentin avatar pquentin commented on June 25, 2024

I've been following the bug and would be interested to understand what the actual issue was? Why can't we have nice things like ✓ and ✗? Was it a bug in Python 3.6 itself? Was it important to read the code of the standard library? Thanks!

from retox.

bstpierre avatar bstpierre commented on June 25, 2024

I'm hitting what looks like the same or very similar issue with retox-1.3.1, tox-2.9.1, and python-3.5.2

  File "/home/brian/.virtualenvs/mypy/bin/retox", line 11, in <module>
    sys.exit(main())
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/__main__.py", line 86, in main
    screen.clear()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1231, in clear
    self._change_colours(Screen.COLOUR_WHITE, 0, 0)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2222, in _change_colours
    self._safe_write(self._a_normal)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

@bstpierre can you share your tox.ini file, try specifying only a specific python version with -e and also share your log

from retox.

bstpierre avatar bstpierre commented on June 25, 2024

It doesn't crash if I use retox -e py35.

tox.ini:

envlist = py35, style, docs

[testenv]
setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/deploy
deps =
    -r{toxinidir}/requirements.txt
    pytest
commands =
    py.test --basetemp={envtmpdir}

[testenv:style]
deps =
    -r{toxinidir}/requirements.txt
    flake8
commands =
    flake8 {toxinidir}/test/
    flake8 deploy/
    
[testenv:docs]
changedir=docs/
deps =
    -r{toxinidir}/requirements.txt
    sphinx
commands =
    sphinx-build -b html ./ _build/

retox.log from a failed run, via rm -rf .tox retox.log; retox

 
 
 
 ---- Starting new test run ----
tox: py35 create: /home/brian/projects/deploy/.tox/py35
tox: GLOB sdist-make: /home/brian/projects/deploy/setup.py
tox: style create: /home/brian/projects/deploy/.tox/style
tox: docs create: /home/brian/projects/deploy/.tox/docs
tox: py35 installdeps: -r/home/brian/projects/deploy/requirements.txt, pytest
tox: style installdeps: -r/home/brian/projects/deploy/requirements.txt, flake8
tox: docs installdeps: -r/home/brian/projects/deploy/requirements.txt, sphinx
!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 67, in logaction_start
    self.env_frames[action.venv.name].start(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 244, in start
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes

tox: style inst: /home/brian/projects/deploy/.tox/dist/deploy-0.1.0.zip
tox: py35 inst: /home/brian/projects/deploy/.tox/dist/deploy-0.1.0.zip
!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 74, in logaction_finish
    self.env_frames[action.venv.name].stop(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 261, in stop
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes

!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 67, in logaction_start
    self.env_frames[action.venv.name].start(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 244, in start
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
TypeError: write() argument must be str, not bytes

tox: style runtests: PYTHONHASHSEED='183929229'
tox: style runtests: commands[0] | flake8 /home/brian/projects/deploy/test/
tox: py35 runtests: PYTHONHASHSEED='183929229'
tox: py35 runtests: commands[0] | py.test --basetemp=/home/brian/projects/deploy/.tox/py35/tmp
tox: style runtests: commands[1] | flake8 deploy/
!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 75, in logaction_finish
    super(RetoxReporter, self).logaction_finish(action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/tox/session.py", line 262, in logaction_finish
    duration = time.time() - action._starttime
AttributeError: 'Action' object has no attribute '_starttime'

!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 74, in logaction_finish
    self.env_frames[action.venv.name].stop(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 261, in stop
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 67, in logaction_start
    self.env_frames[action.venv.name].start(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 244, in start
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

tox: docs inst: /home/brian/projects/deploy/.tox/dist/deploy-0.1.0.zip
!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 74, in logaction_finish
    self.env_frames[action.venv.name].stop(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 261, in stop
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 67, in logaction_start
    self.env_frames[action.venv.name].start(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 244, in start
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

tox: docs runtests: PYTHONHASHSEED='183929229'
tox: docs runtests: commands[0] | sphinx-build -b html ./ _build/
!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/log.py", line 12, in wrapper
    return f(*args, **kwds)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/reporter.py", line 74, in logaction_finish
    self.env_frames[action.venv.name].stop(action.activity, action)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 261, in stop
    self.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/ui.py", line 61, in refresh
    self._screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

!!!!!! Process crash !!!!!!!
Traceback (most recent call last):
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/__main__.py", line 53, in main
    out = service.run(tox_args.envlist)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/retox/service.py", line 60, in run
    self.screen.refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2126, in refresh
    super(_CursesScreen, self).refresh()
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 1217, in refresh
    self._print_at(new_cell[0], x, y, new_cell[4])
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2256, in _print_at
    self._safe_write(cursor + text)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/site-packages/asciimatics/screen.py", line 2084, in _safe_write
    sys.stdout.write(msg)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 377, in write
    self.stream.write(data)
  File "/home/brian/.virtualenvs/mypy/lib/python3.5/codecs.py", line 376, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

See #12 for tests to recreate the issue

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Finally figured it out credit to @peterbrittain - raised bug report in Tox
tox-dev/tox#723

from retox.

tonybaloney avatar tonybaloney commented on June 25, 2024

Fixed

from retox.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.