ElementTree xmlns:xsi question

2006-11-28 Thread Craig
Hi there, I'm generating an XML script using ElementTree which has the following attributes in the root element: http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="code/can.xsd"> My python script I have written is: root = Element("CANmessages", xmlns:xsi="http://www.w3.

Re: Really closing stdout (was: "fork and exit" needed?)

2006-11-28 Thread Mitja Trampus
Nick Craig-Wood wrote: >>> open STDOUT, '>/dev/null'; >> sys.stdout = open(os.devnull, 'w') > $ ls -l /proc/32004/fd > total 4 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 0 -> /dev/pts/17 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 1 -> /dev/pts/17 > lrwx-- 1 ncw ncw 64 Nov 28 09:55 2 -> /dev/pts/17

Re: "fork and exit" needed?

2006-11-28 Thread Vincent Delporte
On Tue, 28 Nov 2006 08:30:03 -0600, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> import os,sys,time >> print "pre:", os.getpid() >> sys.stdout = open(os.devnull, 'w') >> print "post:", os.getpid() >> time.sleep(60) >> >> (Granted, I'm on WinXP; I also suspect the original stdout is still op

why would anyone use python when java is there?

2006-11-28 Thread gavino
wtf -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-28 Thread Aahz
In article <[EMAIL PROTECTED]>, gavino <[EMAIL PROTECTED]> wrote: > >wtf Because programming in Python makes me feel happy and contented, while programming in Java just makes me want to scream in agony. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ Usenet is not a

Re: why would anyone use python when java is there?

2006-11-28 Thread Martin P. Hellwig
Aahz wrote: > In article <[EMAIL PROTECTED]>, > gavino <[EMAIL PROTECTED]> wrote: >> wtf > > Because programming in Python makes me feel happy and contented, while > programming in Java just makes me want to scream in agony. Or in my case, Python made me code, Java made me brew java. ymmv -- mp

RE: why would anyone use python when java is there?

2006-11-28 Thread Éric Daigneault
> wtf a reasonable question... But before I run circle yelling "the trolls are here, the trolls are here" I got one for you... why would anyone use java when python is there?? ;-) .^_^. Eric :D, -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-28 Thread gregarican
gavino wrote: > wtf You have to be trolling I would think. For most people I think they would like to code in Python if they had a personal choice. But for professional reasons they are likely forced to code in Java because of the sheep mentality of the large corporate drone-dom that's out there.

Re: Error handling. Python embedded into a C++ app.

2006-11-28 Thread [EMAIL PROTECTED]
You would use try: and then on the next line except: I am not sure what the best answer is but you could write your errors to a file and then load them if all else fails. https://sourceforge.net/projects/dex-tracker Wolfram wrote: > I have a problem with displaying errors in an embedded situat

Re: Floating Exception

2006-11-28 Thread John Machin
Jeremy wrote: > Hi, > > I just changed some previously-working Python program to add a C++ > extension. > > Now, when I call __init__() in a Python class I did not change and with the > same arguments passed, I get the screen message 'Floating exception' and the > program seems to stop. The exact p

Re: why would anyone use python when java is there?

2006-11-28 Thread Jonathan Smith
gavino wrote: > wtf Java is a coffee, and coffee comes from exploited Ethiopians (they do have some damn fine coffee, though). Most of us prefer to exploit Englishmen instead. (damn them and their humor!) -smithj -- http://mail.python.org/mailman/listinfo/python-list

Re: HTML Table-of-Content Extraction Script

2006-11-28 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > robert wrote: > > > I'm looking for a function which extracts a table of contents > > of HTML file(s) from ... > > and possibly auto-creates the ancors. > > Maybe something already exists? > > that's the kind of stuff you'll write in approximately two minutes using > Beaut

6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
(I apologise in advance for posting something slightly OT, but plead in mitigation that I'm trying to re-write an old, suboptimal VB6 (erk) brute-force attack in a shiny, elegant, pythonic manner. I would really appreciate some ideas about an appropriate algorithmic approach to this + pointers to a

Re: 6 Pick Bet Grouping

2006-11-28 Thread [EMAIL PROTECTED]
bullockbefriending bard wrote: > (I apologise in advance for posting something slightly OT, but plead in > mitigation that I'm trying to re-write an old, suboptimal VB6 (erk) > brute-force attack in a shiny, elegant, pythonic manner. I would really > appreciate some ideas about an appropriate algo

Re: why would anyone use python when java is there?

2006-11-28 Thread faulkner
functional programming, list comprehensions, decorators, duck typing, generators, dynamism, introspection, prettier code, simpler grammar [see digg and /. for the graphs], and, of course, the trolls. gavino wrote: > wtf -- http://mail.python.org/mailman/listinfo/python-list

Re: 6 Pick Bet Grouping

2006-11-28 Thread Paddy
bullockbefriending bard wrote: > e.g. we might have: > > 5 / 3 / 11 / 7 / 1 / 9 - $50 (5 to come 1st or 2nd in Race1, 3 to > come first or 2nd in Race 2, etc.) > 7 / 3 / 11 / 7 / 1 / 9 - $50 > 5 / 3 / 11 / 14 / 1 / 9 - $50 > 7 / 3 / 11 / 14 / 1 / 9 - $50 > > The totalizator system allows us

Re: 6 Pick Bet Grouping

2006-11-28 Thread [EMAIL PROTECTED]
It seems straightforward: 1 / X / X ... and 4 / X / X ... becomes 1 + 4 / X / X If there were a 6 / X / X it would become 1 + 4 + 6 / X / X I think this means that all possible combinations for any particular amount may be grouped together in a single ticket. Cheers, -T -- http://mail.python

Python program that validates an url against w3c markup validator

2006-11-28 Thread yaru22
I'd like to create a program that validates bunch of urls against the w3c markup validator (http://validator.w3.org/) and store the result in a file. Since I don't know network programming, I have no idea how to start coding this program. I was looking at the python library and thought urllib or

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread [EMAIL PROTECTED]
urls = [("/tmp/validate1.html", "http://www.theage.com.au";)] for url, outputfile in urls: commandString = 'wget -o %s http://validator.w3.org/check?uri=%s' % (outputfile, url) system.exec(commandString) is one easy way. yaru22 wrote: > I'd like to create a program that validates bunch of

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Bjoern Schliessmann
yaru22 wrote: > I was looking at the python library and thought urllib or urllib2 > may be used to make this program work. > > But I don't know how to send my urls to the w3c validator and get > the result. Another great alternative is using the Twisted framework:

Re: Question about import and sys.path

2006-11-28 Thread Frank Millman
Rob Wolfe wrote: > Frank Millman wrote: > > Hi all > > > > However, I want the ability to have duplicate program names stored in > > different subdirectories. At the time of selecting the menu option I > > know which company is active, so I know which directory I want to run > > the program from,

Re: How to increase the speed of this program?

2006-11-28 Thread Klaas
Klaas wrote: > Klaas wrote: > > > In fact, you can make it about 4x faster by balancing: > > > > [EMAIL PROTECTED] ~]$ python -m timeit -s "from array import array" > > "array('c','\0'*200)*500" > > 1 loops, best of 3: 32.4 usec per loop > > This is an unclean minimally-tested patch which achi

Re: 6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
Your explanation is correct. It's important to realise that effectively the input many thousands of single bets come out of a black box and it is then necessary for me to merge them into the grouped format to make things more manageable. Given an arbitrary bucket of single bets, it is by no means o

Re: 6 Pick Bet Grouping

2006-11-28 Thread bullockbefriending bard
Sorry, I perhaps didn't frame my initial post very well. I hope my reply to your other post below has answered these questions. -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree xmlns:xsi question

2006-11-28 Thread Fredrik Lundh
Craig wrote: > I'm generating an XML script using ElementTree which has the following > attributes in the root element: > > http://www.w3.org/2001/XMLSchema-instance"; > xsi:noNamespaceSchemaLocation="code/can.xsd"> those are namespace declarations, and mean that tags prefixed by "xsi" really

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Fredrik Lundh
yaru22 wrote: > I'd like to create a program that validates bunch of urls against the > w3c markup validator (http://validator.w3.org/) and store the result in > a file. > > Since I don't know network programming, I have no idea how to start > coding this program. > > I was looking at the python

Re: Python program that validates an url against w3c markup validator

2006-11-28 Thread Fredrik Lundh
Fredrik Lundh wrote: > >>> f = urllib.urlopen("http://validator.w3.org/check?uri="; + uri) > >>> print f.headers here's the specification, btw: http://validator.w3.org/docs/api.html -- http://mail.python.org/mailman/listinfo/python-list

Re: 6 Pick Bet Grouping

2006-11-28 Thread Mark Peters
> The totalizator system allows us to merge or group these four bets as > follows: > > 5 + 7 / 3 / 11 / 7 + 14 / 1 / 9 - $50 ($200 total) I'm still trying to get my head around what you're trying to do, but here's some code: ---snip- data = ["5 / 3 / 11 / 7 / 1 / 9 -

<    1   2