Re: why does socket.makefile require non-blocking mode?

2008-03-28 Thread Bryan Olson
Forest wrote: > The socket.makefile() docs say, "the socket must be in blocking mode." I > don't see any explanation of why blocking mode is required, and I'm not sure > whether that means timeout mode is forbidden as well. Can someone clarify > this? Looking at the code for the existing _fileob

Re: Installing simplejson issues

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 23:23:01 -0300, <[EMAIL PROTECTED]> escribió: > On Mar 28, 1:57 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Fri, 28 Mar 2008 16:14:07 -0300, <[EMAIL PROTECTED]> escribió: >> >> > I am trying to install the twitter python wrapper...I got that >> > installed just f

Re: some path issues on windows

2008-03-28 Thread Brad
Steven D'Aprano wrote: > On Fri, 28 Mar 2008 22:31:07 -0400, Brad wrote: > >> When reading a file into a list that contains windows file paths like >> this: >> >> c:\documents and settings\brad\desktop\added_software\asus\a.txt >> >> I get a list that contains paths that look like this: >> >> c:\\

Re: some path issues on windows

2008-03-28 Thread John Machin
On Mar 29, 1:31 pm, Brad <[EMAIL PROTECTED]> wrote: > When reading a file into a list that contains windows file paths like this: > > c:\documents and settings\brad\desktop\added_software\asus\a.txt Do you mean "reading a file into a list that AS A RESULT contains ..."? If not, what do you mean?

Re: some path issues on windows

2008-03-28 Thread Steven D'Aprano
On Fri, 28 Mar 2008 22:31:07 -0400, Brad wrote: > When reading a file into a list that contains windows file paths like > this: > > c:\documents and settings\brad\desktop\added_software\asus\a.txt > > I get a list that contains paths that look like this: > > c:\\documents and settings\\brad\\de

Re: Help me on function definition

2008-03-28 Thread John Machin
On Mar 29, 12:47 pm, "aeneng" <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I am just starting to use python in numerical cacluation. > I need you to help me to see what's wrong with the following piece of > codes, which computes the cross product of two vectors and returns > the result. u and v

some path issues on windows

2008-03-28 Thread Brad
When reading a file into a list that contains windows file paths like this: c:\documents and settings\brad\desktop\added_software\asus\a.txt I get a list that contains paths that look like this: c:\\documents and settings\\brad\\desktop\\added_software\\asus\\a.txt So, my list contains those fu

Re: Types, Cython, program readability

2008-03-28 Thread Robert Hicks
On Mar 16, 5:48 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Unlike Perl or Tcl, Python is not just a > scripting language with a set of ad-hoc extensions.  There are still > issues, and Python probably will never be a general-purpose replacement > for system-native language compilers, but it does

Re: Installing simplejson issues

2008-03-28 Thread blwatson
On Mar 28, 1:57 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 16:14:07 -0300, <[EMAIL PROTECTED]> escribió: > > > I am trying to install the twitter python wrapper...I got that > > installed just fine, but am having serious troubles getting the > > simplejson package to i

Re: Help me on function definition

2008-03-28 Thread Steven D'Aprano
Oh, I forgot to mention... On Sat, 29 Mar 2008 01:47:21 +, aeneng wrote: > if __name__=="__main__": ... > print "file name is %s" %__name__ This doesn't do what you expect it to do. You've already established that __name__ is equal to "__main__", so you might as well change that line

Re: Help me on function definition

2008-03-28 Thread Ben Finney
"aeneng" <[EMAIL PROTECTED]> writes: > I am just starting to use python in numerical cacluation. Welcome, and congratulations on learning Python. > I need you to help me to see what's wrong with the following piece > of codes [...] Your code is rather difficult to read, since your expressions

Re: last mouse movment or keyboard hit

2008-03-28 Thread Ron Eggler
Diez B. Roggisch wrote: > Ron Eggler schrieb: >> Hi, >> >> I would like to get the time of the most recent human activity like a >> cursor movement or a key hit. >> Does anyone know how I can get this back to start some action after there >> has been no activity for X minutes/seconds? > > Try ho

Re: Help me on function definition

2008-03-28 Thread Steven D'Aprano
On Sat, 29 Mar 2008 01:47:21 +, aeneng wrote: > Hello everyone, > > I am just starting to use python in numerical cacluation. I need you to > help me to see what's wrong with the following piece of codes, which > computes the cross product of two vectors and returns the result. u and > v are

Error message from function definition

2008-03-28 Thread aeneng pan
Dear community members, I just start to use python in numerical calculation. and I encountered some difficulties when I define my own function. Here is a piece of codes to compute the cross product of two 3x1 vector. can any one help me to find what is wrong with it? please see the codes below.

Re: Building a "safe" python?

2008-03-28 Thread Steven D'Aprano
On Fri, 28 Mar 2008 17:19:04 -0700, Paul Rubin wrote: > Richard Jones <[EMAIL PROTECTED]> writes: >> Check out tinypy: >> http://www.philhassey.com/blog/category/tinypy/ > > I don't really understand the point of it. http://www.philhassey.com/blog/tinypy-ideas/ [quote] Sandbox tinypy Objectiv

Re: Help me on function definition

2008-03-28 Thread Michael Wieher
No problem... your def needs a colon.. def function(params): yours lacks it =) thats all On Fri, Mar 28, 2008 at 8:47 PM, aeneng <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I am just starting to use python in numerical cacluation. > I need you to help me to see what's wrong with the follo

Help me on function definition

2008-03-28 Thread aeneng
Hello everyone, I am just starting to use python in numerical cacluation. I need you to help me to see what's wrong with the following piece of codes, which computes the cross product of two vectors and returns the result. u and v are two 3x1 matrix. when I import the function, error message s

Re: problem with CGIHTTPServer

2008-03-28 Thread 7stud
On Mar 28, 10:12 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 12:38:45 -0300, 7stud <[EMAIL PROTECTED]>   > escribió: > > > After I start the server script, load the html page in my browser, and > > click on the link, I get the desired output in my browser, but the > > s

Re: finding euclidean distance,better code?

2008-03-28 Thread Steven D'Aprano
On Fri, 28 Mar 2008 16:59:59 +0100, Robert Bossy wrote: > Gabriel Genellina wrote: >> That's what I said in another paragraph. "sum of coordinates" is using >> a different distance definition; it's the way you measure distance in a >> city with square blocks. I don't know if the distance itself ha

Re: Astronomy Fits format and gif.save(path)

2008-03-28 Thread W. Watson
I'm pretty new to Python and libraries. I'm actually trying to modify some code someone else wrote. There are two ways images are saved. One is for the user to select a "Save as GIF" menu item, or save as tiff, or others. The other way is that the user wants a collected image from a camera saved

Re: Building a "safe" python?

2008-03-28 Thread Paul Rubin
Richard Jones <[EMAIL PROTECTED]> writes: > Check out tinypy: > http://www.philhassey.com/blog/category/tinypy/ I don't really understand the point of it. See also: http://hedgehog.oliotalo.fi/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Building a "safe" python?

2008-03-28 Thread Richard Jones
[EMAIL PROTECTED] wrote: > I'm making a game where you'll be able to make your own mods and I > want to be able to write these mods in python. Check out tinypy: http://www.philhassey.com/blog/category/tinypy/ Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: Can my own objects support tuple unpacking?

2008-03-28 Thread greg
Scott David Daniels wrote: > class Foo(object): # _Never_ use old-style without a reason > def __getitem__(self, index): > print index > if index < 3: > return index * 5 # just to see > raise IndexError('Zapped') # The secret -- run

why does socket.makefile require non-blocking mode?

2008-03-28 Thread Forest
The socket.makefile() docs say, "the socket must be in blocking mode." I don't see any explanation of why blocking mode is required, and I'm not sure whether that means timeout mode is forbidden as well. Can someone clarify this? I wanted to use file-like objects with socket timeouts, so I ended

Re: case insensitive lstrip function?

2008-03-28 Thread Kelie
On Mar 28, 12:55 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > What about this: > > def lstrip2(string, chars, ignore_case=True): > if ignore_case: > chars = chars.lower() + chars.upper() > return string.lstrip(chars) > > Ciao, > Marc 'BlackJack' Rintsch Thanks

Re: python program deleted

2008-03-28 Thread jim-on-linux
thanks for the responses. I put the files in an ftp site and all is well. jim-on-linux -- http://mail.python.org/mailman/listinfo/python-list

Re: finding euclidean distance,better code?

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 18:15:04 -0300, harryos <[EMAIL PROTECTED]> escribió: > if i were to calculate the euclidean distance in the above example how > should i go about it..? > should i replace > distance = abs(input_wk - weights[image, :]) > with something else? For a single 2D vector, math.hypo

Re: How to insert multiple rows in SQLite Dbase

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 18:05:29 -0300, afandi <[EMAIL PROTECTED]> escribió: > Generally, it involves SQL statement such as > follow > > INSERT INTO (field1,field2,...fieldn) VALUES > ('abc','def'...) > > If I have data taken from Apache Server Log,let say 100 lines which > is printe

Re: case insensitive lstrip function?

2008-03-28 Thread Marc 'BlackJack' Rintsch
On Fri, 28 Mar 2008 15:48:09 -0700, Kelie wrote: > Is there such a function included in the standard Python distribution? AFAIK not. > This is what I came up with. How to improve it? Thanks. > > def lstrip2(s, chars, ingoreCase = True): > if ingoreCase: > s2 = s.upper().lstrip(chars

case insensitive lstrip function?

2008-03-28 Thread Kelie
Hello, Is there such a function included in the standard Python distribution? This is what I came up with. How to improve it? Thanks. def lstrip2(s, chars, ingoreCase = True): if ingoreCase: s2 = s.upper().lstrip(chars.upper()) return s[len(s)-len(s2):] else: retur

Re: Problem with format string and unicode

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 17:13:00 -0300, Hans Martin <[EMAIL PROTECTED]> escribió: > this is probably a trivial problem, but a google search for "python" > and "unicode" and" format string" gives too many hits: If I specify > e.g. "%20s" in a format string and the string value contains UTF-8 > stuff

Sell Air Jordan 1 Retro-BMP Package Old Love New Love Edition China wholesale

2008-03-28 Thread shoeshive8
www.shoeshive.net Wholesale R3 Wholesale R4 Wholesale NZ Wholesale R5 Wholesale Monser Wholesale OZ Wholesale Nike Trainers Wholesale Air Rift Shoes Air Max 87 Air Max 90 Air Max Ltd Air Max 95 Air Max 97 Air Max 2003 Air Max 360 at www.shoeshive.net Air Max Tn Nike Air Max 180 Nike Dunk SB Nike Me

Re: Question regd downloading multipart mail using POP3

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 16:47:51 -0300, SPJ <[EMAIL PROTECTED]> escribió: > I am facing a strange problem when I am trying to retrieve multipart > mail from POP server with attachments. > The task is to write a script which will retrieve mail with specific > 'from' field. Get the subject, body and

Re: Tell ya' what:

2008-03-28 Thread Grant Edwards
On 2008-03-28, Paul Rubin wrote: > [EMAIL PROTECTED] writes: >> Did everyone take the course on computer architecture? > > Yow! Does your SPEED QUEEN have CABLE? Ya know, I was thinking about trying to find an updated file of Zippy quotes for use in my .sig, but I decided that having all of the

Re: Finding Full Path to Process EXE

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 16:40:01 -0300, <[EMAIL PROTECTED]> escribió: > I would like to write a script that would enumerate all running > processes and return the full path to the EXE of each running > process. However, I can't seem to find any good info on how to do > this..any help is greatly appre

Re: Tell ya' what:

2008-03-28 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Did everyone take the course on computer architecture? Yow! Does your SPEED QUEEN have CABLE? -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding Full Path to Process EXE

2008-03-28 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Hello, > > I would like to write a script that would enumerate all running > processes and return the full path to the EXE of each running > process. However, I can't seem to find any good info on how to do > this..any help is greatly appreciated. Thanks. I have this

Class or dictionary ? (was: class or inherited list ?)

2008-03-28 Thread Stef Mientki
Sorry, although the code example was correct, the question was wrong. Stef Mientki Stef Mientki wrote: > hello, > > Passing all kinds of data between objects, > I'm looking for an elegant (and simple) way to pack the data. > Now it looks to me that both the class and the inherited list, > perform

Re: Tell ya' what:

2008-03-28 Thread Grant Edwards
On 2008-03-28, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Did everyone take the course on computer architecture? No. I personally know dozens of people who didn't. And I know others who took a course on computer architecture but not the course on computer architecture. -- Grant Edwards

Re: Python 2.5 - Build Error on Windows because of SQLite3

2008-03-28 Thread Gerhard Häring
llothar wrote: > Why does Python2.5 do not include the amalgamation source code of > sqlite3? [...] First, at the time Python grew the sqlite3 module, there was no amalgamation yet. My reasoning: So that Python doesn't need to release a security release, should a security bug in SQLite be found.

Re: finding euclidean distance,better code?

2008-03-28 Thread harryos
> the norm from which it is derived is called norm-1, or L1; the usual > > euclidean distance is derived from norm-2. > If you only want to see if two things are "close enough", this provides a > faster measure than the euclidean distance. thanks Gabriel for the detailed explanation.. if i w

How to insert multiple rows in SQLite Dbase

2008-03-28 Thread afandi
Hi, Generally, it involves SQL statement such as follow INSERT INTO (field1,field2,...fieldn) VALUES ('abc','def'...) If I have data taken from Apache Server Log,let say 100 lines which is printed output of 8 fields such as: data 1 IP: 61.5.65.101 Date: 26/Sep/2007 Time: 20:43:

Tell ya' what:

2008-03-28 Thread castironpi
I want to regression a signal. It's NN, not necessarily, sine wave. What kind of numbers of harmonic simultaneous sounds are we looking at? How close to an A 440 can a human make? I want recognition to alert me. As a sine wave is coming in: >>> for t in [ ( 200* sin( x*2 ), 200* cos( x*2 ) ) f

Re: Installing simplejson issues

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 16:14:07 -0300, <[EMAIL PROTECTED]> escribió: > I am trying to install the twitter python wrapper...I got that > installed just fine, but am having serious troubles getting the > simplejson package to install. I need help diagnosing where this is > failing. I am trying to use

Re: Problem with format string and unicode

2008-03-28 Thread Marc 'BlackJack' Rintsch
On Fri, 28 Mar 2008 21:13:00 +0100, Hans Martin wrote: > this is probably a trivial problem, but a google search for "python" > and "unicode" and" format string" gives too many hits: If I specify > e.g. "%20s" in a format string and the string value contains UTF-8 > stuff (differing number of byte

Re: Astronomy Fits format and gif.save(path)

2008-03-28 Thread Gary Herron
W. Watson wrote: > In what library would I find gif.save(path), where path is the name and path > of a file, and the method would produce a file in a gif format? > > Is there a fits.save(path) somewhere? fits is commonly used in astronomical > work. > You may want to install PIL (the Python

Python 2.5 - Build Error on Windows because of SQLite3

2008-03-28 Thread llothar
Why does Python2.5 do not include the amalgamation source code of sqlite3? At the moment it is not possible to build the system out of the box with the Visual Studio project. I don't think this is good. The amalgamation version is exactly for this purpose. Is there a 2.5.3 release on the way? --

Problem with format string and unicode

2008-03-28 Thread Hans Martin
Hi, this is probably a trivial problem, but a google search for "python" and "unicode" and" format string" gives too many hits: If I specify e.g. "%20s" in a format string and the string value contains UTF-8 stuff (differing number of bytes per character), the length of the resulting string (in ch

Question regd downloading multipart mail using POP3

2008-03-28 Thread SPJ
I am facing a strange problem when I am trying to retrieve multipart mail from POP server with attachments. The task is to write a script which will retrieve mail with specific 'from' field. Get the subject, body and attachments if any and reuse this info to send mail with different format to ti

Finding Full Path to Process EXE

2008-03-28 Thread misceverything
Hello, I would like to write a script that would enumerate all running processes and return the full path to the EXE of each running process. However, I can't seem to find any good info on how to do this..any help is greatly appreciated. Thanks. T -- http://mail.python.org/mailman/listinfo/pyt

Re: finding euclidean distance,better code?

2008-03-28 Thread castironpi
On Mar 28, 10:15 am, harryos <[EMAIL PROTECTED]> wrote: > > The code is pretty legible as it is now. Anyway, using min() and a > > generator: > > hi > is this calculated distance really Euclidean distance? When i checked > wikipediahttp://en.wikipedia.org/wiki/Euclidean_distance > it shows a calcul

Re: how to capture screenshots of the active window in Python

2008-03-28 Thread Colin J. Williams
Gabriel Genellina wrote: > En Thu, 27 Mar 2008 20:28:27 -0300, Praveena B > <[EMAIL PROTECTED]> escribió: > >> Can anyone help me out?? > > Still lacking details... PIL has a ImageGrab module, Windows only. > For Windows, Alt Prtscn usually copies the image to a clipboard. Colin W. -- http:/

Re: Advantage of the array module over lists?

2008-03-28 Thread Piet Delport
On Mar 17, 1:49 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > I doubt that. AFAIK both arrays and lists are continuous memory-areas, > that double (at least to a certain threshold or so) when reaching the > capacity limit. For what it's worth, lists over-allocate by ~1/8, and arrays by ~1/

Installing simplejson issues

2008-03-28 Thread blwatson
I am trying to install the twitter python wrapper...I got that installed just fine, but am having serious troubles getting the simplejson package to install. I need help diagnosing where this is failing. I am trying to use: http://pypi.python.org/pypi/simplejson and I run "python setup.py build

Re: Dynamic code problem

2008-03-28 Thread castironpi
On Mar 28, 8:41 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 07:14:17 -0300, Simon Brunning   > <[EMAIL PROTECTED]> escribió: > > > On Thu, Mar 27, 2008 at 4:13 PM,  <[EMAIL PROTECTED]> wrote: > >> My dynamic code failed at this site http:///, need > >>  some help th

Re: Summary of threading for experienced non-Python programmers?

2008-03-28 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > systems. (In theory, file input/output should also be available as > > asynchronous code, but async IO is low-level and not available in > > Python.) While threads shouldn't be considered a replacement for > > I

Astronomy Fits format and gif.save(path)

2008-03-28 Thread W. Watson
In what library would I find gif.save(path), where path is the name and path of a file, and the method would produce a file in a gif format? Is there a fits.save(path) somewhere? fits is commonly used in astronomical work. -- Wayne Watson (Nevada City, CA)

Re: Instrumented web proxy

2008-03-28 Thread Andrew McLean
Paul Rubin wrote: > Andrew McLean <[EMAIL PROTECTED]> writes: >> I would like to write a web (http) proxy which I can instrument to >> automatically extract information from certain web sites as I browse >> them. Specifically, I would want to process URLs that match a >> particular regexp. For thos

Re: Psyco alternative

2008-03-28 Thread Paul Boddie
On 27 Mar, 15:19, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [Psyco maintenance and further development] > Nope, but I heard through the grapevine that while it won't be supported for > all times to come, a new version is in the making. > > But ultimately, the author says that the approach i

Re: class or inherited list ?

2008-03-28 Thread Stef Mientki
>>> >>> class super_list(list): >>> pass >>> >>> def kwadraat ( value ) : >>> return value * value >>> >>> x={} >>> x['frequency']=33 >>> x['functie']=kwadraat >>> print x['functie'](2) >>> >>> y = super_list() >>> y.frequency = 33 >>> y.functie = kwadraat >>> print y.functie(3) >>> >

Re: Summary of threading for experienced non-Python programmers?

2008-03-28 Thread sturlamolden
On 28 Mar, 15:52, [EMAIL PROTECTED] wrote: > I'm having trouble explaining the benefits and tradeoffs of threads to my > coworkers and countering their misconceptions about Python's threading model > and facilities.   Python's threading module is modelled on Java's thread model. There are some mi

Re: Summary of threading for experienced non-Python programmers?

2008-03-28 Thread Diez B. Roggisch
> systems. (In theory, file input/output should also be available as > asynchronous code, but async IO is low-level and not available in > Python.) While threads shouldn't be considered a replacement for I suggest you tell that the twisted-guys. And the ones from the built-in asyncore-module.

Re: base64.urlsafe_b64encode and the equal character

2008-03-28 Thread Clodoaldo
On Mar 28, 1:56 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 13:22:06 -0300, Clodoaldo <[EMAIL PROTECTED]> > escribió: > > > > > On Mar 28, 12:09 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> En Fri, 28 Mar 2008 10:54:49 -0300, Clodoaldo > >> <[EMAIL PROTECTED]

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread Mike
On Mar 28, 10:01 am, Jason Kristoff wrote: > I'm trying to make something that once it is disconnected will > automatically try to reconnect. I'll add some more features in later so > it doesn't hammer the server but right now I just want to keep it simple > and get that part working. The proble

Re: Problem with write binary data to OLE field in Access

2008-03-28 Thread KingMax
On 3月27日, 下午7时22分, Tim Golden <[EMAIL PROTECTED]> wrote: > lialie wrote: > > [... snip slightly confused indication that reading back a > binary item using GetChunk appears to double its length ...] > > Well I don't know why this should be happening, but I do at > least have a few suggestions: > >

Re: base64.urlsafe_b64encode and the equal character

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 13:22:06 -0300, Clodoaldo <[EMAIL PROTECTED]> escribió: > On Mar 28, 12:09 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Fri, 28 Mar 2008 10:54:49 -0300, Clodoaldo >> <[EMAIL PROTECTED]> escribió: >> >> > What i need to know is where can an equal char appear in a

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread Grant Edwards
On 2008-03-28, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > >> Yes, that is exactly what it means. >> >> >From the recv() man page: >> >> RETURN VALUE >>These calls return the number of bytes received, or -1 if an >> error >>occurred. The return value will be 0 when the peer has

Re: Summary of threading for experienced non-Python programmers?

2008-03-28 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: > I'm having trouble explaining the benefits and tradeoffs of threads > to my coworkers and countering their misconceptions about Python's > threading model and facilities. They all come from C++ and are used > to thinking of multithreading as a way to harness multiple C

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 13:17:44 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: > [EMAIL PROTECTED] schrieb: >> I have an extension module that gets initialized multiple >> times because I am using threads. >> >> How can this module access global state (not per-thread state) ? >> It needs to

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread Laszlo Nagy
> Yes, that is exactly what it means. > > >From the recv() man page: > > RETURN VALUE >These calls return the number of bytes received, or -1 if an error >occurred. The return value will be 0 when the peer has performed an >orderly shutdown. > > Mea cupla. :-) W

Re: SoC project: Python-Haskell bridge - request for feedback

2008-03-28 Thread Michał Janeczek
On 27 Mar 2008 23:49:46 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > "Michaâ Janeczek" <[EMAIL PROTECTED]> writes: > > However, the type of embedding that I imagined would be mostly > > pure functions, since Python can deal with IO rather well. It'd also > > be applicable in situa

Re: base64.urlsafe_b64encode and the equal character

2008-03-28 Thread Clodoaldo
On Mar 28, 12:09 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 10:54:49 -0300, Clodoaldo <[EMAIL PROTECTED]> > escribió: > > > > > I'm using a md5 hash encoded with base64.urlsafe_b64encode as a > > parameter of a URL used to confirm a registration in a site. It has > > b

Re: threads and extension module initialization

2008-03-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I have an extension module that gets initialized multiple > times because I am using threads. > > How can this module access global state (not per-thread state) ? > It needs to create a singleton. The question is very unclear. If you are after *not* initializing your

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread Grant Edwards
On 2008-03-28, Laszlo Nagy <[EMAIL PROTECTED]> wrote: >> while (1): >> buffer = sock.recv(1024) >> if not buffer: >> dodiscon() >> > > sock.recv(1024) can return zero bytes of data indicating that no data > arrived yet. No, it can't. > It does not mean that you have been d

Re: class or inherited list ?

2008-03-28 Thread Stef Mientki
thanks Gabriel, Gabriel Genellina wrote: > En Fri, 28 Mar 2008 12:15:45 -0300, Stef Mientki <[EMAIL PROTECTED]> > escribió: > > >> Passing all kinds of data between objects, >> I'm looking for an elegant (and simple) way to pack the data. >> Now it looks to me that both the class and the inhe

Re: problem with CGIHTTPServer

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:38:45 -0300, 7stud <[EMAIL PROTECTED]> escribió: > After I start the server script, load the html page in my browser, and > click on the link, I get the desired output in my browser, but the > server script outputs the following in my terminal: > > localhost - - [28/Mar/20

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:25:55 -0300, <[EMAIL PROTECTED]> escribió: > On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: >> >> > How can this module access global state (not per-thread state) ? >> > It needs to c

Re: finding euclidean distance,better code?

2008-03-28 Thread Robert Bossy
Gabriel Genellina wrote: > That's what I said in another paragraph. "sum of coordinates" is using a > different distance definition; it's the way you measure distance in a city > with square blocks. I don't know if the distance itself has a name, but I think it is called Manhattan distance in

Re: finding euclidean distance,better code?

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:15:48 -0300, harryos <[EMAIL PROTECTED]> escribió: >> The code is pretty legible as it is now. Anyway, using min() and a >> generator: >> >> > > hi > is this calculated distance really Euclidean distance? When i checked > wikipedia http://en.wikipedia.org/wiki/Euclidean_di

Re: Setting the value of one cell in QTableWidget fills everything.

2008-03-28 Thread Phil Thompson
On Friday 28 March 2008, Constantly Distracted wrote: > I've just started PyQt programming and I've run into this little > problem. When I set the text of one cell in my table, all the other > cells fill with that value. ...because you have only created a single QTableWidgetItem instance, rather

Re: Summary of threading for experienced non-Python programmers?

2008-03-28 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >I'm having trouble explaining the benefits and tradeoffs of threads to my >coworkers and countering their misconceptions about Python's threading model >and facilities. They all come from C++ and are used to thinking of >multithreading

Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > C global variables are global, not per-thread. aha, a static pointer gets initialized to NULL, so I can check if it's not NULL in the module initializer. Thanks for jogging my brain, Simon. > > -- > Gabriel Genellina -- ht

problem with CGIHTTPServer

2008-03-28 Thread 7stud
1) I have this simple cgi server: import CGIHTTPServer import BaseHTTPServer class MyRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ['/my_cgi_scripts'] server = BaseHTTPServer.HTTPServer( ('', 8111), MyRequestHandler ) server.serve_forever() 2) I

web application-level caching

2008-03-28 Thread Chris Gray
Is there a Python module comparable in functionality to the PEAR Cache_Lite package for PHP? I've been doing some Googling to little avail. I'm experimenting with Python CGI to learn various techniques at a low level and I'm adapting a model that uses PHP. Any info about application-level cac

Re: class or inherited list ?

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:15:45 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: > Passing all kinds of data between objects, > I'm looking for an elegant (and simple) way to pack the data. > Now it looks to me that both the class and the inherited list, > performs equally well. > Till now, the mo

Re: threads and extension module initialization

2008-03-28 Thread pianomaestro
On Mar 28, 11:14 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: > > > I have an extension module that gets initialized multiple > > times because I am using threads. > > And do you want thread local variables? no > > > How ca

Re: Setting the value of one cell in QTableWidget fills everything.

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 12:01:01 -0300, Constantly Distracted <[EMAIL PROTECTED]> escribió: > I've just started PyQt programming and I've run into this little > problem. When I set the text of one cell in my table, all the other > cells fill with that value. > def filltable(self): > ite

Re: finding euclidean distance,better code?

2008-03-28 Thread harryos
> The code is pretty legible as it is now. Anyway, using min() and a > generator: > > hi is this calculated distance really Euclidean distance? When i checked wikipedia http://en.wikipedia.org/wiki/Euclidean_distance it shows a calculation involving sum of squares of the differences of elements.He

Pexpect question.

2008-03-28 Thread Paul Lemelle
I am trying separate a script that users pexpect into various functions within the same expect session. The problem is that the function does not return control back Main. Any insight into this issue would be greatly appreciated. Below is sample code of the problem. Thanks, Paul impor

Re: threads and extension module initialization

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 11:51:10 -0300, <[EMAIL PROTECTED]> escribió: > I have an extension module that gets initialized multiple > times because I am using threads. And do you want thread local variables? > How can this module access global state (not per-thread state) ? > It needs to create a sing

class or inherited list ?

2008-03-28 Thread Stef Mientki
hello, Passing all kinds of data between objects, I'm looking for an elegant (and simple) way to pack the data. Now it looks to me that both the class and the inherited list, performs equally well. Till now, the most elegant way (in my view) is the list inheritance, mainly because you don't need b

ANN: Leo 4.4.8 b3 released

2008-03-28 Thread Edward K Ream
Leo 4.4.8 beta 3 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This version features a new ipython plugin that provides a two-way bridge between Leo and IPython. See http://webpages.charter.net/edreamleo/IPythonBridge.html Leo is a text editor, dat

Re: base64.urlsafe_b64encode and the equal character

2008-03-28 Thread Gabriel Genellina
En Fri, 28 Mar 2008 10:54:49 -0300, Clodoaldo <[EMAIL PROTECTED]> escribió: > I'm using a md5 hash encoded with base64.urlsafe_b64encode as a > parameter of a URL used to confirm a registration in a site. It has > been working great. > > The url is like this: > > http://example.com/ce?i=878&h=kT

Setting the value of one cell in QTableWidget fills everything.

2008-03-28 Thread Constantly Distracted
I've just started PyQt programming and I've run into this little problem. When I set the text of one cell in my table, all the other cells fill with that value. All I wanted to do was run a loop, printing in each cell the row and column number. Here's the code. -- fro

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread Laszlo Nagy
> This is what I've got right now: > > #! /usr/bin/env python > import socket, string > sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > def doconn(): > sock.connect(("localhost", 1234)) > def dodiscon(): > sock.close() > doconn() > > doconn() > > while (1): > buffer

Re: Global variables in modules...

2008-03-28 Thread Terry Jones
> "Peter" == Peter Otten <[EMAIL PROTECTED]> writes: Peter> [EMAIL PROTECTED] wrote: [snip] >> ...can someone explain why invoking a.py prints 0? >> I would have thought that the global variable 'g' of module 'a' would >> be set to 1... Peter> When you run a.py as a script it is put into the s

Re: How do I reconnect a disconnected socket?

2008-03-28 Thread pianomaestro
Did you try just creating a new socket every time you do a connect ? On Mar 28, 10:01 am, Jason Kristoff wrote: > I'm trying to make something that once it is disconnected will > automatically try to reconnect. I'll add some more features in later so > it doesn't hammer the server but right now

threads and extension module initialization

2008-03-28 Thread pianomaestro
I have an extension module that gets initialized multiple times because I am using threads. How can this module access global state (not per-thread state) ? It needs to create a singleton. Simon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables in modules...

2008-03-28 Thread ttsiodras
That clears it up. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Summary of threading for experienced non-Python programmers?

2008-03-28 Thread skip
I'm having trouble explaining the benefits and tradeoffs of threads to my coworkers and countering their misconceptions about Python's threading model and facilities. They all come from C++ and are used to thinking of multithreading as a way to harness multiple CPU cores for compute-bound processi

  1   2   >