Package: python2.6
Version: 2.6.5-1ubuntu6
Severity: normal

The implementation of the python csv.reader means that it cannot be
used as a realtime filter as it wants to read all of the input before
it returns any records. :(

I had intended to use it to translate asterisk CDR records to a
different format in a pipeline fed by 'tail -f cdrfile.csv'

import csv
import sys
print 'enter some lines of CSV data'
csvin = csv.reader(sys.stdin,lineterminator='\n')
for row in csvin:
        print '<SEPARATOR>'.join(row)

        print '<SEPARATOR>'.join(row)

I guess my only option is perl <shudder>, or messing around with internal pipes

import csv,sys,os
input=sys.stdin.readline()
while input != "" :
        xin,xout=os.pipe()
        os.write(xout,input)
        fxin=os.fdopen(xin)
        csvin=csv.reader(fxin,lineterminator='\n')
        os.close(xout)
        for row in csvin:
                print '<SEPARATOR>'.join(row)
        fxin.close
        input=sys.stdin.readline()
# but this only works with single-line csv records :(
        

-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 'lucid')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-22-generic (SMP w/8 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python2.6 depends on:
ii  libbz2-1.0         1.0.5-4               high-quality block-sorting file co
ii  libc6              2.11.1-0ubuntu7.1     Embedded GNU C Library: Shared lib
ii  libdb4.8           4.8.24-1ubuntu1       Berkeley v4.8 Database Libraries [
ii  libncursesw5       5.7+20090803-2ubuntu3 shared libraries for terminal hand
ii  libreadline6       6.1-1                 GNU readline and history libraries
ii  libsqlite3-0       3.6.22-1              SQLite 3 shared library
ii  mime-support       3.48-1ubuntu1         MIME files 'mime.types' & 'mailcap
ii  python2.6-minimal  2.6.5-1ubuntu6        A minimal subset of the Python lan

python2.6 recommends no packages.

Versions of packages python2.6 suggests:
ii  binutils                 2.20.1-3ubuntu5 The GNU assembler, linker and bina
pn  python2.6-doc            <none>          (no description available)
pn  python2.6-profiler       <none>          (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to