is "_io.py" missing from 2.7.4 ?

Discussion in 'Python' started by dbv, Apr 8, 2013.

  1. dbv

    dbv Guest

    In 2.7.4, io.py shows:

    import _io
    import abc

    from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
    open, FileIO, BytesIO, StringIO, BufferedReader,
    BufferedWriter, BufferedRWPair, BufferedRandom,
    IncrementalNewlineDecoder, TextIOWrapper)

    but, cannot find _io.py, though there is the old _pyio.py in the //Python27//Lib folder.
    dbv, Apr 8, 2013
    #1
    1. Advertising

  2. dbv

    Dylan Evans Guest

    On Mon, Apr 8, 2013 at 11:12 PM, dbv <> wrote:

    > In 2.7.4, io.py shows:
    >
    > import _io
    > import abc
    >
    > from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError,
    > UnsupportedOperation,
    > open, FileIO, BytesIO, StringIO, BufferedReader,
    > BufferedWriter, BufferedRWPair, BufferedRandom,
    > IncrementalNewlineDecoder, TextIOWrapper)
    >
    > but, cannot find _io.py, though there is the old _pyio.py in the
    > //Python27//Lib folder.
    >
    > >>> _io.__file__

    '/usr/lib/python2.7/lib-dynload/_io.so'

    Looks like it's implemented in C.



    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >




    --
    "The UNIX system has a command, nice ... in order to be nice to the other
    users. Nobody ever uses it." - Andrew S. Tanenbaum
    Dylan Evans, Apr 8, 2013
    #2
    1. Advertising

  3. dbv

    dbv Guest

    Ah, okay. Then on Windows, _io.pyd should be in the /DLLs folder but it isn't there ?
    dbv, Apr 8, 2013
    #3
  4. dbv

    dbv Guest

    Ah, okay. Then on Windows, _io.pyd should be in the /DLLs folder but it isn't there ?
    dbv, Apr 8, 2013
    #4
  5. dbv

    dbv Guest

    _io is a builtin module
    dbv, Apr 8, 2013
    #5
  6. dbv

    dbv Guest

    _io is a builtin module
    dbv, Apr 8, 2013
    #6
  7. Am 08.04.2013 15:42 schrieb dbv:
    > Ah, okay. Then on Windows, _io.pyd should be in the /DLLs folder but it isn't there ?
    >

    It seems to be a built-in module:

    >>> import _io
    >>> _io

    <module '_io' (built-in)>

    alike to

    >>> import __builtin__
    >>> __builtin__

    <module '__builtin__' (built-in)>

    as opposed to

    >>> import win32ui
    >>> win32ui

    <module 'win32ui' from
    'C:\Python27\lib\site-packages\Pythonwin\win32ui.pyd'>

    and

    >>> import os
    >>> os

    <module 'os' from 'C:\Python27\lib\os.pyc'>


    Thomas
    Thomas Rachel, Apr 8, 2013
    #7
  8. On Mon, 08 Apr 2013 06:12:02 -0700, dbv wrote:

    > In 2.7.4, io.py shows:
    >
    > import _io
    > import abc
    >
    > from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError,
    > UnsupportedOperation,
    > open, FileIO, BytesIO, StringIO, BufferedReader,
    > BufferedWriter, BufferedRWPair, BufferedRandom,
    > IncrementalNewlineDecoder, TextIOWrapper)
    >
    > but, cannot find _io.py, though there is the old _pyio.py in the
    > //Python27//Lib folder.



    If "from _io import ..." succeeds with no error, then it is physically
    impossible for it to be missing.

    To find where the _io module lives, at the interactive interpreter run
    this:

    import _io
    _io.__file__


    Under Linux, you should get something like this:

    '/usr/local/lib/python2.7/lib-dynload/_io.so'


    and the equivalent under Windows.

    Note that in Python 3.3, the _io module is now built-in into the
    compiler, so _io.__file__ no longer exists.


    --
    Steven
    Steven D'Aprano, Apr 9, 2013
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Fox
    Replies:
    0
    Views:
    740
    Paul Fox
    Mar 5, 2004
  2. Mark Newby
    Replies:
    1
    Views:
    1,688
  3. CodeMonkey
    Replies:
    0
    Views:
    403
    CodeMonkey
    Oct 11, 2005
  4. Acceed See
    Replies:
    1
    Views:
    519
    Carl W.
    Apr 22, 2005
  5. Gary Herron
    Replies:
    2
    Views:
    658
    Bruno Desthuilliers
    Jul 4, 2006
Loading...

Share This Page