From: Norman Rieß on
Am 02/22/10 14:29, schrieb Lie Ryan:
> On 02/22/10 19:43, Norman Rieß wrote:
>
>> Am 02/22/10 09:02, schrieb Steven D'Aprano:
>>
>>> On Mon, 22 Feb 2010 07:49:51 +0100, Norman Rieß wrote:
>>>
>>>
>>>
>>>> This is the actual code:
>>>>
>>>> source_file = bz2.BZ2File(file, "r")
>>>> for line in source_file:
>>>> print line.strip()
>>>>
>>>> print "Exiting"
>>>> print "I used file: " + file
>>>>
>>>>
>>> Have you verified that the bz file is good by opening it in another
>>> application?
>>>
>>>
>>>
>>>
>>>
>> Yes, bzcat is running through the file fine. And piping bzcat output
>> into the python script reading stdin works fine, too.
>>
> test with using something other than bzcat; bzcat does certain things
> differently because of the way it works (a cat for bzipped file). Try
> using plain "bunzip2 filename.bz2"
>

Did that too. Works as expected.
From: Stefan Behnel on
Lie Ryan, 22.02.2010 14:29:
> On 02/22/10 19:43, Norman Rie� wrote:
>> Am 02/22/10 09:02, schrieb Steven D'Aprano:
>>> On Mon, 22 Feb 2010 07:49:51 +0100, Norman Rie� wrote:
>>>
>>>
>>>> This is the actual code:
>>>>
>>>> source_file = bz2.BZ2File(file, "r")
>>>> for line in source_file:
>>>> print line.strip()
>>>>
>>>> print "Exiting"
>>>> print "I used file: " + file
>>>>
>>> Have you verified that the bz file is good by opening it in another
>>> application?
>>>
>>>
>>>
>>>
>> Yes, bzcat is running through the file fine. And piping bzcat output
>> into the python script reading stdin works fine, too.
>
> test with using something other than bzcat; bzcat does certain things
> differently because of the way it works (a cat for bzipped file). Try
> using plain "bunzip2 filename.bz2"

Please note that all of this has already been suggested on the python-tutor
list.

Stefan