Skip to content

Warnings in IDLE raise TypeError (such as attempting to import deprecated modules) #48293

Closed

Description

@craigh
mannequin
BPO 4043
Nosy @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-10-15.21:06:11.145>
created_at = <Date 2008-10-04.22:30:08.827>
labels = ['expert-IDLE', 'type-bug']
title = 'Warnings in IDLE raise TypeError (such as attempting to import deprecated modules)'
updated_at = <Date 2008-10-15.21:06:11.122>
user = 'https://bugs.python.org/craigh'

bugs.python.org fields:

activity = <Date 2008-10-15.21:06:11.122>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2008-10-15.21:06:11.145>
closer = 'benjamin.peterson'
components = ['IDLE']
creation = <Date 2008-10-04.22:30:08.827>
creator = 'craigh'
dependencies = []
files = []
hgrepos = []
issue_num = 4043
keywords = []
message_count = 6.0
messages = ['74324', '74325', '74333', '74334', '74806', '74818']
nosy_count = 3.0
nosy_names = ['russblau', 'benjamin.peterson', 'craigh']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue4043'
versions = ['Python 2.6']

Activity

  1. craigh commented on Oct 4, 2008

    craighmannequin
    MannequinAuthor

    In Python 2.6, attempting to import depecated modules in IDLE raises a
    TypeError exception. I verified this with sets, mimify, and MimeWriter.
    Here's the output for sets:

    >> import sets

    Traceback (most recent call last):
      File "<pyshell#2>", line 1, in <module>
        import sets
      File "C:\Python26\Lib\sets.py", line 85, in <module>
        stacklevel=2)
      File "C:\Python26\Lib\warnings.py", line 29, in _show_warning
        file.write(formatwarning(message, category, filename, lineno, line))
    TypeError: idle_formatwarning_subproc() takes exactly 4 arguments (5 given)

    The other modules give a similar trace.

    Normally, I wouldn't consider this a serious issue, but there are some
    major packages out there that still use deprecated modules such as
    these. For example, MySQLdb 1.2.2 and SQLAlchemy 4.7p1 import the sets
    module so they can't be used at all in IDLE.

  2. craigh commented on Oct 4, 2008

    craighmannequin
    MannequinAuthor

    Actually, it looks like ANY warning will raise this error in IDLE. For
    example:

    >> import warnings
    >> warnings.warn('blah blah')

    Traceback (most recent call last):
      File "<pyshell#5>", line 1, in <module>
        warnings.warn('blah blah')
      File "C:\Python26\Lib\warnings.py", line 29, in _show_warning
        file.write(formatwarning(message, category, filename, lineno, line))
    TypeError: idle_formatwarning_subproc() takes exactly 4 arguments (5 given)
  3. changed the title [-]Attempting to import deprecated modules in IDLE raises TypeError[/-] [+]Warnings in IDLE raise TypeError (such as attempting to import deprecated modules)[/+] on Oct 4, 2008
  4. craigh commented on Oct 5, 2008

    craighmannequin
    MannequinAuthor

    I should have checked this more carefully, but apparently you can still
    use the imported module after the exception.

  5. craigh commented on Oct 5, 2008

    craighmannequin
    MannequinAuthor

    Okay, I think I've got it now:

    1. If you import sets, it raises TypeError. However, if you import it a
      second time, it seems to work properly.

    2. Trying to import a module that relies on the deprecated module (ie,
      sqlalchemy) fails no matter how many times it's imported.

  6. russblau commented on Oct 15, 2008

    russblaumannequin
    Mannequin

    This error is caused by line 27 in run.py:

        def idle_formatwarning_subproc(message, category, filename, lineno):

    needs to be changed to --

        def idle_formatwarning_subproc(message, category, filename, lineno, 
    line=None):

    so that the function signature matches that of warnings.formatwarning

  7. benjaminp commented on Oct 15, 2008

    @benjaminp
    Contributor

    Fixed in r66905.

  8. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-IDLEtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions