I'm currently making system call to "unrar and zip" commands. It interrupts and requires me to enter password while encounter password propected archives.
Is it possible to let it run and return a "unsuccessful" value to main program on any error or password prompt?
Can we natively use rarfile and zipfile library to do the job without creating any te开发者_如何学编程mporary files?
I think it's very difficult to do the task without using temporary files. If you are converting very large files you need to use temporary space in disk.
You can use the PyUnRAR2 library, it will let you examine and extract the files of a RAR archive. You can extract the files to a temporary folder created with the tempfile python module. After that create a ZIP file using the zipfile python module.
Note that in order to use PyUnRAR2 you need the RAR proprietary binary files.
Maybe this could help: http://www.noah.org/wiki/Pexpect#Description_of_Pexpect
精彩评论