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

TypeError: super() argument 1 must be type, not classobj (Python 2.6.6) #3968

Closed
jakobgager opened this issue Aug 9, 2013 · 9 comments · Fixed by #3973
Closed

TypeError: super() argument 1 must be type, not classobj (Python 2.6.6) #3968

jakobgager opened this issue Aug 9, 2013 · 9 comments · Fixed by #3973
Labels
Milestone

Comments

@jakobgager
Copy link
Contributor

When starting the ipython notebook I get the following error

Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj

strangely enough the notebook works and can be used, however nbconvert does not produce any output and cannot be used. The IPython terminal does not invoke this error.

Looks like it is related to LevelFormatter.

System info:
{'codename': 'An Afternoon Hack',
'commit_hash': '02da31c',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython',
'ipython_version': '1.0.0',
'os_name': 'posix',
'platform': 'Linux-2.6.32-358.2.1.el6.x86_64-x86_64-with-redhat-6.4-Carbon',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.6.6 (r266:84292, Feb 21 2013, 19:26:11) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'}

Update:
I forgot to mention that using a VM (Ubuntu 12.04) and Python 2.7.3 this error does not appear!

@takluyver
Copy link
Member

I believe classobj means an old style class. Super() only works with new
style classes.
On Aug 9, 2013 2:54 AM, "Jakob Gager" notifications@github.com wrote:

When starting the ipython notebook I get the following error

Traceback (most recent call last):
File "/usr/lib64/python2.6/logging/init.py", line 776, in emit
msg = self.format(record)
File "/usr/lib64/python2.6/logging/init.py", line 654, in format
return fmt.format(record)
File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
File "/usr/lib64/python2.6/logging/init.py", line 776, in emit
msg = self.format(record)
File "/usr/lib64/python2.6/logging/init.py", line 654, in format
return fmt.format(record)
File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
File "/usr/lib64/python2.6/logging/init.py", line 776, in emit
msg = self.format(record)
File "/usr/lib64/python2.6/logging/init.py", line 654, in format
return fmt.format(record)
File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
File "/usr/lib64/python2.6/logging/init.py", line 776, in emit
msg = self.format(record)
File "/usr/lib64/python2.6/logging/init.py", line 654, in format
return fmt.format(record)
File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj
Traceback (most recent call last):
File "/usr/lib64/python2.6/logging/init.py", line 776, in emit
msg = self.format(record)
File "/usr/lib64/python2.6/logging/init.py", line 654, in format
return fmt.format(record)
File "/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython/config/application.py", line 119, in format
return super(LevelFormatter, self).format(record)
TypeError: super() argument 1 must be type, not classobj

strangely enough the notebook works and can be used, however nbconvert
does not produce any output and cannot be used. The IPython terminal does
not invoke this error.

Looks like it is related to LevelFormatter.

System info:
{'codename': 'An Afternoon Hack',
'commit_hash': '02da31c',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path':
'/usr2/gager/usr/lib/python2.6/site-packages/ipython-1.0.0-py2.6.egg/IPython',
'ipython_version': '1.0.0',
'os_name': 'posix',
'platform':
'Linux-2.6.32-358.2.1.el6.x86_64-x86_64-with-redhat-6.4-Carbon',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.6.6 (r266:84292, Feb 21 2013, 19:26:11) \n[GCC 4.4.7
20120313 (Red Hat 4.4.7-3)]'}


Reply to this email directly or view it on GitHubhttps://github.com//issues/3968
.

minrk added a commit to minrk/ipython that referenced this issue Aug 9, 2013
minrk added a commit to minrk/ipython that referenced this issue Aug 9, 2013
@desktable
Copy link

I had the same error on python 2.7

Traceback (most recent call last):
  File "../venv/lib/python2.7/logging/__init__.py", line 760, in emit
    msg = self.format(record)
  File "../venv/lib/python2.7/logging/__init__.py", line 644, in format
    return fmt.format(record)
  File "../venv/lib/python2.7/site-packages/ipython-1.0.0-py2.7.egg/IPython/config/application.py", line 119, in format
    return super(LevelFormatter, self).format(record)
TypeError: must be type, not classobj

@minrk
Copy link
Member

minrk commented Aug 9, 2013

I don't see how it's possible for you to have seen this on 2.7:

$ python2.6 -c "import sys,logging; print sys.version.split()[0], type(logging.Formatter)"
2.6.7 <type 'classobj'>
$ python2.7 -c "import sys,logging; print sys.version.split()[0], type(logging.Formatter)"
2.7.2 <type 'type'>

What do you get from running that?

@desktable
Copy link

Here is what I got:

$ python2.6 -c "import sys,logging; print sys.version.split()[0], type(logging.Formatter)"
2.6.5 <type 'classobj'>
$ python2.7 -c "import sys,logging; print sys.version.split()[0], type(logging.Formatter)"
2.7.2 <type 'classobj'>

@minrk
Copy link
Member

minrk commented Aug 9, 2013

That's just weird. logging.Formatter is a new-style class as of 2.7.0, so somehow you seem to have at least part of the 2.6 stdlib in your 2.7 venv. Can you test outside the venv?

@minrk
Copy link
Member

minrk commented Aug 9, 2013

And do you have PYTHONPATH set? Normally logging is not in a virtualenv.

minrk added a commit that referenced this issue Aug 9, 2013
@desktable
Copy link

It turns out that I can solve this problem by editing the logging/init.py file. I changed from

class Formatter:

to

class Formatter(object):

and no longer have the error.

@minrk
Copy link
Member

minrk commented Aug 10, 2013

But why do you have logging in your virtualenv in the first place?

@desktable
Copy link

I am working on a code repository that pushes updates to tens of hundreds
of production machines. I guess it makes sense to include as many libraries
as possible in the virtualenv, so that any package update gets pushed out
to all production machines automatically. Had logging not been in the
virtualenv, I have to worry about updating all production machines
one-by-one.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants