#293 closed defect (fixed)
Command line parsing error when Python shell open
| Reported by: | Eric Pettersen | Owned by: | Greg Couch |
|---|---|---|---|
| Priority: | blocker | Milestone: | |
| Component: | Command Line | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
open 3fx2
-- start Python shell --
color blue
produces:
Traceback (most recent call last):
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/cmd_line/gui.py", line 120, in on_enter
cmd.run(cmd_text)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 2086, in run
prev_annos = self._process_positional_arguments()
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 1948, in _process_positional_arguments
value, text = self._parse_arg(anno, text, session, False)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 1795, in _parse_arg
value, replacement, rest = annotation.parse(text, session)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 1040, in parse
return anno.parse(text, session)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 901, in parse
aspec, text, rest = AtomSpecArg.parse(text, session)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/atomspec.py", line 84, in parse
return AtomSpecArg._parse_unquoted(text, session)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/atomspec.py", line 132, in _parse_unquoted
from ._atomspec import _atomspecParser
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/_atomspec.py", line 16, in <module>
from grako.parsing import graken, Parser
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/grako/init.py", line 6, in <module>
from grako import tool
File "grako/tool.py", line 16, in init grako.tool (grako/tool.c:4415)
from grako.parser import GrakoGrammarGenerator
File "grako/parser.py", line 17, in init grako.parser (grako/parser.c:1456)
from grako.bootstrap import GrakoBootstrapParser
File "grako/bootstrap.py", line 15, in init grako.bootstrap (grako/bootstrap.c:36008)
from grako.parsing import graken, Parser
File "grako/parsing.py", line 20, in init grako.parsing (grako/parsing.c:1647)
from grako.contexts import ParseContext, graken
File "grako/contexts.py", line 13, in init grako.contexts (grako/contexts.c:22548)
from grako.color import Fore, Style
File "grako/color.py", line 8, in init grako.color (grako/color.c:924)
_colorama.init(autoreset=True)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/colorama/initialise.py", line 37, in init
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/colorama/initialise.py", line 76, in wrap_stream
convert=convert, strip=strip, autoreset=autoreset)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/colorama/ansitowin32.py", line 67, in init
strip = conversion_supported or (not wrapped.closed and not is_a_tty(wrapped))
AttributeError: 'PseudoFileOut' object has no attribute 'closed'
Change History (2)
comment:1 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 by , 10 years ago
The next version of grako will require explicit colorization and thus the backtrace on exit should go away.
Worked around by extending wx's PseudoFile class (the base class of PseudoFileOut) to have a 'closed' attribute, which is part of the Python file API. Unfortunately, closed is always false because the PseudoFile{In,Out,Err} API is missing a way to detect if the encapsulated object is gone. So, in this case, colorama initializes, but generates a traceback, when ChimeraX exits, trying to write to a dead object. But that is better than having 'color blue' fail.