is "_io.py" missing from 2.7.4 ?

D

dbv

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

Dylan Evans

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.
'/usr/lib/python2.7/lib-dynload/_io.so'

Looks like it's implemented in C.


 
D

dbv

Ah, okay. Then on Windows, _io.pyd should be in the /DLLs folder but it isn't there ?
 
D

dbv

Ah, okay. Then on Windows, _io.pyd should be in the /DLLs folder but it isn't there ?
 
T

Thomas Rachel

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:
<module '_io' (built-in)>

alike to
<module '__builtin__' (built-in)>

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

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


Thomas
 
S

Steven D'Aprano

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top