Re: How can I wait for all the threads I spawn for 5 minutes

2007-09-03 Thread Fabio Z Tessitore
> [cut] > But this code ends up waiting 5 minutes for **each** thread. that is > not what I want. I just want to wait for 5 minutes for all threads. how > can I do that? I've written a little code for you using threading. Hope it will help you: #! /usr/bin/env python # -*- coding: utf8 -*- impo

Re: Problem with extremely small real number

2007-09-03 Thread Fabio Z Tessitore
Il Mon, 03 Sep 2007 07:56:10 -0700, Andrea ha scritto: > [cut] > > I want to call factorial(2)//binomial(1024,2) for example, in this way > trivially I obtain 0 as probability, how can I obtain the probability > forcing this division to output extremely small real numbers int to float will h

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Il Wed, 29 Aug 2007 23:11:53 +0200, Gigs_ ha scritto: > Gigs_ wrote: >> Fabio Z Tessitore wrote: >>> Are you sure your script is in the right dir? >>> >>> On my home computer, php script will work in /var/www but my python >>> script need an other dir

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Are you sure your script is in the right dir? On my home computer, php script will work in /var/www but my python script need an other dir to work properly (i don't remember which now ;-)) bye -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Il Wed, 29 Aug 2007 19:24:54 +0200, Gigs_ ha scritto: > i have simple page and form that ask for name and color and cgi script > that print that name in another page and background in chosen color > > all the time this error pop: > Error response > > Error code 501. > > Message: Can only POST t

Re: localhost, ?!

2007-08-28 Thread Fabio Z Tessitore
Il Tue, 28 Aug 2007 18:27:31 +0200, Boris Ozegovic ha scritto: > Three machines, one at my home, other two at my job, in every machine > there is Win XP SP2 and Python 2.5 > > At home: > urllib2.urlopen("http://localhost";), everything is ok > > At job: > urllib2.urlopen("http://localhost";) > r

Re: Is there a way to change the default string encoding?

2007-08-21 Thread Fabio Z Tessitore
Il Mon, 20 Aug 2007 18:44:39 -0700, Ron Garret ha scritto: > Is there a way to change the default string encoding ... Dive Into Python. Section 9 on http://diveintopython.org/xml_processing/ unicode.html That will help. Bye Fabio -- http://mail.python.org/mailman/listinfo/python-list

Re: All names in the current module

2007-08-15 Thread Fabio Z Tessitore
Il Wed, 15 Aug 2007 19:01:17 +0200, Lawrence Oluyede ha scritto: > Torsten Bronger <[EMAIL PROTECTED]> wrote: >> How can I get a list with all classes defined in the current module? >> Thank you! > > [EMAIL PROTECTED] ~ % cat > t.py > class A: pass > > [EMAIL PROTECTED] ~ % python > Python 2.5.1

Re: who is simpler? try/except/else or try/except

2007-08-12 Thread Fabio Z Tessitore
Il Sun, 12 Aug 2007 20:06:23 +0200, Peter Otten ha scritto: [cut] > at the same time introducing the implicit > constraint that the latter does not fail with . > Therefore the original code gives the reader a much clearer notion of > the author's intention. This may not be a problem for the simpl

Re: who is simpler? try/except/else or try/except

2007-08-12 Thread Fabio Z Tessitore
Il Sun, 12 Aug 2007 13:49:18 -0400, Steve Holden ha scritto: >> > In matters of style such as this there *are* only opinions. I don't > think there are definite grounds for preferring either one. Opinions are what I'd like to see, because most of you have bigger experience than me. maybe this e

Re: Regular Expression Grouping

2007-08-12 Thread Fabio Z Tessitore
Il Sun, 12 Aug 2007 17:21:02 +, linnewbie ha scritto: > Fairly new to this regex thing, so this might be very juvenile but > important. > > I cannot understand and why 'c' constitutes a group here without being > surrounded by "(" ,")" ? > import re m = re.match("([abc])+", "abc") >

who is simpler? try/except/else or try/except

2007-08-12 Thread Fabio Z Tessitore
Hi all, reading Dive Into Python, on Chapter 6 (exception), I've found: "This code comes from the getpass module, a wrapper module for getting a password from the user" try: import termios, TERMIOS except ImportError: try: import msvcrt except ImportError

Re: regexp problem in Python

2007-08-04 Thread Fabio Z Tessitore
Il Fri, 03 Aug 2007 14:41:52 -0700, Ehsan ha scritto: maybe you can use this to solve your prob: myurl = "http://www.2shared.com/download/1716611/e2000f22/ Jadeed_Mlak14.wmv?tsid=20070803-164051-9d637d11" if myurl.startswith('http') and ('wmv' in myurl or '3pg' in myurl): # myurl is the

Re: downloading files

2007-08-03 Thread Fabio Z Tessitore
Il Fri, 03 Aug 2007 14:32:19 -0700, Ehsan ha scritto: > It works but could you explain more what's wrong with just 'w'? On Unix-like systems newline means '\n' On Window newline means '\r\n' So, when you open a file on Window with 'w' option, Win replace downloaded '\n' with a local '\r\n' an

Re: Global package variable, is it possible?

2007-08-03 Thread Fabio Z Tessitore
Il Fri, 03 Aug 2007 14:16:59 -0400, Carsten Haese ha scritto: > Right idea, wrong execution. Note that the OP said "I'd like to be able > to reload the config file dynamically and have all my modules > automatically receive the new config." You are obviously right ... I haven't read all the post,

Re: Global package variable, is it possible?

2007-08-03 Thread Fabio Z Tessitore
Heve you tried to do something like: # module configure.py value1 = 10 value2 = 20 ... # other module from configure import * # now I'm able to use value1 value2 etc. var = value1 * value2 bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Error with Tkinter and tkMessageBox

2007-08-03 Thread Fabio Z Tessitore
Il Fri, 03 Aug 2007 12:38:09 +1000, John McMonagle ha scritto: > Fabio Z Tessitore wrote: >> I've tried to use Twm and SURPRISE! it works!!! >> >> Can you say why? How can I fix the prob with Gnome? >> >> Thanks > > I don't know why it doesn

Re: Error with Tkinter and tkMessageBox

2007-08-02 Thread Fabio Z Tessitore
I've tried to use Twm and SURPRISE! it works!!! Can you say why? How can I fix the prob with Gnome? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Error with Tkinter and tkMessageBox

2007-08-02 Thread Fabio Z Tessitore
Il Thu, 02 Aug 2007 13:54:46 +1000, John McMonagle ha scritto: > What window manager are you using ? Hi John, I'm using gnome, with gdm. Do you think the problem is this? I'm going to try with another one ... bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Error with Tkinter and tkMessageBox

2007-08-01 Thread Fabio Z Tessitore
Il Tue, 31 Jul 2007 18:45:57 -0400, jim-on-linux ha scritto: > Try This: > > def reply(): > showinfo('ciao','hello') > I've tried without success ... thanks I've also discovered that when I (or some other prog using tkinter) display menu, the underscore is an ugly little black box.

Re: Creating a shared object in python

2007-07-31 Thread Fabio Z Tessitore
Il Tue, 31 Jul 2007 15:37:26 -0400, Delgado, Edgardo CIV NAVAIR 4.1.4.3 ha scritto: > Is there a way to create a shared object in python? > > Thx, > > Edgar Usually object are shared in Python. i.e. # a list l = [ 1 , 2 , 3 ] # a list containing l m = [ l, 4, 5 ] # now m is [ [1,2,3]

Re: Error with Tkinter and tkMessageBox

2007-07-31 Thread Fabio Z Tessitore
Il Tue, 31 Jul 2007 19:12:48 +, kyosohma ha scritto: > > I'm not sure, but I don't think you need the "win" variable at all. I > can get it to work as follows: > > > > from Tkinter import * > from tkMessageBox import showinfo > > def reply(): > showinfo(title='ciao', message='hell

Error with Tkinter and tkMessageBox

2007-07-31 Thread Fabio Z Tessitore
hi all, this Tkinter very simple code work fine: ## from Tkinter import * win = Tk() win.mainloop() ## but if I try to open a message box, it happens: Exception in Tkinter callback Traceback (most recent call last): File "lib-tk/Tkinter.py", li