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

errors='replace' works in IDLE, fails at Windows command line. #53275

Closed
jvanpraag mannequin opened this issue Jun 18, 2010 · 3 comments
Closed

errors='replace' works in IDLE, fails at Windows command line. #53275

jvanpraag mannequin opened this issue Jun 18, 2010 · 3 comments
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@jvanpraag
Copy link
Mannequin

jvanpraag mannequin commented Jun 18, 2010

BPO 9029
Nosy @bitdancer
Superseder
  • bpo-9126: errors='replace' does not work at Windows command line
  • 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 2010-06-30.16:51:42.828>
    created_at = <Date 2010-06-18.19:43:48.534>
    labels = ['type-bug', 'OS-windows']
    title = "errors='replace' works in IDLE, fails at Windows command line."
    updated_at = <Date 2010-06-30.16:51:42.827>
    user = 'https://bugs.python.org/jvanpraag'

    bugs.python.org fields:

    activity = <Date 2010-06-30.16:51:42.827>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-06-30.16:51:42.828>
    closer = 'benjamin.peterson'
    components = ['Windows']
    creation = <Date 2010-06-18.19:43:48.534>
    creator = 'jvanpraag'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 9029
    keywords = []
    message_count = 3.0
    messages = ['108130', '108176', '108989']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'jvanpraag']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '9126'
    type = 'behavior'
    url = 'https://bugs.python.org/issue9029'
    versions = ['Python 3.1']

    @jvanpraag
    Copy link
    Mannequin Author

    jvanpraag mannequin commented Jun 18, 2010

    Platforms:
    Windows Vista Ultimate 64 bit
    Python v3.1.2

    Goal is to read a tab-separated CSV file. Some records have garbage characters in them.

    The following code fragment works when the program is run in IDLE, but fails when run from the Windows command line.

    ...
    fh_read = open(company_info, encoding='utf_8', errors='replace')
    fh_write = open(quotes_file, 'w')
    count = 0
    try:
    rdr = csv.reader(fh_read, delimiter='\t')
    wrt = csv.writer(fh_write, delimiter='\t', quotechar='"', lineterminator='\n')
    for row in rdr:
    ...

    Within IDLE the code works with or without the encoding='utf_8' declaration; and it fails with or without the declaration when run from the Windows command line.

    The error message from the Windows command line is as follows:

    'charmap' codec can't encode character '\u2019' in position 207: character maps to <undefined>

    @jvanpraag jvanpraag mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Jun 18, 2010
    @bitdancer
    Copy link
    Member

    What you show is not a complete program, nor do you provide the complete traceback or the data causing the problem. The most helpful thing would be a complete small program and data file demonstrating the problem. That said, I'm wondering if your problem is the encoding of the terminal window.

    @jvanpraag
    Copy link
    Mannequin Author

    jvanpraag mannequin commented Jun 30, 2010

    I just now resubmitted, with a text file and program demonstrating the
    problem: bpo-9126.

    I am new to submitting Python bug reports and I would like to do it
    right. I found I could only attach 1 file to the bug report. However, I
    had two files: The text file to read, and the program doing the reading.
    Is there some way to attach multiple files to a bug report? If not, what
    is the customary way to handle submissions where there is a file to be
    processed, and a program doing the processing? And perhaps other files
    exhibiting output(s)?

    Thanks,

    John

    On Sat, 19 Jun 2010 12:48 +0000, "R. David Murray"
    <report@bugs.python.org> wrote:

    R. David Murray <rdmurray@bitdance.com> added the comment:

    What you show is not a complete program, nor do you provide the complete
    traceback or the data causing the problem. The most helpful thing would
    be a complete small program and data file demonstrating the problem.
    That said, I'm wondering if your problem is the encoding of the terminal
    window.

    ----------
    nosy: +r.david.murray


    Python tracker <report@bugs.python.org>
    <http://bugs.python.org/issue9029\>


    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants