Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TraitError in traitlets.py(332) on any input #405

Closed
jfkw opened this issue Apr 29, 2011 · 6 comments
Closed

TraitError in traitlets.py(332) on any input #405

jfkw opened this issue Apr 29, 2011 · 6 comments
Labels
Milestone

Comments

@jfkw
Copy link

jfkw commented Apr 29, 2011

For the past month or so with ipython master, on any input, the following error is raised:

TraitError: The 'pprint' trait of a PlainTextFormatter instance must be a boolean, but a value of 0 <type 'int'> was specified.

  ~ $ ipython
  >>> 2+2
  > /usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py(332)error()
      331                 % (self.name, self.info(), repr_type(value))            
  --> 332         raise TraitError(e)
      333 

  ipdb> q
  Traceback (most recent call last):
    File "", line 1, in 
      2+2
    File "/usr/lib64/python2.7/site-packages/IPython/core/displayhook.py", line 302, in __call__
      format_dict = self.compute_format_data(result)
    File "/usr/lib64/python2.7/site-packages/IPython/core/displayhook.py", line 215, in compute_format_data
      return self.shell.display_formatter.format(result)
    File "/usr/lib64/python2.7/site-packages/IPython/core/formatters.py", line 113, in format
      for format_type, formatter in self.formatters.items():
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 283, in __get__
      value = obj._trait_dyn_inits[self.name](obj)
    File "/usr/lib64/python2.7/site-packages/IPython/core/formatters.py", line 59, in _formatters_default
      f = cls(config=self.config)
    File "/usr/lib64/python2.7/site-packages/IPython/config/configurable.py", line 83, in __init__
      self.config = config
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 305, in __set__
      obj._notify_trait(self.name, old_value, new_value)
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 456, in _notify_trait
      c(name, old_value, new_value)
    File "/usr/lib64/python2.7/site-packages/IPython/config/configurable.py", line 138, in _config_changed
      setattr(self, k, deepcopy(config_value))
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 301, in __set__
      new_value = self._validate(obj, value)
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 309, in _validate
      return self.validate(obj, value)
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 963, in validate
      self.error(obj, value)
    File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 332, in error
      raise TraitError(e)
  TraitError: The 'pprint' trait of a PlainTextFormatter instance must be a boolean, but a value of 0  was specified.
@rkern
Copy link
Contributor

rkern commented Apr 29, 2011

Should be fixed by cc9d85e

@minrk
Copy link
Member

minrk commented Apr 29, 2011

something this glaring lasting a month or more just goes to show how many people use --classic mode.

I can confirm that cc9d85e fixes the issue. Testing that also revealed that IPython would always crash on exit in classic mode. This is fixed in 1dc55eb.

@jfkw
Copy link
Author

jfkw commented Apr 29, 2011

Thank you for the fix(es).

Minutes after posting, I fat-fingered an rm command, removing my .ipython. The normal mode with no config worked perfectly.

--classic mode? I can't restore my config from backup until tonight to check what's in it, but I try to keep the inputs '>>> ' , the continuation '... ', and the output unadorned, like the regular python shell. This is mainly for pasting into doctests. My apologies for not utilizing all the hard work you guys put into the ipython repl rendering ;)

@minrk
Copy link
Member

minrk commented Apr 29, 2011

If you were asking what '--classic' mode is, if you do:

ipython --classic

You will get the prompts, output, etc. of the regular Python shell.

@minrk minrk closed this as completed Apr 29, 2011
@ellisonbg
Copy link
Member

It looks like you have a config file that sets pprint=0, but pprint
should be a boolean. Can you see if you have such a config file?

On Fri, Apr 29, 2011 at 7:36 AM, jfkw
reply@reply.github.com
wrote:

For the past month or so with ipython master, on any input, the following error is raised:

TraitError: The 'pprint' trait of a PlainTextFormatter instance must be a boolean, but a value of 0 <type 'int'> was specified.

 ~ $ ipython
 >>> 2+2
 > /usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py(332)error()
     331                 % (self.name, self.info(), repr_type(value))
 --> 332         raise TraitError(e)
     333

 ipdb> q
 Traceback (most recent call last):
   File "", line 1, in
     2+2
   File "/usr/lib64/python2.7/site-packages/IPython/core/displayhook.py", line 302, in call
     format_dict = self.compute_format_data(result)
   File "/usr/lib64/python2.7/site-packages/IPython/core/displayhook.py", line 215, in compute_format_data
     return self.shell.display_formatter.format(result)
   File "/usr/lib64/python2.7/site-packages/IPython/core/formatters.py", line 113, in format
     for format_type, formatter in self.formatters.items():
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 283, in get
     value = obj._trait_dyn_initsself.name
   File "/usr/lib64/python2.7/site-packages/IPython/core/formatters.py", line 59, in _formatters_default
     f = cls(config=self.config)
   File "/usr/lib64/python2.7/site-packages/IPython/config/configurable.py", line 83, in init
     self.config = config
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 305, in set
     obj._notify_trait(self.name, old_value, new_value)
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 456, in _notify_trait
     c(name, old_value, new_value)
   File "/usr/lib64/python2.7/site-packages/IPython/config/configurable.py", line 138, in _config_changed
     setattr(self, k, deepcopy(config_value))
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 301, in set
     new_value = self._validate(obj, value)
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 309, in _validate
     return self.validate(obj, value)
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 963, in validate
     self.error(obj, value)
   File "/usr/lib64/python2.7/site-packages/IPython/utils/traitlets.py", line 332, in error
     raise TraitError(e)
 TraitError: The 'pprint' trait of a PlainTextFormatter instance must be a boolean, but a value of 0 <type 'int'> was specified.

Reply to this email directly or view it on GitHub:
#405

Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu and ellisonbg@gmail.com

@jfkw
Copy link
Author

jfkw commented May 3, 2011

On Mon, May 2, 2011 at 08:59, ellisonbg
reply@reply.github.com
wrote:

It looks like you have a config file that sets pprint=0, but pprint
should be a boolean.  Can you see if you have such a config file?

The config file I had that was crashing the earlier revision of
ipython git master was:

~ $ cat dotfiles/ipython/ipython_config.py
c = get_config()
c.Global.display_banner = False
c.Global.nosep = True
c.Global.classic = True
c.InteractiveShell.confirm_exit = False
c.InteractiveShell.editor = 'emacsclient'
c.InteractiveShell.pdb = True

This config works without alterations now, though. Thank you for the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants