Python-URL! - weekly Python news and links (Dec 15)

2009-12-15 Thread Cameron Laird
This installment, like all those for several months, was authored by Gabriel Genellina. We have hopes of correcting the attribution before year's-end. QOTW: "Plus, it's not something that's never foolproof." - Carl Banks, daring negater http://groups.google.com/group/comp.lang.python/msg/e8

Re: Class variables static by default?

2009-12-19 Thread Cameron Simpson
compare. When you say "self.items" python looks first in the object and then in the class. Your code didn't put it in the object namespace, so it found the one in the class. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I have always been a welly

Re: Multithreaded python program freezes

2009-12-20 Thread Cameron Simpson
appen is a loop testing select() (or its poll-like friends) with a short or zero timeout on inactive file handles. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ No electrons were harmed in the production of this message. - Dr. P. Gensheimer -- http://mail.python.o

Re: Queues vs List

2009-12-25 Thread Cameron Simpson
t. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Team work is essential. It gives the enemy other people to shoot at. - Murphy's Laws of Combat -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Dec 26)

2009-12-27 Thread Cameron Laird
QOTW: "It took Python to make me realize that programming *could* be fun, or at least not annoying enough to keep me from making a career of programming." - Aahz http://groups.google.com/group/comp.lang.python/msg/65ad4e71c194d97e Thanks to Gabriel Genellina for these references: How t

Re: the need for 64 bits

2009-12-29 Thread Cameron Simpson
ac and then upgrade the RAM | separately. Unless it's a Macbook Air. Then you're stuck with 2GB max:-( At least I didn't pay for it:-) It's a nice machine in many respects. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I am a Bear of Very Little Brain and long word

Re: change an exception's message and re-raise it

2009-12-31 Thread Cameron Simpson
t;else" part is to handle exceptions I can't change, so for now I've just printing the "pfx" context on stderr as the exception bubbles out. Nasty. The calling code looks like this: with Pfx("some tag"): ... suite ... Cheers, -- Cameron Simpson DoD#74

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-02 Thread Cameron Simpson
: - the directory user and group ownership and permissions - the daemon's user and group values? You can also strace your daemon: strace -f -e trace=file your-daemon your-daemon-args... 2>strace.out and then examine the log for the precise UNIX-level failure. Cheers, -- Cameron Simp

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread Cameron Simpson
On 03Jan2010 14:20, cassiope wrote: | On Jan 2, 8:02 pm, Cameron Simpson wrote: | > Can you show us: | >   - the directory user and group ownership and permissions | >   - the daemon's user and group values? | | Directory permissions: 774 That's unusual - why the "4&quo

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-03 Thread Cameron Simpson
id you eyeball the actual open() call to ensure the file pathname is correct, and doesn't use a bogus (non-existent) directory name? -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ "GOD IS MY SOURCE" - Bumper sticker, Chapel Hill, NC I'll have to remem

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-04 Thread Cameron Simpson
On 04Jan2010 09:16, cassiope wrote: | To Cameron: the file doesn't (yet) exist; and it has the correct full | path. Can you show us the strace output of the failing open() call? | To "Nobody" : hey, this seems interesting. First test, invoking | seteuid() | and setegid() di

Re: chown'ing by script

2010-01-05 Thread Cameron Simpson
sure you don't want chmod? -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Winter is gods' way of telling us to polish. - Peter Harper -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for Python live code reloading IDEs

2010-01-22 Thread Cameron Simpson
hen a file is saved. CherrypPy too. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why the file mode of .pyc files has x?

2009-09-28 Thread Cameron Simpson
106 2009-09-26 10:19:17 test.py | -rwx-- 1 pengy lilab 339 2009-09-26 10:20:39 test.pyc This happens for me with python 2.6 x86_64 on gentoo. You're not alone. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Reaching consensus in a group often is confused with findin

Re: What command should be use when the testing of arguments is failed?

2009-10-14 Thread Cameron Simpson
ure and 1 for "this didn't work". Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Don't have awk? Use this simple sh emulation: #!/bin/sh echo 'Awk bailing out!' >&2 exit 2 - Tom Horsley -- http://mail.python.org/mailman/listinfo/python-list

Re: Terminating python script easily

2009-10-22 Thread Cameron Simpson
uff is only delivered to the main thread of a python program, thus requiring special handle to tidy up other stuff. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ No team manager will tell you this; but they all want to see you come walking back into the pits somet

Python-URL! - weekly Python news and links (Oct 25)

2009-10-25 Thread Cameron Laird
QOTW: "It was intended to be understood, not copied." - Dave Angel comments on a characteristic of didactic examples http://groups.google.com/group/comp.lang.python/msg/61e2d60d08f1c630 Altering the default character encoding (sys.setdefaultencoding) is never a good idea: ^://gr

Re: Deeper copy than deepcopy

2009-10-27 Thread Cameron Simpson
(x) Your deepercopy() function will explode. Probably the best method is to pre-munge the list you pass to deepcopy: d = [1,2,3] d3 = [d]*3 # pre-copy the multiple references d3deeper = [ list(d3i) for d3i in d3 ] r = copy.deepcopy(d3deeper) You can see this requires special knowled

Re: Deeper copy than deepcopy

2009-10-27 Thread Cameron Simpson
structure would get non-independent "x"s. Which is necessary to avoid an infinite copy but breaks your requirement. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Every technical corrigendum is met by an equally troublesome new defect report. - Norman Diamond -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Nov 3)

2009-11-03 Thread Cameron Laird
QOTW: "I consider "import *" the first error to be fixed ..." - Robert Kern, author of PyFlakes, a potential replacement for Pylint and Pychecker, on his personal style http://groups.google.com/group/comp.lang.python/msg/5bf77b21b3b0caf2 Python 2.6.4 is out; it fixes some small but impor

Python-URL! - weekly Python news and links (Nov 10)

2009-11-10 Thread Cameron Laird
QOTW: "Don't get me wrong - innovation often comes from scratching ones personal itch. But you seem to be suffering from a rather bad case of neurodermatitis." - Diez B. Roggisch, on ... well, personal style in problem-solving http://groups.google.com/group/comp.lang.python/msg/4cf102bdd3a3267

Python-URL! - weekly Python news and links (Nov 24)

2009-11-24 Thread Cameron Laird
QOTW: "... it's generally accepted that COM sucks rocks through straws, so explore alternatives when they're available ;-)" - Chris Withers http://groups.google.com/group/comp.lang.python/msg/29577c851ceed167 From nothing to a complete working program - Peter Otten on stepwise refine

Re: Google AI Challenge at U of Waterloo

2010-02-06 Thread Jeff Cameron
Might, Courage, Vision, SINCERITY. >   / v \  Simplicity is Beauty! May the Force and Farce be with you! > /( _ )\ (x86_64 Ubuntu 9.10)  Linux 2.6.32.7 >    ^ ^   12:16:01 up 6 days 20:22 2 users load average: 0.45 0.26 0.09 > 不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 > (CSSA):http://www.sw

Re: "if {negative}" vs. "if {positive}" style (was: New to Python)

2010-02-09 Thread Cameron Simpson
-read-form-of-the-test}" if it all still reads well. If the program flow gets ugly one way, that breaks "still reads well" and can be cause to flip the condition. In loops my tendency is a bit less flexible; I often have code like this: while ...: if winnowing-test: whi

Re: threading and signals - main thread solely responsible for signal handling?

2010-02-13 Thread Cameron Simpson
taul waiting for everything. This makes for clean and timely shutdown for me. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ If your new theorem can be stated with great simplicity, then there will exist a pathological exception.- Adrian Mathesis -- http://mail.python.org/mailman/listinfo/python-list

Re: iglob performance no better than glob

2010-02-13 Thread Cameron Simpson
t; > files, that does not take a long time to run? | > | > Here's my attempt. [...open directory and read native format...] I'd be inclined first to time os.listdir('.') versus glob.lgo('*.*'). Glob routines tend to lstat() every matching name to ensure

Re: How to end TCP socket data while using readline()?

2010-02-26 Thread Cameron Simpson
() method as you're using already. Read from to_file as needed. The same scheme should work in both server and client: Don't look for EOF, watch the input line flow. You might need to use readline() instead of the file-by-line iteration stuff, which I seem to recall has some sort of problem

Re: Truoble With A Search Script for ImageBin.org

2010-03-18 Thread Cameron Simpson
But otherwise, yes, missing Content-Type. And the request method needs to be POST; I expect the code above will be using GET unless told not to. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ There's no trick to being a humorist when you have the whole government working for you.- Will Rogers -- http://mail.python.org/mailman/listinfo/python-list

Re: Revisiting Generators and Subgenerators

2010-03-25 Thread Cameron Simpson
more lightweight in terms of machine resources?) On the flipside, given that generators were recently augumented to support coroutines I can see your motivation within that framework. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ C makes it easy for you to shoot yourself in the

Re: Revisiting Generators and Subgenerators

2010-03-26 Thread Cameron Simpson
readed setup. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Principles have no real force except when one is well fed. - Mark Twain -- http://mail.python.org/mailman/listinfo/python-list

Re: GIF89A and PIL

2010-03-29 Thread Cameron Simpson
obably not enough, I would guess. Just wondering. Do you need to move a "standard" image format around? If everything's 16x16 8 bit colour (and if, with luck, they share a colour map) maybe you can ship raw bytes expressing what you want. How colourful are these GIFs? -- Came

Re: "Usability, the Soul of Python"

2010-03-30 Thread Cameron Simpson
ts a 99, and increases | > every loop? And here we see the strength of the Usability example; in Python it won't overflow, rather seguing seamlessly into an increasing expensive arbitrary sized int. Though most machines will eventually run out of memory to hold it... -- Cameron S

Re: Help: Guide needed in trying to delete/flush the content of a fifo file.

2010-11-15 Thread Cameron Simpson
til the consumer has sent an acknowledgement before | sending more info. I agree with this statement. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ In the end, winning is the only safety. - Kerr Avon -- http://mail.python.org/mailman/listinfo/python-list

Re: strange subprocess behavior when calling ps

2010-11-17 Thread Cameron Simpson
| are normally automatically started with the COMMAND_MODE environment | variable set: | | $ echo $COMMAND_MODE | unix2003 | | Adding an "env={"COMMAND_MODE": "unix2003"}" argument to your subprocess | Popen call should do the trick. For an added datum, my machine (MacOSX

Re: returning results from function

2010-11-17 Thread Cameron Simpson
quot; % local_date) It's worth noting that if you know the number of return arguments you can do this: locyr, locmm, locdd, lochh = itc_to_local(...) and then easily use the individual values. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Admit Nothing. Blame Everyone. Be Bitter. - Matt Hopkins, DoD #1197, -- http://mail.python.org/mailman/listinfo/python-list

Re: bug? mmap doesn't like 0-length files

2010-11-22 Thread Cameron Simpson
ary). EINVAL (since Linux 2.6.12) length was 0. EINVAL flags contained neither MAP_PRIVATE or MAP_SHARED, or contained both of these values. Sure looks like a length of 0 is disliked. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Carpe Daemon - Seize the Bac

Re: bug? mmap doesn't like 0-length files

2010-11-22 Thread Cameron Simpson
27;s worth noting that any time you get an errno error/exception then it is almost certainly the underlying OS interface that has rejected your request, not the python library. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Don't have awk? Use this simple sh emulation

Re: Matlab equivalent syntax in Python

2010-11-26 Thread Cameron Simpson
l be these | equivalents | in Python? I would start by looking at the "profile" python module: http://docs.python.org/library/profile.html#module-profile Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Their are thre mistakes in this sentence. - Rob Ray

Re: odd runtime error

2010-12-01 Thread Cameron Simpson
It would seem the import lock breaks over the fork, so that the child process doesn't hold the lock. But because it is a fork, it does not know this! (Being identical to its parent.) So you raise SystemExit, and during the stack unwind the child tries to release the lock. Which it

Re: odd runtime error

2010-12-01 Thread Cameron Simpson
that look like this: def main(argv): ... parse args, do stuff ... return exit_status ... functions, classes etc ... if __name__ == '__main__': sys.exit(main(sys.argv)) It seems fairly effective for keeping the top level logic up the top. Cheers, -- Cameron Simpso

Re: os.path.isfile and wildcard for directory name

2010-12-30 Thread Cameron Simpson
$mypath/$myfile ] [...] Check out the glob module: http://docs.python.org/library/glob.html#module-glob Use it to do the glob, then os.path.isfile with a path constructed from the result: http://docs.python.org/library/os.path.html#os.path.isfile Cheers, -- Cameron Simpson DoD#743 http

Re: Call to Update All Tutorials to Python3.x Standards.

2011-02-13 Thread Cameron Simpson
e only troll here is YOU! [...] I confess to finding these two sentences in your message contradictory. Again, my poor comprehension skills must be to blame. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ That's just the sort of bloody stupid name they would choose

Re: Is this a bug of str.join?

2011-02-16 Thread Cameron Simpson
-c possibly sent off into a temp file. That will let you see what character are actually escaping from the program (versus terry's suggestion, which is good for looking at the characters before they escape). Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I'm not making any of this up you know. - Anna Russell -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie getting desperate with for

2011-02-17 Thread Cameron Simpson
ystem) this is a problem. The "env" command is actually a special hook for setting environment variables before running a command, but without extra arguments is can be used to rely on $PATH to find the command. So the command: /usr/bin/env python incantation finds "the python th

Re: Newbie getting desperate with for

2011-02-17 Thread Cameron Simpson
e original python snippet. If so, my apologies for the long misanswer. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I was gratified to be able to answer promptly and I did. I said I didn't know. - Mark Twain -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use Python well?

2011-02-19 Thread Cameron Simpson
Writing man pages in nroff is a bit tedious (though actually not all that hard). Generating man pages from POD or some other similarly friendly format is easy and desirable. | Except possibly as the automated output of some multi-target | documentation system which produces them as a by-product

Re: How to use Python well?

2011-02-19 Thread Cameron Simpson
The tag closing etc is a PITA, I agree. Of course, in nroff you'd be going: .H1 A Level One Heading paragraph blah blah ... No tedious closing tags there! CCheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ (about SSSCA) I don't say this lightly. However, I real

Re: SEC proposes the use of Python and XML

2010-04-11 Thread Cameron Simpson
sts (eg running as validation of a live transaction stream, or in some audit mode) it may be less useful than one might hope. Of course, if they're gone as far as requiring python code, perhaps that's exactly what they hope to be able to do. Cheers, -- Cameron Simpson DoD#743 http:

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread Cameron Simpson
of (value, key) pairs using zip(): pairs = zip(d.values(), d.keys()). BTW, I got to that particular piece of text by starting at the doco for the .values() method of "dict", which links to the .items() method. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I cou

Re: dict.keys() and dict.values() are always the same order, is it?

2010-04-19 Thread Cameron Simpson
On 19Apr2010 21:31, alex23 wrote: | Cameron Simpson wrote: | >   If items(), keys(), values(), iteritems(), iterkeys(), and | >   itervalues() are called with no intervening modifications to the | >   dictionary, the lists will directly correspond. This allows the | >   creation of

Python-URL! - weekly Python news and links (Mar 9)

2010-04-21 Thread Cameron Laird
ly echoing Guido's criterion of debuggability in language design http://groups.google.com/group/comp.lang.python/msg/3ebe7a0b78086acf Editor Cameron Laird apologizes for the following three entries, which appeared in the last installment only in an unusably garbled form: There is no module

Python-URL! - weekly Python news and links (Mar 17)

2010-04-21 Thread Cameron Laird
QOTW: "... [T]hat kills yet another usage of C ..." - Maciej Fijalkowski http://morepypy.blogspot.com/2009/11/some-benchmarking.html Making operations in the Fraction class automatically return a subclass instance when called with subclass arguments: http://groups.google.com/grou

Python-URL! - weekly Python news and links (Feb 9)

2010-04-21 Thread Cameron Laird
QOTW: "You see? That's what I like about the Python community: people even apologise for apologising :)" - Tim Golden http://groups.google.com/group/comp.lang.python/msg/858d1c31d0c2adff The third alpha version of Python 2.7 is ready for testing: http://groups.google.com/group/comp

Python-URL! - weekly Python news and links (Apr 21)

2010-04-21 Thread Cameron Laird
QOTW: "There's no RightAnswer(tm), just our best guess as to what is the most useful behavior for the most number of people." - Raymond Hettinger http://groups.google.com/group/comp.lang.python/msg/e7f78ef27811781b First beta version of Python 2.7 is available: http://groups.google.

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-22 Thread Cameron Simpson
quot; etc in the test to get the right names. However, that means the unit test knows its own filename/module-name. This doesn't feel totally nice. Remarks, anyone? -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ I have an inferiority complex, but it isn't a very good one. - Bill Garrett -- http://mail.python.org/mailman/listinfo/python-list

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
("dev" is a wrapper to set PYTHONPATH to use my work area, etc). Since I've convinced myself that my previous practices were inherently instantiating node.py twice with different names, I guess I can say my problem is solved, for some definition of the term:-) Cheers, -- Camer

question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
#x27;t_ want to duck-type the Node and merely test for "type" and "name" values, because I want to be rather picky about what gets into the backend database - the wrong types indicate bad app code, and should not be allowed to introduce corrupt database values. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ That particular mistake will not be repeated. There are plenty of mistakes left that have not yet been used. - Andy Tanenbaum -- http://mail.python.org/mailman/listinfo/python-list

Re: question about an exciting gotcha for unittests (and elsewhere) ...

2010-04-23 Thread Cameron Simpson
On 23Apr2010 13:25, Peter Otten <__pete...@web.de> wrote: | Cameron Simpson wrote: | > and it's failing. I've traced the failure cause, ending up with this | > assertion message from the end of serialise() above: | > | > AssertionError: HOST:fo

Re: replacing words in HTML file

2010-04-28 Thread Cameron Simpson
a good job of this, coping even with typical not quite right HTML. It gives you a parse tree you can easily walk, and you can modify it in place and write it straight back out. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ The Web site you seek cannot be located but end

Re: replacing words in HTML file

2010-04-29 Thread Cameron Simpson
On 29Apr2010 05:03, james_027 wrote: | On Apr 29, 5:31 am, Cameron Simpson wrote: | > On 28Apr2010 22:03, Daniel Fetchinson wrote: | > | > Any idea how I can replace words in a html file? Meaning only the | > | > content will get replace while the html tags, javascript, & css

Re: replacing words in HTML file

2010-04-29 Thread Cameron Simpson
On 30Apr2010 07:15, Stefan Behnel wrote: | Cameron Simpson, 30.04.2010 00:47: | >Here's a function from a script I wrote to bulk edit a web site. I was | >replacing OBJECT and EMBED nodes with modern versions: | > | > def recurse(node): | > global didmod | > [..

Re: strange interaction between open and cwd

2010-05-03 Thread Cameron Simpson
ms) '.' and '..' are just pointers to "here" and "up". Your rmdir has detached the current directory from the one that was "up", but the "up" pointer still references the old parent. There's just no filesystem path that refers to you

Re: Recursive functions not returning lists as expected

2010-05-03 Thread Cameron Simpson
e(x[1:], y + [x[0]]) Otherwise the function returns None. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ [...] every time you touch something, if your security systems rely on biometric ID, then you're essentially leaving your pin number on a post-it note. - Ben Gold

Re: strange interaction between open and cwd

2010-05-04 Thread Cameron Simpson
wed to do it). | | i think there are versions of mac osx that use hard-linked | directories in their backup systems. I believe TimeMachine exploits that. I think one can make loops with recursive mounts. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ You can't go around hop

Re: strange interaction between open and cwd

2010-05-05 Thread Cameron Simpson
t tell | whether 'boot' or 'home' is the correct next parent if it only | checks the inode number? i think the algorithm would at least need | to take account of changes in the current device id. not sure | whether that would be enough to cover all cases, though. Look at the st_rdev fi

Re: strange interaction between open and cwd

2010-05-05 Thread Cameron Simpson
On 06May2010 05:24, Nobody wrote: | On Thu, 06 May 2010 10:21:45 +1000, Cameron Simpson wrote: | | > Look at the st_rdev field (== the device holding this inode). | > When that changes, you've crossed a mount mount point. | | st_dev reports the device on which the inode resides. | |

Python-URL! - weekly Python news and links (May 5)

2010-05-06 Thread Cameron Laird
[Authored by Gabriel Genellina.] QOTW: "Even on alt.haruspicy they cannot do much without a liver now and then..." - Peter Otten http://groups.google.com/group/comp.lang.python/msg/7852938d0b92bd7b Mixing bytes and unicode when writing data in Python 3.x: http://groups.google.com.a

Re: question on logging module

2010-05-18 Thread Cameron Simpson
e point out what's problem? I don't suppose you have a file called "logging.py" in your working directory? Python will find it before the system libraries; it is a bad idea to name .py files the same as library module for this reason. Cheers, -- Cameron Simpson DoD#743 http://w

Re: atexit/signal for non-interactive jobs

2010-05-26 Thread Cameron Simpson
| handler for SIGTERM, which apparently never gets called). I hate to tell you this, but ^C sends SIGINT, not SIGTERM. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ To have no errors Would be life without meaning No struggle, no joy - Haiku Error Messages http

Re: Hashbang error

2010-06-01 Thread Cameron Simpson
avoid this error when I create the script on a windows | machine? The standard approach is to copy the file to the unix machine and use the dos2unix command. -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ A pessimist is an optimist in full possession of the facts. -- http

Re: bz2 module doesn't work properly with all bz2 files

2010-06-04 Thread Cameron Simpson
usually much faster than bz2. Have you tested the decompression or the problematic files with the bunzip2 command? Just to ensure the bug is with the python bz2 module and not with the pbzip2 utility? -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ A lot of people don't know

Python-URL! - weekly Python news and links (Jun 6)

2010-06-07 Thread Cameron Laird
QOTW: "... it's just laziness and hubris passed off under the banner of agility." - Clifford Heath, on the fashion of justification of "metaschemas" because those darn data architects are just too slow Efficient way to apply a function to every element in a list, discarding the results:

Re: Community (A Modest Proposal)

2010-06-12 Thread Cameron Simpson
y can endure. I will bring some positive attitudes to this | group if it's the last thing i do! That will be my contribution to | this group, and it may just save the Python community as a whole! Hmm. Your efforts are misdirected. It would be better to devote your energies to implementing so

Re: file handling

2010-06-13 Thread Cameron Simpson
file. You might try searching for "processing open document format with python" or something like that. You haven't, btw, said what you hoped to achieve above. I'm presuming you're after the "text" content of the ODT document. Cheers, -- Cameron Simpson

Re: file handling

2010-06-14 Thread Cameron Simpson
Please don't top post; post below and trim the content. Also, please do a reply-to-all to keep the discussion on the list. Further content is below... On 14Jun2010 11:44, madhuri vio wrote: | On Mon, Jun 14, 2010 at 11:39 AM, Cameron Simpson wrote: | > ODT files are _not_ text fil

Re: Community (A Modest Proposal)

2010-06-15 Thread Cameron Simpson
yntactically correct and correctly spelt code text faster than I, but I don't think that's where the majority of my screen time goes. Good docs (clean well indexed HTML, like javadoc and the python docs) and a good HTML reader for me, rather than code completion. Cheers, -- Cameron Simpson D

Python-URL! - weekly Python news and links (Jun 16)

2010-06-16 Thread Cameron Laird
QOTW: "Python advocacy seems to be by example, not cheerleading." - Cameron Simpson http://groups.google.com/group/comp.lang.python/msg/2cc7e643702d0ec8 The first release candidate of Python 2.7 is now available for testing: http://groups.google.com/group/comp.lan

Re: GUIs - A Modest Proposal

2010-06-16 Thread Cameron Laird
On Jun 6, 5:49 pm, Kevin Walzer wrote: . [much wisdom, particularly in regard to Tkinter] . . > > The very diversity of GUI toolkits came into effect because Python is > very easy to extend and integrate with other C/C++ libraries. Writing a > GUI toolkit from scratch is much, muc

Re: basic doubt

2010-06-17 Thread Cameron Simpson
e "partial" function: f2 = functools.partial(f, arg1, arg2, ...) Then calling f2() will call f(arg1, arg2, ...). So you can pass "f2" to an event handler. Of course, this means you need to know arg1 etc in advance. However, you really do need to show the calling end of

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Cameron Simpson
r choice, such as that in the random module. Then binary search the list for the matching item. The list scales linearly as the number of choices, not exponentially with the precision of the proportions. The search is logarithmic with the number of choices. Beyond a very small number of choices the

Python-URL! - weekly Python news and links (Jun 22)

2010-06-22 Thread Cameron Laird
QOTW: "It's hard to overestimate the variance you'll see when you start asking your users for information." - Cody Powell http://www.codypowell.com/taods/2010/01/production-aint-pretty-a-case-for-excessive-application-logging.html The second Release Candidate of Python 2.7 is available fo

Re: Why Is Escaping Data Considered So Magical?

2010-06-24 Thread Cameron Simpson
. I do what you suggest (make SQL statements at need) using SQLalchemy all the time. It is simple and easy and _robust_ against odd data. The number of times I've had to fix/remove insert-values-into-SQL-text code ... -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Plague, Fami

Re: Why Is Escaping Data Considered So Magical?

2010-06-24 Thread Cameron Simpson
ause havoc when inserted with correctly escaped parameter values if I tried, probably using quotes in the SQL typo part. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ George, discussing a patent and prior art: "Look, this publication has a date, the patent has a prior

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Cameron Simpson
ring function by it's name. Bah. It's for copying a _string_ into a _buffer_! Strangely, since it starts with a string (NUL-terminated byte sequence) it begins with "str". And it _is_ copying, but not into another string. It is special purpose but perfectly reasonable for t

Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Cameron Simpson
On 30Jun2010 12:19, Paul Rubin wrote: | Cameron Simpson writes: | > The original V7 (and probably earlier) UNIX filesystem has 16 byte directory | > entries: 2 bytes for an inode and 14 bytes for the name. You could use 14 | > bytes of that name, and strncpy makes it effective to work

Re: Solutions for hand injury from computer use

2010-07-01 Thread Cameron Simpson
brush as a mouse click:-( The Mac's click-to-focus model may also be helping me here - my thinkpad desktop would be UNIX X11 in focus-follows-mouse mode, which is far more sensitive to trouble from accidental mouse movement. But yes, the trackpoint _greatly_ reduced my need to move my a

Re: About new urllib.request in python 3.1.2

2010-07-10 Thread Cameron Simpson
to use the http library module. Rename your http.py file to "my-http-test.py" and retry. Then its name won't get in the way of the library name. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Success in software development depends on making a carefully pl

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-12 Thread Cameron Simpson
answer the phone and say "Hello, Steven | > speaking?" I often get called Peter. | | Er, without the question mark. Ah, so you get differing results when you use the question mark? Phonetic punctuation; Victor Borge would be proud. -- Cameron Simpson DoD#743 http://www.cskk.ezos

Re: integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-12 Thread Cameron Simpson
mine, but I, the coder, _must_ care about the details of using non-Booleans in a Boolean context. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ It is Texas law that when two trains meet each other at a railroad crossing, each shall come to a full stop, and neither shall p

Re: write a .txt file

2010-07-12 Thread Cameron Simpson
and writes to the file _before_ the echo command gets to run. Wait for desLrr to complete before proceeding. | fileName.seek(0,2) | fileName.write ('%s %s %s \n' % (85,25,12)) | fileName.close() And the rest is ok. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.

Re: Errno 9] Bad file descriptor

2010-07-13 Thread Cameron Simpson
y. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ There is a chasm of carbon and silicon the software can't bridge - Haiku Error Messages http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html -- http://mail.python.org/mailman/listinfo/python-list

Re: write a .txt file

2010-07-13 Thread Cameron Simpson
cause you have opened the file in 'a' mode you should not need the .seek() - an "append" mode file will always write to the end of the file. So: your first problem only requires a .flush(), to empty the buffer before "echo" or "ls" runs. However, you still hav

Re: Errno 9] Bad file descriptor

2010-07-13 Thread Cameron Simpson
s usualy a bad idea to catch broad things like "Exception". It is normally better to place try/except around very small pieces of code and to catch very specific things. That way you know exactly what's going wrong and don't quietly catch all sorts of unplanned stuff. Cheer

Re: Multiprocessing zombie processes

2010-07-24 Thread Cameron Simpson
nd never waits for them _is_ bad in the long run. Process ids are often 2-byte integers on many systems for it's quite feasible to fill the table, and depending on the kernel's process table implementation a big process table might have other performance side effects. Cheers, -- Cam

Re: How to capture all the environment variables from shell?

2010-07-26 Thread Cameron Simpson
| grep R_HOME Then, presuming it shows only in the first command: export R_HOME and then try your python script again. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ It is an approved maxim in war, never to do what the enemy wishes you to do, for this reason alone, t

Re: os.fork on linux defunct

2010-07-30 Thread Cameron Simpson
l stop) but on | > linux, ps shows tcpdump as defunct process | > what am I missing? | > thanks for any help. | | I think I found it. need to call os.wait() Yep. "defunct" == "zombie". See: http://code.activestate.com/lists/python-list/580569/ Cheers, -- Cameron Simpson

avoiding top posts in gmail [was easy question on parsing python: "is not None"]

2010-08-09 Thread Cameron Simpson
osted conversations this way all the time. Works well. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ To be or not to be?Not to be. - John Slater (Arnold Schwartzenegger), _Macbeth_ (_The_Last_Action_Hero_) -- http://mail.python.org/mailman/listinfo/p

Re: How to capture all the environment variables from shell?

2010-08-10 Thread Cameron Simpson
gets sourced, because the terminal is started by the desktop manager. Once common "fix" for this is to make all new terminals run login shells. Ugh, but it does work. But it they're not login shells, people stuff everything into their .bashrc because the .profile doesn't get sourc

Re: How to capture all the environment variables from shell?

2010-08-10 Thread Cameron Simpson
t hardwire ^W either!) Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ To be positive: To be mistaken at the top of one's voice. Ambrose Bierce (1842-1914), U.S. author. The Devil's Dictionary (1881-1906). -- http://mail.python.org/mailman/listinfo/python-list

Re: Line-by-line processing when stdin is not a tty

2010-08-11 Thread Cameron Simpson
ecause many programs that change their buffering when attached to a terminal also change other behaviour, such as issuing interactiove prompts etc. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ The type syntax for C is essentially unparsable. - Rob Pike -- http://mail.py

<    18   19   20   21   22   23   24   25   >