JAPH

2005-11-12 Thread Lawrence D'Oliveiro
import sys charset = " .JPacehknorstuy" modulo = 17 s = 69859911049503515105680510599913390885187193231927247909305172858127641629 num = iter(range(2, )) while s != 1 : n = num.next() if s % n == 0 : sys.stdout.write("%s" % charset[(n - 1) % modulo]) s /= n #end if #

Re: Is there a limit to os.popen()?

2006-07-11 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Well, running the make on the command line seems to work just fine, no >errors at all. What about running it as make kernelrelease | cat This way the output goes to a pipe, which is what happens when it's c

Re: Is there a limit to os.popen()?

2006-07-12 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: >> >> >>>

Re: Hard time with installing MySQLdb for Python on Linux

2006-07-14 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "gmax2006" <[EMAIL PROTECTED]> wrote: >I am having hard time with installing MySQLdb on Linux. ... >My Linux is "Red Hat Enterprise Linux ES release 4 (Nahant)" Why don't you just use yum to install python-mysql or whatever the package is called, and have it au

Re: printing raw postscript data on windows

2006-07-14 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Uwe Schmitt <[EMAIL PROTECTED]> wrote: >I am trying to print raw postscript data on windows. >win32print should do the work like this: > > h=win32print.OpenPrinter(name) > win32print.StartDocPrinter(h, 1, ("", "", "RAW")) > win32print.WritePrinter(h, file("p.

Re: stderr, stdout, and errno 24

2006-07-15 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Wesley Henwood" <[EMAIL PROTECTED]> wrote: >I've checked and double checked my code and I am closing all files >explicitly after opening them. If you're running your program under Linux, a very easy way to confirm this is to look in the directory /proc//fd

Re: Is there a limit to os.popen()?

2006-07-15 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: >If you are seeing alot of error messages you shoudl really redirect the >standard error to a file to avoid them cluttering up your console. Surely a better technique would be to fix the errors causing the messages. -- ht

Re: CPU or MB Serial number

2006-07-15 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Sybren Stuvel <[EMAIL PROTECTED]> wrote: >Bayazee enlightened us with: >> How can I get CPU Serial number , or motherboard serial number with >> python . I need an idetification of a computer > >Not sure if that'll be sufficient. My serial numbers (according t

Re: reading specific lines of a file

2006-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Bill Pursell wrote: > >> Some might argue that this is not really doing >> it in Python. In fact, I would argue that! But if >> you're at a command prompt and you want to >> see line 7358, it's much easier to type >> % sed -n 7358p >> than

Re: reading specific lines of a file

2006-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Yi Xing wrote: > I want to read specific lines of a huge txt file (I know the line #). > Each line might have different sizes. Is there a convenient and fast > way of doing this in Python? Thanks. file("myfile.txt").readlines()[LineNr] Convenient, yes. Fast, n

Re: Coding style

2006-07-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bob Greschke wrote: > I'd go even one step further. Turn it into English (or your favorite > non-computer language): > > 1. While list, pop. > > 2. While the length of the list is greater than 0, pop. > > Which one makes more sense? Guess which one I like. CPU

Re: Object Persistence Using a File System

2006-07-18 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Chris Spencer wrote: > I've been looking for a method of transparent, scalable, and > human-readable object persistence... Don't do object persistence. What is an object? It's a combination of code and data. Code structure is internal to your program--it has no bus

Re: Coding style

2006-07-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bruno Desthuilliers wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Bob Greschke >> wrote: >> >> >>>I'd go even one step further. Turn it into English (or your favorite >>>

Re: Coding style

2006-07-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Georg Brandl wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Bob Greschke >> wrote: >> >>> I'd go even one step further. Turn it into English (or your favorite >>> non-computer

Re: mysqldb problem

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, liupei wrote: > when I set mysql some fields collate utf8_bin, and then fetch these > fields is array.array,not the string I expected Can you post some example code? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to know if socket is still connected

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > If the server has closed the connection, then a recv() on the > socket will return an empty string "", and a send() on the > socket will raise an exception. Would that still apply when trying to send an empty string? -- http://mail.python.or

Re: Checking File permissions

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script Without knowing what your precise needs are, the best way is to open the file and try to read from it. If that succeeds, then you've got rea

Re: Semantics of propagated exceptions

2006-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Thomas Lotze wrote: > Suppose you have a function f which, as part of its protocol, raises some > standard exception E under certain, well-defined circumstances. Suppose > further that f calls other functions which may also raise E. How to best > distinguish whether

Re: New to threads. How do they work?

2006-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, gel wrote: > I am attempting to understand threads to use in a network app which I > am writing. It is written, somewhere in the philosophy of *nix programming, that threads are a performance hack, to be avoided wherever possible. Use processes in preference to thr

Linux Kernel Testing--Why Python

2006-07-21 Thread Lawrence D'Oliveiro
Just came across this article from the Ottawa Linux Symposium, which mentions (among other things) Martin Bligh's presentation on the automated testing system used for the Linux kernel: The test system is written in Python, and he d

Re: Nested function scope problem

2006-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Justin Azoff wrote: > Simon Forman wrote: >> That third option seems to work fine. > > Well it does, but there are still many things wrong with it > > if len(tok) > 0: > should be written as > if(tok): I prefer the first way. Besides, your way is sub-opt

Re: New to threads. How do they work?

2006-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > On 2006-07-21, Lawrence D'Oliveiro <[EMAIL PROTECTED]> > wrote: >> In message <[EMAIL PROTECTED]>, gel >> wrote: >> >>> I am attempting to understand threads to use in a network app w

Re: Python newbie needs constructive suggestions

2006-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > b) give up on using an anonymous function and create a named "successor" > function with "def", This is what you have to do. For some reason mr van Rossum has this aversion to anonymous functions, and tries to cripple them as much as

Re: New to threads. How do they work?

2006-07-22 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Dennis Lee Bieber wrote: > On Sat, 22 Jul 2006 17:19:22 +1200, Lawrence D'Oliveiro > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> >> Perhaps because with threads, data is shared by default. Wh

Re: Isn't there a better way?

2006-07-22 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, T wrote: > > I am using an optparse to get command line options, and then pass them > to an instance of another class: > > > > # Class that uses optparse.OptionParser > foo = Parse_Option() > > # Class that does the real work > bar = Processor() > > bar.index

Re: Isn't there a better way?

2006-07-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bruno Desthuilliers wrote: > Lawrence D'Oliveiro a écrit : > >> If you're calling a number of different routines in >> the Processor class, all accessing the same data, then it makes perfect >> sense to only pass it once.

Re: Isn't there a better way?

2006-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Bruno Desthuilliers >> wrote: >> >> >>>Lawrence D'Oliveiro a écrit : >>> >>> >>>>If you

Re: How to force a thread to stop

2006-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Python has no threadicide method, and its absence is not an > oversight. Threads often have important business left to do, such > as releasing locks on shared data; killing them at arbitrary times > tends to leave the system in an inconsis

Re: micro authoritative dns server

2006-07-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I just want to know if anyone could help me in writing a code for > minimal authoritative dns server. You'll probably need to start by reading and understanding RFC1034 and RFC1035. -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess quote problem

2006-08-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Adriano Monteiro wrote: > "Failed to open input file "/home/adriano/umit/test/targets" for reading > QUITTING!" Which is not the same as saying: "Failed to open input file /home/adriano/umit/test/targets for reading QUITTING!" Spot the difference? > command

Re: How to get the ascii code of Chinese characters?

2006-08-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Gerhard Fiedler wrote: > >>> No. ASCII characters range is 0..127 while Unicode characters range is >>> at least 0..65535. >> >> Actually, Unicode goes beyond 65535. > > you may want to look up "at least" in a dictionary. Maybe you need to

Re: Permission Denied

2006-08-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, AlbaClause wrote: > Then, to execute the file from from the shell prompt, I had to create a > 'bin' directory in my home folder, cuz I didn't want to litter > my /usr/local/bin folder with useless Python scripts. Executable files can be kept anywhere, you don't nee

Re: Automatic import PEP

2006-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Robert Kern wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, >> Connelly Barnes wrote: >> >>> The main point of autoimp is to make usage of the interactive Python >>> prompt mor

Re: Makin search on the other site and getting data and writing in xml

2006-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Paul Boddie wrote: > Various sites forbid wget and friends as a rule, understandably ... No, that is not understandable. -- http://mail.python.org/mailman/listinfo/python-list

Re: Recursive descent algorithm able to parse Python?

2006-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Diez B. Roggisch wrote: > I have to admit that I have difficulties to compare LR(k) to recursive > descent, but the fact that the latter contains backtracking makes it at > least more powerful than LL(k) LR(k) is more powerful than LL(k). -- http://mail.python.org

Re: A critique of cgi.escape

2006-10-07 Thread Lawrence D'Oliveiro
Another useful function is this: def JSString(Str) : """returns a JavaScript string literal that evaluates to Str. Note I'm not worrying about non-ASCII characters for now.""" Result = [] for Ch in Str : if Ch == "\\" : Ch = ""

Re: Making sure script only runs once instance at a time.

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Tim Williams wrote: > On 29/09/06, Matthew Warren <[EMAIL PROTECTED]> wrote: >> I have found that in real usage of other programs within the company that >> use lockfiles, it sometimes causes a bit of troubleshooting time when it >> stops working due to a stale lock

Re: People's names (was Re: sqlite3 error)

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > John Machin wrote: > > [lots of explanation about peculiarities of people's names] > > While I don't dispute any of this erudite display of esoteric > nomenclature wisdom the fact remains that many (predominantly Western) > databases do tend to

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, James Stroud wrote: > Patently. Tabs should be reserved for tables, for which tabs were named. > If they were meant to be used for indenting, they would have been > named "indenters". Really? I thought they were for tabulators

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sam wrote: > i'm still in the early stages, and am trying to code something simple > and interactive to get the percentages of the portfolio in the five > different investment categories. i thought i'd get in with the error > handling early so if someone types in so

Re: Names changed to protect the guilty

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, John Machin wrote: > > Steven D'Aprano wrote: >> On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote: >> >> > >> > MonkeeSage wrote: >> >> On Oct 6, 8:02 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: >> >> > it is clearer to you to make the condition explicit ("bla

Re: Kde Taskbar

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, David Boddie wrote: > I'd be interested in an example of how to use knotify via DCOP. Found a tutorial here . -- http://mail.python.org/mailman/listinfo/python-list

Re: People's names (was Re: sqlite3 error)

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, John Machin wrote: > Two problems so far: > (1) If you then assume that you should print the phone directory in > order of family name, that's not appropriate in some places e.g. > Iceland; neither is addressing Jon Jonsson as "Mr Jonsson", and BTW it > can be their

Re: testing machine responsiveness

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Tim Arnold wrote: > try: > s.connect((cpu,7)) > except: > return 0 > try: > s.send('test') > s.recv(128) > s.close() > return 1 > except: > return 0

Re: Asychronous execution *with* return codes?

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, utabintarbo wrote: > Justin wrote: >> If you're on a POSIX system, you could use the usual fork/exec/wait: >> > Sorry. Win32. We are only allowed spoons - no sharp objects. :-P How about installing Cygwin, then, and running under that? -- http://mail.python.org/m

Re: CGI Tutorial

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Credit card numbers should be encrypted in the database, of course, but > they rarely are (even by companies whose reputations imply they ought to > know better). How would encryption help? They'd still have to be decrypted to be used. -- htt

Re: CGI Tutorial

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Clodoaldo Pinto Neto wrote: > 2006/10/4, Tim Chase <[EMAIL PROTECTED]>: > >> The code is very dangerous...allowing any ol' schmoe to run >> arbitrary code on your server. At the barest of minimums, I'd >> plaster the code with warnings that this is a Very Dangerous

Re: changing a file's permissions

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Max Erickson wrote: > James <[EMAIL PROTECTED]> wrote: > >> So my question is: how does one change a file's permissions >> inside of python? > > Assuming you want to operate on the output file: > > import os > os.chmod(path, 755) Shouldn't that be os.chmod(p

Re: Why do this?

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Duncan Booth wrote: > Corrado Gioannini <[EMAIL PROTECTED]> wrote: > >> I often do things like this: >> >> sql = a_complex_select_sql % (id_foo, value_bar, ...) >> cursor.execute(sql) >> >> inside the body of a function (or a class method), where >> a_complex

RE: Why do this?

2006-10-08 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Tim Golden wrote: > [Matthew Warren] > | But nowadays, I see things like this all over the place; > | > | print("There are %s ways to skin a %s" % (number, furryanimal)) > > The outermost brackets are (at the moment) unnecessary in python, > altho' print is slated

Re: Why do this?

2006-10-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Duncan Booth wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > >> I use the above when I can, when I can't I fall back on >><http://groups.google.co.nz/[EMAIL PROTECTED]>, >><http://groups.google.c

Re: People's names (was Re: sqlite3 error)

2006-10-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Hendrik van Rooyen wrote: > "Lawrence D'Oliveiro" <[EMAIL PROTECTED]> wrote: > > 8< > >> I wonder if we need another "middle" field for holding the

Re: CGI Tutorial

2006-10-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Steve >> Holden wrote: >> >> >>>Credit card numbers should be encrypted in the database, of course, but >>>they rarel

So what would Python be?

2006-06-03 Thread Lawrence D'Oliveiro
Just wondering... -- http://mail.python.org/mailman/listinfo/python-list

Re: Large Dictionaries

2006-06-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Scott David Daniels <[EMAIL PROTECTED]> wrote: >For example, time timsort (Python's internal sort) on pre-sorted >data; you'll find it is handled faster than random data. But isn't that how a reasonable sorting algorithm should behave? Less work to do if the data

Re: summarize text

2006-06-05 Thread Lawrence D'Oliveiro
... sorry, I thought you said "summarize Proust". :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Large Dictionaries

2006-06-08 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Tim Peters" <[EMAIL PROTECTED]> wrote: >For example, the O(N log N) heapsort is unreasonable compared to the >O(N**2) bubblesort by that reasoning (pre-sorted is actually a bad >case for heapsort, but a good case for bubblesort)? O(N log N) >sorting algorithms he

Re: Large Dictionaries

2006-06-08 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Iain King" <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> Scott David Daniels <[EMAIL PROTECTED]> wrote: >> >> >For example, time timsort (Pyth

Re: How to generate all permutations of a string?

2006-06-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Girish Sahani" <[EMAIL PROTECTED]> wrote: > I want to generate all permutations of a string. def permute(Seq) : """generator which yields successive permutations of the elements of Seq.""" if len(Seq) == 0 : yield () else : for i

Re: Cycles between package imports

2006-06-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Martin Blais" <[EMAIL PROTECTED]> wrote: >On 18 Jun 2006 05:25:14 -0700, John Roth <[EMAIL PROTECTED]> wrote: > >> The general rule is: don't do that. It doesn't work, and the >> hoops you have to go through to force it to work are so >> complex and bizzare that t

Re: popen2 question

2006-06-25 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, David Bear <[EMAIL PROTECTED]> wrote: >I'm using popen2 and getting an extra 1 at the end of my output. I didn't >see where this was explained in the docs so I clearly don't understand the >behavior. My code is simple. > >(input, output) = os.popen2('whackyperlprog

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: >... let's try some google searches and see the number of million hits...: But how reliable are those estimates of numbers of hits, anyway? More than once I've got a page showing something like "Results 1 - 10 of about 36

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Mirco Wahab <[EMAIL PROTECTED]> wrote: >C++ programming requires you to massively invest your thinking >first into the setup of your build environment ... I don't understand why. It's easy enough to build small programs with a single g++ command. -- http://mail.

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Mirco Wahab <[EMAIL PROTECTED]> wrote: >Thus spoke Lawrence D'Oliveiro (on 2006-06-26 09:21): > >> In article <[EMAIL PROTECTED]>, >> Mirco Wahab <[EMAIL PROTECTED]> wrote: >> >>>C++ programming re

Re: Python taught in schools?

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Gary Duzan) wrote: > I understand that the school switched [from C++] to Java a short > time later, which is some improvement, but still has a good bit of > baggage. Java started out trying to avoid most of the complexities of C++, but ended

Re: Having problems with strings in HTML

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Kiana Toufighi <[EMAIL PROTECTED]> wrote: >print ''' >href="http://bbc.botany.utoronto.ca/ntools/cgi-bin/ntools_treeview_word.cgi?inp >ut=&max=2&values_off=no&remove_bracket=no&show_line_nr=yes&show_link_out=yes&de >cimal_places=10&show_classification=y

Re: Execute Commands on Remote Computers over Network

2006-06-26 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "dylpkls91" <[EMAIL PROTECTED]> wrote: >I have been researching this topic and come up with some code to make >it work. It uses SSL and requires the 3rd party package Paramiko (which >requires PyCrypto). Why not just spawn an invocation of SSH? -- http://mail.pyt

Re: Having problems with strings in HTML

2006-06-28 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Richard Brodie" <[EMAIL PROTECTED]> wrote: >"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >>>By the way, you _do_ realize that your "&" characters should be escaped >>>as "&", don't you? >> >> No they shouldn't. They part of the

Re: Select in Python

2006-06-29 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Gary Herron <[EMAIL PROTECTED]> wrote: >If you want select to start blocking again, you must read all bytes from >stdin whenever select says there are bytes to be read. To add to this, it is a good idea to read the select_tut(2) man page, particularly the "SELECT

Re: Execute Commands on Remote Computers over Network

2006-06-29 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "dylpkls91" <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> "dylpkls91" <[EMAIL PROTECTED]> wrote: >> >> >I have been researching this top

Re: Passing a Cookie with httplib

2006-06-29 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >I would like to >hard code the cookie in the code so it works every time: > >i.e. cookie = 'auth=buster%3A12345678901234567890exZ9rzMqgtxa5A'. > >conn=httplib.HTTPConnection(WP_SERVER) >conn.request('GET',WP_PATH % uservalue)

Python docs bug

2006-06-29 Thread Lawrence D'Oliveiro
One long-standing irritation I have with the table of contents for the Python Library Reference , is that there is one very important section, "String Methods" , which does not appear there. That's because it i

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Michael Butscher <[EMAIL PROTECTED]> wrote: >Normally any user could connect to an open socket on a machine >regardless which user established the socket (the user's program, to be >precise). That's not true. On *nix systems, a socket is a file, and is subject

Re: Interprocess communication on multi-user machine

2006-06-30 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: >In article <[EMAIL PROTECTED]>, >Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: >|> In article <[EMAIL PROTECTED]>, >|> Michael Butscher <[EMAIL PROTECTED]> wrote:

Re: Interprocess communication on multi-user machine

2006-07-01 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: >In article <[EMAIL PROTECTED]>, >Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: >|> > >|> >Sockets are often accessed via special files, but are not files. >|> >|&

Re: MySQLdb not updating rows

2006-07-01 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Bowen" <[EMAIL PROTECTED]> wrote: >In article <[EMAIL PROTECTED]>, Benjamin Niemann <[EMAIL PROTECTED]> >wrote: > >>Another side note: don't build your queries using (dumb) string formatting, >>let the MySQLdb module do it for you. > >Thanks for that tip, it's a

Re: slow non-blocking reads

2006-07-01 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Mark Dufour" <[EMAIL PROTECTED]> wrote: >any thoughts about why this runs extremely slowly? Because both processes are chewing up most of your CPU each waiting for the other to do something. -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin and two CTRL-Ds

2006-07-01 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >-u unbuffers sys.stdout >and sys.stderr (and makes them binary, which wouldn't be a good idea on >a Windows box). Why not? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I do it using python?? about xterm and telnet

2006-07-02 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "valpa" <[EMAIL PROTECTED]> wrote: >I'm a net admin for about 20 unix servers, and I need to frequently >telnet on to them and configure them. >It is a tiring job to open a xterm and telnet, username, password to >each server. Do you need to replicate identical co

Re: Can I do it using python?? about xterm and telnet

2006-07-02 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "placid" <[EMAIL PROTECTED]> wrote: >Jim Segrave wrote: > >> Don't use telnet. it's clumsy and has security issues. > >if youre behind a firewall then it shouldnt matter. Still not a good idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin and two CTRL-Ds

2006-07-02 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >On 2/07/2006 3:48 PM, Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> John Machin <[EMAIL PROTECTED]> wrote: >> >>> -u unbuffers sys.stdout >

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >On 3/07/2006 4:45 PM, Lawrence D'Oliveiro wrote: > >> I thought Windows (the NT line) was >> POSIX-compliant. > >What on earth gave you that idea? <http://fuckinggo

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "valpa" <[EMAIL PROTECTED]> wrote: >I don't care about security issue by now :), because every one in my >compony know the username/password. Then why bother with a password at all? -- A: Skid-marks in front of the hedgehog. Q: What's the difference between a dea

Re: Turning a callback function into a generator

2006-07-03 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Kirk McDonald <[EMAIL PROTECTED]> wrote: >I want to somehow, in some way, provide an iteration interface to this >function. Thoughts? Run it in a separate thread/process? -- http://mail.python.org/mailman/listinfo/python-list

Re: slow non-blocking reads

2006-07-05 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Mark Dufour" <[EMAIL PROTECTED]> wrote: >interestingly, leaving out the fcntl stuff makes it work much faster. No surprises there... -- http://mail.python.org/mailman/listinfo/python-list

Re: strange i/o delay problem in socket

2006-07-07 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >while in most cases, the time needed for a handler thread to read the >request line from the socket is below 1 millisecond, there are some >cases this time is over severl thousand (or even higher) milliseconds. >I'm j

Re: Detecting 64bit vs. 32bit Linux

2006-07-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, dwelch91 <[EMAIL PROTECTED]> wrote: >I need to detect whether the operating system I am running on (not the >Python version) is 64bit or 32bit. One requirement is that I need to >include support for non-Intel/AMD architectures. The standard C way would be to che

Re: Running multiple versions of Python on the same host..

2006-07-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Cowmix" <[EMAIL PROTECTED]> wrote: >What is the best way to run multiple version of Python on the same >system? You could use chroot. Ask if you want more details. -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting 64bit vs. 32bit Linux

2006-07-11 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Robin Becker <[EMAIL PROTECTED]> wrote: >Michael Yanowitz wrote: >.. >> >>> I need to detect whether the operating system I am running on (not the >>> Python version) is 64bit or 32bit. One requirement is that I need to >>> include support for non-Intel/AMD

Re: new string method in 2.5 (partition)

2006-09-22 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > ... a python string has both a length *and* a null terminator (for > ease of interfacing C routines ... How does that work for strings with embedded nulls? Or are the C routines simply fooled into seeing a truncated part of the string? --

"re" vs "sre"?

2006-09-23 Thread Lawrence D'Oliveiro
I learned about Python regular expressions from the Web documentation . This describes a module named "re". Then I saw some code written by a colleague, and he was using a module named "sre". I checked my Python 2.4.3 installation, and sure enough, I have a modu

A critique of cgi.escape

2006-09-23 Thread Lawrence D'Oliveiro
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if you pass a second argument of True (the default is False): >>> cgi.escape("the \"quick\" & fox"

Re: Python and checked exceptions

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Kay Schluehr wrote: > A new cookbook recipe suggesting two decorators @throws and @catches > for treatment of checked exceptions in Python: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498131 > > This might be of practical interest for some and theo

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bjoern Schliessmann wrote: > In my C++ code, > it happens so often that I forget or overread a "!". And if I want > to understand my functions later on, my brain quite wrinkles > looking at parentheses, !s, &&s and ||s. Which is why C++ allows "not", "and" and "or"

Re: Isn't bool __invert__ behaviour "strange"?

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, MonkeeSage wrote: > I don't really see anything wrong with creating a custom class for > evaluating those kinds of logical statements. It does make the code for > statements more concise and easy to follow (with less binding > ambiguity). Why not express everything

Re: "re" vs "sre"?

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Peter Otten wrote: > Lawrence D'Oliveiro wrote: > >> I learned about Python regular expressions from the Web documentation >> <http://docs.python.org/lib/lib.html>. This describes a module named >> "re". Then

QuoteSQL

2006-09-23 Thread Lawrence D'Oliveiro
Why doesn't MySQLdb provide a function like this: def QuoteSQL(Str, DoWild) : """returns a MySQL string literal which evaluates to Str. Needed for those times when MySQLdb's automatic quoting isn't good enough.""" Result = [] for Ch in str(Str) : if Ch == "\0" :

Re: QuoteSQL

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Anders J. Munch wrote: > Lawrence D'Oliveiro wrote: >> Why doesn't MySQLdb provide a function like this: >> >> def QuoteSQL(Str, DoWild) : >> """returns a MySQL string literal which evaluates to S

Re: A critique of cgi.escape

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Lawrence D'Oliveiro wrote: > >> So I think the default for the second argument to cgi.escape should be >> changed to True. Or alternatively, the second argument should be removed >> altogether,

Re: A critique of cgi.escape

2006-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Jon Ribbens wrote: > In article <[EMAIL PROTECTED]>, Fredrik > Lundh wrote: >> Lawrence D'Oliveiro wrote: >>> >>> So I think the default for the second argument to cgi.escape should be >>> changed to True.

  1   2   3   4   5   6   7   8   9   10   >