Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This function is based on the Python sample code @ http://docs.python.org/library/gzip.html. It runs reliably on Ubuntu 10.04 with its default Python 2.6x. On Ubuntu 11.04, however, the code fails @ writelines().

On one 11.04 machine, the failure message reported "'module' object has no attribute 'BufferedIOBase'". Another 11.04 machine reported a different message "No module named numpy".

Does anyone know of any missing Python dependencies or other problems on 11.04 that would cause this?

def _compress(inp,out):
    import gzip
    f_out = gzip.open(out,'wb')
    f_in = open(inp,'rb')
    f_out.writelines(f_in)
    f_out.close()
    f_in.close()
    os.unlink(inp)
share|improve this question
1  
I can tell you that it perfectly works for me on 12.04. Could you make a full script with a test file and paste the full output (and the script)? –  xubuntix May 31 '12 at 19:03
    
Sorry, xubuntix, I traced the problem to the existence of a non-standard io.py module in the sys.path(). Python's gzip module ignored it on 2.6x (Ubuntu 10.04) but tried to load it on 2.7x (Ubuntu 11.04+). Removing/renaming the io.sys module fixed the problem. Thanks. –  tahoar Jun 2 '12 at 0:24
add comment

1 Answer

tahoar solved the problem in a comment:

Sorry, xubuntix, I traced the problem to the existence of a non-standard io.py module in the sys.path(). Python's gzip module ignored it on 2.6x (Ubuntu 10.04) but tried to load it on 2.7x (Ubuntu 11.04+). Removing/renaming the io.sys module fixed the problem. Thanks

share|improve this answer
add comment

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.