Re: Sockets in python

2006-10-02 Thread OneMustFall
> What's your set-up and which cord are you pulling? > Well i now i think the clue is in the OS, i have sniffed and it seems that Twisted have no magic. It is seems that i simply tested things in a wrong way - when i pulled cord from ethernet card windows determined that network lost and started

Re: saving an exception

2006-10-02 Thread Steve Holden
Bryan wrote: > hi, > > i would like to save an exception and reraise it at a later time. > > > something similar to this: > > exception = None > def foo(): > try: > 1/0 > except Exception, e: > exception = e > > if exception: raise exception > > > i have a need to do

Re: app with standalone gui and web interface

2006-10-02 Thread Steve Holden
Daniel Nogradi wrote: > What would the simplest way to make an application that has both a web > interface and runs from behind a web server but also can be used as a > standalone app with a gui? More precisely is it possible to avoid > creating an html/xml/whatever based web interface for the web

Thread hijack: [was Re: php and python: how to unpickle using PHP?]

2006-10-02 Thread Steve Holden
Ted Zeng wrote: > Hi, > > I store some test results into a database after I use python > To pickle them (say, misfiles=['file1','file2']) > > Now I want to display the result on a web page which uses PHP. > How could the web page unpickle the results and display them? > Is there a PHP routine th

Re: saving an exception

2006-10-02 Thread Ben Cartwright
Bryan wrote: > i would like to save an exception and reraise it at a later time. > > something similar to this: > > exception = None > def foo(): > try: > 1/0 > except Exception, e: > exception = e > > if exception: raise exception > > with the above code, i'm able to succes

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread John Machin
Larry Hastings wrote: > > John Machin wrote: > > try benchmarking this ... well "style" may not be the appropriate word > > Running this under Python 2.5 release: > x = [] > xappend = x.append > for i in xrange(1000): > xappend("a") > y = "".join(x) > took 3281ms. > >

Re: CGI -> mod_python

2006-10-02 Thread Thomas Jollans
On Mon, 02 Oct 2006 22:07:26 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> let this slip: > Hi, > > it is a kind of nooby question. Is there a way to transfer a CGI python > script to mod_python without rewriting the code? Not that I know of, but thanks to the WSGI (specified in PEP 333: http:/

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread Larry Hastings
Fredrik Lundh wrote: > You should also benchmark this against code that uses the ordinary > append/join pattern. Sorry, thought I had. Of course, now that the patch is up on Sourceforce you could download it and run all the benchmarks you like. For all the benchmarks I ran below, the number list

saving an exception

2006-10-02 Thread Bryan
hi, i would like to save an exception and reraise it at a later time. something similar to this: exception = None def foo():     try:         1/0     except Exception, e:         exception = e if exception: raise exception i have a need to do this because in my example foo is a callback fro

Re: loop beats generator expr creating large dict!?

2006-10-02 Thread Ben Cartwright
George Young wrote: > I am puzzled that creating large dicts with an explicit iterable of > key,value pairs seems to be slow. I thought to save time by doing: > >palettes = dict((w,set(w)) for w in words) > > instead of: > >palettes={} >for w in words: > palettes[w]=set(w) > > wh

CGI -> mod_python

2006-10-02 Thread [EMAIL PROTECTED]
Hi, it is a kind of nooby question. Is there a way to transfer a CGI python script to mod_python without rewriting the code? Thanks. Bernhard -- http://mail.python.org/mailman/listinfo/python-list

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

2006-10-02 Thread MonkeeSage
Eric S. Johansson wrote: > the problem with this solution is that it does not handle the read > nonexclusive/write exclusive locking model. In this model, reads don't > block, they only register that the request is in process. writes lock > request block until all outstanding reads have completed

Re: httplib and large file uploads

2006-10-02 Thread Eric S. Johansson
Jesse Noller wrote: > Hey All, > > I'm working on an script that will generate a file of N size (where N is > 1k-1gig) in small chunks, in memory (and hash the data on the fly) and > pass it to an httplib object for upload. I don't want to store the file > on the disk, or completely in memory a

Re: [Q]An error with my module in C

2006-10-02 Thread Robert Kern
Jia,Lu wrote: > hello,all. > > I wrote a module in C as below, BUT msg() method cannot work > allright. > > #include > #include This isn't related to your error, but you should include Python.h before other headers, and it should be just this: #include "Python.h" distutils will make sure

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

2006-10-02 Thread Eric S. Johansson
MonkeeSage wrote: > Here's a class using Fredrik's suggestions to provide generic, > cross-platform file locking (only tested on *nix however, with the two > test files listed [i.e., run test1.py in one terminal then test2.py in > another]): > > http://pastie.caboo.se/15851 > > Ps. The lockfile s

[Q]An error with my module in C

2006-10-02 Thread Jia,Lu
hello,all. I wrote a module in C as below, BUT msg() method cannot work allright. #include #include static PyObject *Roka_msg(PyObject *self,PyObject *args) { printf("Roka Python lib. Version 1.0\n"); } static PyObject *Roka_func(PyObject *self,PyObject *args) { long arg;

switch user

2006-10-02 Thread s99999999s2003
hi due to certain constraints, i will running a python script as root inside this script, also due to some constraints, i need to switch user to user1 to run the rest of the script...is there a way ?thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Determin network interface

2006-10-02 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > Hi. How can I determin the hwaddr or ipaddress of the networkinterface > that is used in an outgoing connection? Is sock_object.getsockname() enough? http://docs.python.org/lib/socket-objects.html -- --Bryan -- http://mail.python.org/mailman/listinfo/python-lis

Problem with ez_setup on a "non-networked" machine

2006-10-02 Thread alex23
Hey everyone, I'm trying to install setuptools on a work PC behind an NTLM firewall. I've tried to use APS as recommended but am still unable to have anything other than IE talk through firewall. But as I can downloaded eggs manually, I'm not overly concerned at this point. So I've tried followin

loop beats generator expr creating large dict!?

2006-10-02 Thread George Young
[Python 2.5c2 (r25c2:51859, Sep 17 2006, 19:57:40), sparc solaris] I am puzzled that creating large dicts with an explicit iterable of key,value pairs seems to be slow. I thought to save time by doing: palettes = dict((w,set(w)) for w in words) instead of: palettes={} for w in words:

Re: Need help with an array problem.

2006-10-02 Thread John Machin
SpreadTooThin wrote: > Robert Kern wrote: > > [EMAIL PROTECTED] wrote: > > > To your question on casting long to short. This is how: > > > a=1234L # long > > > b=int(a) # int (short) > > > > No, a Python int is a C long. A Python long is an arbitrary-precision > > number and > > does no

Re: Need help with an array problem.

2006-10-02 Thread Robert Kern
SpreadTooThin wrote: > Robert Kern wrote: >> [EMAIL PROTECTED] wrote: >>> To your question on casting long to short. This is how: >>> a=1234L # long >>> b=int(a) # int (short) >> No, a Python int is a C long. A Python long is an arbitrary-precision number >> and >> does not correspond to

Re: Sockets in python

2006-10-02 Thread Bryan Olson
OneMustFall wrote: > Reciently i wrote a simple client (in twisted) using Reconnecting > Factory. > That client logins to my socket server.. and that`s it. > > Interesting thing is that it is seems that twisted client, > sends some ping on a TCP level without sending any da

Re: License / Registration key enabled software

2006-10-02 Thread Terry Reedy
"T" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Oh man. This is going way off topic!!! > > I just wanted to know how license / registration key can be implemented > in python. I was not interested in philosophical discussion of why / > why not one should implement it, whether

Re: Need help with an array problem.

2006-10-02 Thread SpreadTooThin
Robert Kern wrote: > [EMAIL PROTECTED] wrote: > > To your question on casting long to short. This is how: > > a=1234L # long > > b=int(a) # int (short) > > No, a Python int is a C long. A Python long is an arbitrary-precision number > and > does not correspond to any C type. > > -- So

Re: Making posts to an ASP.NET webform.

2006-10-02 Thread Gabriel Genellina
At Monday 2/10/2006 13:05, Bernard wrote: > > Has anyone tried what I'm doing? and if you tried how have you > > succeeded getting the data back after the post action? Use a packet sniffer or something to look at an actual POST that works, this way you could see what's missing in your code.

app with standalone gui and web interface

2006-10-02 Thread Daniel Nogradi
What would the simplest way to make an application that has both a web interface and runs from behind a web server but also can be used as a standalone app with a gui? More precisely is it possible to avoid creating an html/xml/whatever based web interface for the web version and separately creatin

Re: Problem with .next() method adding junk characters.

2006-10-02 Thread Terry Reedy
"Rainy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Paul McGuire wrote: >> I would guess then that the likely extent of any fix to this "bug" would >> be >> documentation to the effect of Fredrik's last comment above. > > Thanks.. I get it now. Should I close the bug report t

Re: License / Registration key enabled software

2006-10-02 Thread Ben Finney
"T" <[EMAIL PROTECTED]> writes: > I just wanted to know how license / registration key can be > implemented in python. I was not interested in philosophical > discussion of why / why not one should implement it, whether that > business model make sense, instead using smartcards, etc. etc. See if

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

2006-10-02 Thread MonkeeSage
Here's a class using Fredrik's suggestions to provide generic, cross-platform file locking (only tested on *nix however, with the two test files listed [i.e., run test1.py in one terminal then test2.py in another]): http://pastie.caboo.se/15851 Ps. The lockfile should also always be cleaned up (e

Re: where the extra space comes from on the stdout

2006-10-02 Thread Simon Percivall
alf wrote: > Hi, > > I can not find out where the extra space comes from. Run following: > > import os,sys > while 1: > print 'Question [Y/[N]]?', > if sys.stdin.readline().strip() in ('Y','y'): > #do something > pass > > $ python q.py > Question [Y/[N]]?y > Question

Re: where the extra space comes from on the stdout

2006-10-02 Thread Gabriel G
At Saturday 30/9/2006 19:09, Steve Holden wrote: > while 1: > print 'Question [Y/[N]]?', > if sys.stdin.readline().strip() in ('Y','y'): > #do something > pass > > $ python q.py > Question [Y/[N]]?y > Question [Y/[N]]?y > Question [Y/[N]]?y > Yup. When you execute

Re: Need help with an array problem.

2006-10-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > To your question on casting long to short. This is how: > a=1234L # long > b=int(a) # int (short) No, a Python int is a C long. A Python long is an arbitrary-precision number and does not correspond to any C type. -- Robert Kern "I have come to believe tha

Re: Need help with an array problem.

2006-10-02 Thread jakobsg
To your question on casting long to short. This is how: a=1234L # long b=int(a) # int (short) John Machin skrev: > SpreadTooThin wrote: > > Basically I think the problem is in converting from a 32 bit integer to > > a 16 bit integer. > > > > I have two arrays: > > import array > > > > a

Determin network interface

2006-10-02 Thread jakobsg
Hi. How can I determin the hwaddr or ipaddress of the networkinterface that is used in an outgoing connection? I need a kind of traceroute in python or lowlevel socket function that can help me find out which one of my hosts networkinterfaces that is actually used or going to be used to reach a cer

Re: Python

2006-10-02 Thread Gabriel Genellina
At Monday 2/10/2006 10:47, Bryan Leber wrote: Sorry to bother you again, but I just wanted to give you an update since you have generously helped me. I have it working kind of. I had to fudge it a little bit lol. For some reason if it reads a text file, it will pull out the information and pri

RE: Python

2006-10-02 Thread Gabriel Genellina
At Monday 2/10/2006 09:40, Bryan Leber wrote: Please keep your messages on the list. Other people may have bettter chances to help too. > I don't see anything wrong with those lines. Try printing pullerList >before the loop, to see exactly its contents. > Yea, I have been printing what is in

Re: Need help with an array problem.

2006-10-02 Thread John Machin
SpreadTooThin wrote: > Basically I think the problem is in converting from a 32 bit integer to > a 16 bit integer. > > I have two arrays: > import array > > a = array.array('L', [65537]) > b = array.array('H', [0]) > > b[0] = a[0] > > Which gives an overflow message As it should. > So can't

Re: php and python: how to unpickle using PHP?

2006-10-02 Thread Thomas Jollans
On Mon, 02 Oct 2006 23:44:26 +0200, Irmen de Jong <[EMAIL PROTECTED]> let this slip: > Ted Zeng wrote: > (...) > Try to find a language neutral marshaling format > (yaml? xml? whatever) and access that from both Python and PHP... yaml should be well-suited due to its nature as serialization forma

Re: Need help with an array problem.

2006-10-02 Thread James Stroud
SpreadTooThin wrote: > Basically I think the problem is in converting from a 32 bit integer to > a 16 bit integer. > > I have two arrays: > import array > > a = array.array('L', [65537]) > b = array.array('H', [0]) > > b[0] = a[0] > > Which gives an overflow message > So can't I truncate th

Need help with an array problem.

2006-10-02 Thread SpreadTooThin
Basically I think the problem is in converting from a 32 bit integer to a 16 bit integer. I have two arrays: import array a = array.array('L', [65537]) b = array.array('H', [0]) b[0] = a[0] Which gives an overflow message So can't I truncate the long by discaring the upper bits .. Like b[0

Re: Operator += works once, fails if called again

2006-10-02 Thread John Machin
Frederic Rentsch wrote: > Hi all, > >I have a class Time_Series derived from list. It lists days and > contains a dictionary of various Lists also derived from list which > contain values related to said days. (e.g. Stock quotes, volumes traded, > etc.) >I defined an operator += which work

Re: php and python: how to unpickle using PHP?

2006-10-02 Thread bearophileHUGS
Ted Zeng: > I store some test results into a database after I use python > To pickle them (say, misfiles=['file1','file2']) > Now I want to display the result on a web page which uses PHP. > How could the web page unpickle the results and display them? > Is there a PHP routine that can do unpickle

Re: php and python: how to unpickle using PHP?

2006-10-02 Thread Irmen de Jong
Ted Zeng wrote: > Hi, > > I store some test results into a database after I use python > To pickle them (say, misfiles=['file1','file2']) > > Now I want to display the result on a web page which uses PHP. > How could the web page unpickle the results and display them? > Is there a PHP routine th

php and python: how to unpickle using PHP?

2006-10-02 Thread Ted Zeng
Hi, I store some test results into a database after I use python To pickle them (say, misfiles=['file1','file2']) Now I want to display the result on a web page which uses PHP. How could the web page unpickle the results and display them? Is there a PHP routine that can do unpickle ? Ted zeng

Re: License / Registration key enabled software

2006-10-02 Thread T
Mike Playle wrote: > The people who want to use your software illegitimately will succeed no > matter what you do, so you shouldn't worry about them. Worry instead about > the people who DON'T want to use it illegitimately. Can a license key > scheme help them? If so, implement it. No trickery is n

Re: tkinter to mpeg

2006-10-02 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Thomas Jollans <[EMAIL PROTECTED]> wrote: >On Mon, 02 Oct 2006 09:18:13 -0700, "dug" <[EMAIL PROTECTED]> let this >slip: > >> Hi, >> >> I have a small program that moves some shapes around a tkinter canvas. >> Is there any way to save the output in a movie file, may

Re: strange append

2006-10-02 Thread James Stroud
E.Nurminski wrote (off the list): > the intention was to have > > newx = [1, 2] > res = [[1, 2]] > newx = [1, 3] > res = [[1, 2], [1, 3]] > newx = [1, 4] > res = [[1, 2], [1, 3], [1, 4]] > newx = [1, 5] > res = [[1, 2], [1, 3], [1, 4], [1, 5]] > newx = [1, 6] > res = [[1, 2], [1, 3], [1, 4], [1,

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Kay Schluehr
Simon Willison wrote: > Hi all, > > I have an API design question. I'm writing a function that can either > succeed or fail. Most of the time the code calling the function won't > care about the reason for the failure, but very occasionally it will. > > I can see a number of ways of doing this, bu

Re: moving limewire music to my itunes library

2006-10-02 Thread John Salerno
[EMAIL PROTECTED] wrote: > hi all, i know this is probably a silly question but Why are you asking this here? Do you want a Python solution for these tasks? > i dont know how to > move my limewire tunes to my itunes folder so that i can download them > onto my ipod. Just "Import" them from iTu

Re: moving limewire music to my itunes library

2006-10-02 Thread Thomas Jollans
On Mon, 02 Oct 2006 13:21:07 -0700, [EMAIL PROTECTED] let this slip: > hi all, i know this is probably a silly question but i dont know how to > move my limewire tunes to my itunes folder so that i can download them > onto my ipod. also if i have a music cd and load it into media windows > player,

moving limewire music to my itunes library

2006-10-02 Thread jenann50
hi all, i know this is probably a silly question but i dont know how to move my limewire tunes to my itunes folder so that i can download them onto my ipod. also if i have a music cd and load it into media windows player, how do i also get that music into my itunes library ta all jen -- http://ma

Operator += works once, fails if called again

2006-10-02 Thread Frederic Rentsch
Hi all, I have a class Time_Series derived from list. It lists days and contains a dictionary of various Lists also derived from list which contain values related to said days. (e.g. Stock quotes, volumes traded, etc.) I defined an operator += which works just fine, but only once. If I r

Re: Problem with .next() method adding junk characters.

2006-10-02 Thread Rainy
Paul McGuire wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > "Rainy" <[EMAIL PROTECTED]> wrote: > > > >> I'm just curious as to what's happening. I understand that you're not > >> supposed to call .next on a file open for writing. But I don't know why > >

Re: zeta function for complex argument

2006-10-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: >> Quick question: I'm wondering if there is, Somewhere Out There, a >> Python implementation of the Riemann zeta function for complex >> argument...? > > It seems that Scipy contaisn zeta too: > http://www.rexx.com/~dkuhlman/scipy_course_01.html

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread vbgunz
> I want to verify that three parameters can all be converted into > integers, but I don't want to modify the parameters themselves. You can twist and tweak this version OR completely redo it. In this version a list of the conversions are returned *but* if you want to only check if such a conversi

Re: zeta function for complex argument

2006-10-02 Thread bearophileHUGS
[EMAIL PROTECTED] wrote: > Quick question: I'm wondering if there is, Somewhere Out There, a > Python implementation of the Riemann zeta function for complex > argument...? It seems that Scipy contaisn zeta too: http://www.rexx.com/~dkuhlman/scipy_course_01.html#special Search for "Other Special

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Me: >>> def f(a, b, c): >>> map(int, [a, b, c]) >>> ...code... > > Robert Kern: >> That won't do anything since the names a, b, and c are never rebound. > > I think you are wrong. Try to give a "35.0" or a "hello" to that > function f, and see the results. > >

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread bearophileHUGS
Björn Lindström: > I would probably put that map in an assert statement, to make the > intention clearer. Isn't putting an explanation comment before that line enough? Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

zeta function for complex argument

2006-10-02 Thread Alec . Edgington
Hi, Quick question: I'm wondering if there is, Somewhere Out There, a Python implementation of the Riemann zeta function for complex argument...? Thanks for any help. A. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Simon Willison <[EMAIL PROTECTED]> wrote: > >try: > do_something() >except HttpError: > # An HTTP error occurred >except ApplicationError: > # An application error occurred >else: > # It worked! Use a similar but different idiom: try: do_something() except

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Basically the value you want is shifted up 8 bits. Perhaps I should more > understandably have said: > >12 << 8 == 3072 Or as already suggested in other followups, use os.WEXITSTATUS (and os.WIFEXITED.) Not only doe

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > I should have thought the simplest spelling of your requirements would be > > try: > do_something() > print "It worked" > except: > # it didn't This usage is generally disparaged because of the possibility of exceptions having nothing to d

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Steve Holden
Steve Holden wrote: > Simon Willison wrote: > >>Hi all, >> >>I have an API design question. I'm writing a function that can either >>succeed or fail. Most of the time the code calling the function won't >>care about the reason for the failure, but very occasionally it will. >> >>I can see a number

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
yes already noted by Steve, thanks. I should have spotted that myself straight away but I was too wrapped up in this whole "I didn't realise there were 2 sets of numbers" thing, gotta go read some unix programming books it would seem this is a os function that I am not aware of. I still res

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread Björn Lindström
[EMAIL PROTECTED]: > def f(a, b, c): > map(int, [a, b, c]) > ...code... > > What it does is to: "verify that three parameters can all be converted > into integers, but it doesn't modify the parameters themselves" as the > OP asked. I would probably put that map in an assert statement, to

httplib and large file uploads

2006-10-02 Thread Jesse Noller
Hey All,I'm working on an script that will generate a file of N size (where N is 1k-1gig) in small chunks, in memory (and hash the data on the fly) and pass it to an httplib object for upload. I don't want to store the file on the disk, or completely in memory at any time. The problem arises after

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Scott David Daniels
Steve Holden wrote: > Hari Sekhon wrote: >> I'm running a command like >> >> import commands >> result = commands.getstatusoutput('somecommand') >> print result[0] >> 3072 ... > No, it's just returning the error code in the top half of a sixteen-bit > value. You will notice that 3072 == 2 * 256. F

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Carl Banks
Simon Willison wrote: > I have an API design question. I'm writing a function that can either > succeed or fail. Most of the time the code calling the function won't > care about the reason for the failure, but very occasionally it will. > > I can see a number of ways of doing this, but none of th

Re: How can I correct an error in an old post?

2006-10-02 Thread Steve Holden
Blair P. Houghton wrote: > Steve Holden wrote: > >>Since this message was never on topic, I'd appreciate it if all >>concerned would close this thread now. > > > I already did. How did you get in here? :) -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Steve Holden
Simon Willison wrote: > Hi all, > > I have an API design question. I'm writing a function that can either > succeed or fail. Most of the time the code calling the function won't > care about the reason for the failure, but very occasionally it will. > > I can see a number of ways of doing this, b

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

2006-10-02 Thread Hari Sekhon
The name thing is taken care of by the fact that I use the path not just the script name. The path appears in the command and then is grepped out by that criteria, so if there was another program with the same name and in a different path then it would not affect it. Of course this is defeatab

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread bearophileHUGS
Me: > > def f(a, b, c): > > map(int, [a, b, c]) > > ...code... Robert Kern: > That won't do anything since the names a, b, and c are never rebound. I think you are wrong. Try to give a "35.0" or a "hello" to that function f, and see the results. What it does is to: "verify that three par

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Matthew Wilson wrote: >> I want to verify that three parameters can all be converted into >> integers, but I don't want to modify the parameters themselves. > > To do what you need you can try this: > > def f(a, b, c): > map(int, [a, b, c]) > ...code... That wo

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Sybren Stuvel
Simon Willison enlightened us with: > try: > do_something() > except HttpError: > # An HTTP error occurred > except ApplicationError: > # An application error occurred > else: > # It worked! > > This does the job fine, but has a couple of problems. > I anticipate that most people using my

Re: How can I correct an error in an old post?

2006-10-02 Thread Blair P. Houghton
Steve Holden wrote: > Since this message was never on topic, I'd appreciate it if all > concerned would close this thread now. I already did. How did you get in here? --Blair -- http://mail.python.org/mailman/listinfo/python-list

Re: Python threads and Numeric/SciPy exploit Dual Core ?

2006-10-02 Thread Robert Kern
robert wrote: > Fredrik Lundh wrote: > >> "robert" wrote: >> >>> Simple Python code obviously cannot use the dual core by Python threads. >>> Yet, a program drawing CPU mainly for matrix computations - preferably >>> with Numeric/SciPy - will this profit from a dual core when using 2 (or >>> more

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

2006-10-02 Thread Fredrik Lundh
Hari Sekhon wrote: > How exactly do you check that the pid is still active in python? Is > there a library or something that will allow me to manipulate system > processes and listings etc the way everybody does in unix shells by passing zero to the os.kill primitive: os.kill(pid,

Re: Python/UNO/OpenOffice?

2006-10-02 Thread Sybren Stuvel
John Machin enlightened us with: > Many thanks for all that, olive; I made the minimal hacks to make it > open an XLS ffile, and it worked! > I'll try to see why that worked and my previous experiment crashed > inside a DLL. Thanks, keep us posted! Sybren -- Sybren Stüvel Stüvel IT - http://ww

Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Simon Willison
Hi all, I have an API design question. I'm writing a function that can either succeed or fail. Most of the time the code calling the function won't care about the reason for the failure, but very occasionally it will. I can see a number of ways of doing this, but none of them feel aesthetically p

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
ok, I was thinking of shifting using subprocess, guess I'd better do that and forget about this waste of time. thanks Hari Sekhon Fredrik Lundh wrote: Hari Sekhon wrote: I'm sorry, this may seem dense to you but I have to ask. What on earth are you talking about? >

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Martin v. Löwis
Hari Sekhon schrieb: > I'm sorry, this may seem dense to you but I have to ask. What on earth > are you talking about? You may not be dense, but you are certainly fairly aggressive in your postings. If you just want to complain, go ahead. If you want actual help, you should reconsider your tone.

Re: tkinter to mpeg

2006-10-02 Thread Thomas Jollans
On Mon, 02 Oct 2006 09:18:13 -0700, "dug" <[EMAIL PROTECTED]> let this slip: > Hi, > > I have a small program that moves some shapes around a tkinter canvas. > Is there any way to save the output in a movie file, maybe mpeg? you can record any app with special programs designed for the job, such

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Fredrik Lundh
Hari Sekhon wrote: > I'm sorry, this may seem dense to you but I have to ask. What on earth > are you talking about? > > Why is it shifted 8 bits to the left? Why is there bitshifting at all? > Why doesn't commands give the same exit value as os.system() and the > unix cli? because that's how

Re: Sort by domain name?

2006-10-02 Thread js
> How about sorting the strings as they are reversed? > > urls = """\ > http://mail.google.com > http://reader.google.com > http://mail.yahoo.co.uk > http://google.com > http://mail.yahoo.com""".split("\n") > > sortedList = [ su[1] for su in sorted([ (u[::-1],u) for u in urls ]) ] > > for url in so

Re: Gadfly server startup error

2006-10-02 Thread aaronwmail-usenet
[EMAIL PROTECTED] wrote: > > Is anybody out there who has used the server+client operation > > mode successfully? > > Well, several years ago, yes. I looked into it and it was mainly a documentation and test issue, I think. The code seems to work. Please go http://gadfly.sourceforge.net/gadf

tkinter to mpeg

2006-10-02 Thread dug
Hi, I have a small program that moves some shapes around a tkinter canvas. Is there any way to save the output in a movie file, maybe mpeg? Thank you, Douglas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python threads and Numeric/SciPy exploit Dual Core ?

2006-10-02 Thread robert
Fredrik Lundh wrote: > "robert" wrote: > > >>Simple Python code obviously cannot use the dual core by Python threads. >>Yet, a program drawing CPU mainly for matrix computations - preferably >>with Numeric/SciPy - will this profit from a dual core when using 2 (or >>more) Python threads? > >

Re: Sort by domain name?

2006-10-02 Thread js
On 2 Oct 2006 08:56:09 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > js: > > All I want to do is to sort out a list of url by companyname, > > like oreilly, ask, skype, amazon, google and so on, to find out > > how many company's url the list contain. > > Then if you can define a good enoug

Re: Sort by domain name?

2006-10-02 Thread js
> Gentle reminder: is this homework? And you can expect better responses > if you show youve bootstrapped yourself on the problem to some extent. Sure thing. First I tried to solve this by using a list of domain found at http://www.neuhaus.com/domaincheck/domain_list.htm I converted this to a li

Re: Sort by domain name?

2006-10-02 Thread Paul McGuire
"js " <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi list, > > I have a list of URL and I want to sort that list by the domain name. > > Here, domain name doesn't contain subdomain, > or should I say, domain's part of 'www', mail, news and en should be > excluded. > > For exampl

Re: postgresql database

2006-10-02 Thread Michele Simionato
Paolo wrote: > Ciao a tutti, sto cercando di implementare un applicazione che si > interfaccia con postgresql(8.1), utilizzando Psycopg2, in ambiente > windows (python versione 2.5). Ho installato Psycopg2 e provando > solamente fare: import psycopg mi ritorna il seguente errore: > > import ps

Re: Sort by domain name?

2006-10-02 Thread Paul Rubin
"js " <[EMAIL PROTECTED]> writes: > All I want to do is to sort out a list of url by companyname, > like oreilly, ask, skype, amazon, google and so on, to find out > how many company's url the list contain. Here's a function I used to use. It makes no attempt to be exhaustive, but did a reasonabl

Re: Making posts to an ASP.NET webform.

2006-10-02 Thread Bernard
Max M wrote: > Bernard skrev: > > > Has anyone tried what I'm doing? and if you tried how have you > > succeeded getting the data back after the post action? > > Most likely you get assigned a cookie that you then need to return. > > Try the cookielib which automates all this for you. Yea I'm alr

Re: Sort by domain name?

2006-10-02 Thread jay graves
gene tani wrote: > Plus, how do you order "https:", "ftp", URLs with "www.", "www2." , > named anchors etc? Now is a good time to point out the urlparse module in the standard library. It will help the OP with all of this stuff. just adding my 2 cents. ... jay graves -- http://mail.python.or

Re: Sort by domain name?

2006-10-02 Thread bearophileHUGS
js: > All I want to do is to sort out a list of url by companyname, > like oreilly, ask, skype, amazon, google and so on, to find out > how many company's url the list contain. Then if you can define a good enough list of such company names, you can just do a search of such names inside each url.

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
I'm sorry, this may seem dense to you but I have to ask. What on earth are you talking about? Why is it shifted 8 bits to the left? Why is there bitshifting at all? Why doesn't commands give the same exit value as os.system() and the unix cli? When you choose to exit a program you give it a re

Re: Sort by domain name?

2006-10-02 Thread bearophileHUGS
Tim Chase: > to give you a sorting function. It assumes http rather than > having mixed url-types, such as ftp or mailto. They're easy > enough to strip off as well, but putting them back on becomes a > little more exercise. With a modern Python you don't need to do all that work, you can do: s

Multiplayer 2-D space action shooter in Python (using wxWindows)

2006-10-02 Thread [EMAIL PROTECTED]
Hi guys, Well, here is my humble contribution to the community: http://sourceforge.net/projects/erocket I started that project to learn Python and wxWindows. By all means, I am no Python Guru, but maybe someone could find something useful. Also please consider that it is under development and is

Re: Making posts to an ASP.NET webform.

2006-10-02 Thread Max M
Bernard skrev: > Has anyone tried what I'm doing? and if you tried how have you > succeeded getting the data back after the post action? Most likely you get assigned a cookie that you then need to return. Try the cookielib which automates all this for you. -- http://mail.python.org/mailman/list

  1   2   >