I'm trying to determine which files in the Python library are strictly necessary for my script to run. Right now I'm trying to determine where _io.py is located. In io.py (no underscore), the _io.py module (with underscore) is imported on line 60.

share|improve this question
1  
which version of Python? What are you trying to achieve exactly - it's unclear from the question – Eli Bendersky Feb 15 '11 at 11:53
    
@Eli Bendersky I'm trying to make a portable app, and I'd like to find which libraries are needed by it. I'm running Python 3.1. – Paul Feb 15 '11 at 11:57
up vote 6 down vote accepted

Some modules are compiled directly into the interpreter -- there are no files corresponding to them. You can retrieve a list of these modules from sys.builtin_module_names. In my Pyton 3.1 installation, _io is included in this list.

You might want to have a look at snakefood to determine the dependencies of your script.

share|improve this answer

From python-list email archive: is "_io.py" missing from 2.7.4 ?, the situation for Python 2 and 3 is different:

In Python 2.7:

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.

In Python 3:

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

share|improve this answer

Try the DLLs folder under your base python install directory if you are on windows. It contains .pyd modules Ignacio mentions. I had a similar problem with a portable install. Including the DLLs folder contents to my install fixed it. I am using python 2.5.

share|improve this answer

Not all Python modules are written in Python. Try looking for _io.so or _io.pyd.

share|improve this answer
    
A Windows search in the Python directory for files containing "_io" in the name returned only /Lib/test/test_io.py and /Lib/test/test_ioctl.py. Btw, I'm using Python 3.1. – Paul Feb 15 '11 at 11:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.