← 输入框|github.com|刷新
Skip to content

IOError when attempting negative seek in file (Python 3.0 tutorial) #47774

Closed

Description

@jsizelove
mannequin
BPO 3524
Nosy @birkenfeld

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 = 'https://github.com/birkenfeld'
closed_at = <Date 2008-08-08.07:04:48.068>
created_at = <Date 2008-08-08.00:42:34.766>
labels = ['type-bug', 'docs']
title = 'IOError when attempting negative seek in file (Python 3.0 tutorial)'
updated_at = <Date 2008-08-08.07:04:48.067>
user = 'https://bugs.python.org/jsizelove'

bugs.python.org fields:

activity = <Date 2008-08-08.07:04:48.067>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-08-08.07:04:48.068>
closer = 'georg.brandl'
components = ['Documentation']
creation = <Date 2008-08-08.00:42:34.766>
creator = 'jsizelove'
dependencies = []
files = []
hgrepos = []
issue_num = 3524
keywords = []
message_count = 2.0
messages = ['70874', '70887']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'jsizelove']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue3524'
versions = ['Python 3.0']

Activity

  1. jsizelove commented on Aug 8, 2008

    jsizelovemannequin
    MannequinAuthor

    The Input and Output section of the Python 3.0 tutorial
    (http://docs.python.org/dev/3.0/tutorial/inputoutput.html) shows an
    example of seeking in a negative direction from the end of a file. I
    get an IOError when attempting to run the example in Python 3.0b2 on Mac
    OS X 10.4 (PPC). I don't know whether the tutorial or the code should
    be changed.

    >>> f = open('workfile', 'r+')
    >>> f.write('0123456789abcdef')
    16
    >>> f.seek(-3, 2)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File
    "/Users/jimsize/Programming/Python/py3k/3.0b2/lib/python3.0/io.py", line
    1609, in seek
        raise IOError("can't do nonzero end-relative seeks")
    IOError: can't do nonzero end-relative seeks
  2. added
    docsDocumentation in the Doc dir
    type-bugAn unexpected behavior, bug, or error
    on Aug 8, 2008
  3. birkenfeld commented on Aug 8, 2008

    @birkenfeld
    Member

    Since the file is a text file, such seeking is not possible.

    I've now updated the whole section about files; in particular there was
    also an outdated description of text vs. binary mode.

    Committed r65595.

  4. 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

Labels

docsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions