Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
too stupid. But I'm just getting really disenchanted. Sorry. -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 27 July 2007 13:07 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] Shelve del not reducing file size Barton David wrote: > *sigh* I'm really

Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
27;friendliness' it once seemed to aspired to. -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 27 July 2007 14:11 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] Shelve del not reducing file size If it's any solace, there is a small minority of Pyth

Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
Eric Brunson wrote: > It seems like new programmers today expect to be spoonfed their > information like they were in grammar school. They don't know what it > is to hack a Makefile to get a package to compile or break out an RFC to > understand a protocol. If you don't understand something a

Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
*sigh* I'm really going off Python. OK, thanks Andreas. This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University o

[Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
Hi, I've hit a snag with Python's shelve module. By way of example... _ from shelve import DbfilenameShelf as StoreFile import os sf=StoreFile("mytest.db",writeback=False) # but same problem if writeback=True for i in range(1): sf[str(i)]="TESTOBJECT" sf.sync() print len(sf) sf.cl

Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
Andreas Kostyrka wrote: > Additionally, the language core is very very thought out, with glacial > enhancements. "Fixing" the standard library OTOH would involve renaming > and removing names, which would make huge collections of programs break. > Not a good thing :( Yes agreed. My comments there

Re: [Tutor] Shelve del not reducing file size

2007-07-27 Thread Barton David
Eric Brunson wrote: > You seem like a smart guy that's having a bad day, so I'm cutting you > slack. Thanks Eric. Yes I did indeed have a bad day (and it got much much worse), and this is most definitely a case of a bad workman blaming his tools. I apologise to all concerned for voicing my frustr

[Tutor] feeding data to subprocess exes and getting results without writing files

2007-01-09 Thread Barton David
Hi there, I can easily use the subprocess module to run a separate exe from within MyScript.py.. e.g. import subprocess process=subprocess.Popen("myprog.exe -i inputfile.txt -o outputfile.txt") ..and that's just fine as far as it goes, if I don't mind creating 'inputfile.txt' first, and reading

Re: [Tutor] feeding data to subprocess exes and getting results without writing files

2007-01-11 Thread Barton David
PROTECTED] On Behalf Of Christopher Arndt Sent: 09 January 2007 14:26 To: Tutor@python.org Subject: Re: [Tutor] feeding data to subprocess exes and getting results without writing files Barton David schrieb: > I just can't wrap my head around stdin, stdout and the whole pipes >

[Tutor] Generating all possible hits of a regex pattern

2007-01-31 Thread Barton David
I don't suppose there's a nifty trick (exploiting the internal workings of the re module perhaps) to generate all possible hits of a given regex pattern? Something like: >>> import re >>> mypattern=re.compile( "[AB]C{1,2}D?" ) >>> print list( all_pattern_generator( mypattern ) ) ["AC","BC","ACC

[Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
Hi, I'm really confused, and I hope somebody can explain this for me... I've been playing with compression and archives, and have some .zip, .tar, .gz and .tgz example files to test my code on. I can read them using either zipfile, tarfile, gzip or zlib, and that's fine. But just reading them in

Re: [Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
ead() from going to the end? Dave -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 20 February 2007 12:53 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] file.read() doesn't give full contents of compressed files Barton David wrote: > Hi, > I

Re: [Tutor] file.read() doesn't give full contents of compressed files

2007-02-20 Thread Barton David
I see. Thanks for that. dave -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 20 February 2007 13:30 To: Barton David Cc: tutor@python.org Subject: Re: [Tutor] file.read() doesn't give full contents of compressed files Barton David wrote: > Oh... of course

[Tutor] using tarfile on strings or filelike objects

2007-03-02 Thread Barton David
I like that I can access the contents of a zip archive that's stored in memory (rather than on disk) by packing the archive contents into a StringIO or cStringIO object and feeding that to ZipFile... i.e. filelike=cStringIO.StringIO(archive_as_string) zf=zipfile.ZipFile(filelike) content=zf.re

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
.getmember(archive_member_name) >>>tf_filelike=tf.extractfile(tf_infoobject) >>>print tf_filelike.read() In fact I'm getting this even if I open the archive by passing the path name (rather than using fileobj) so I guess this isn't the problem I initially thought it wa

Re: [Tutor] using tarfile on strings or filelike objects

2007-03-05 Thread Barton David
l in response to a tutor's direct reply) it doesn't seem to add my message to the bottom of the existing thread. If somebody can tell me what I'm doing wrong, I'd appreciate it. -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: 05 March 2007 12:44