ANN: magnitude 0.9.1

2007-10-16 Thread juan
I am happy to announce the first release of magnitude, a library for computing with physical quantities. It is released under the Apache v. 2 license. A physical quantity is a number with a unit, like 10 km/h. Units can be any of the SI units, plus a bunch of non-SI, bits, dollars, and any combina

PIL and getpixel()

2007-10-16 Thread [EMAIL PROTECTED]
i am trying to get the pixel data using im.getpixel() i am getting a tuple like (152,118,106) for a pixel in a RGB jpeg image . what i really want is an integer value representing a pixel ,like waht i can get from java's BufferedImage.getRGB(x,y) .. i am wondering if someone can advise me on how i

confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello, I am strangely confused with a date calculation problem. the point is that I want to calculate difference in two dates in days. there are two aspects to this problem. firstly, I can't get a way to convert a string like "1/2/2005" in a genuan date object which is needed for calculation. now o

Re: PIL and getpixel()

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 07:05:56 +, [EMAIL PROTECTED] wrote: > i am trying to get the pixel data using im.getpixel() > i am getting a tuple like (152,118,106) for a pixel in a RGB jpeg > image . > what i really want is an integer value representing a pixel ,like waht > i can get from java's Buffer

Re: int to str in list elements..

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 06:18:51 +, Tim Roberts wrote: > John Machin <[EMAIL PROTECTED]> wrote: >>On Oct 15, 4:02 am, Abandoned <[EMAIL PROTECTED]> wrote: >>> Hi.. >>> I have a list as a=[1, 2, 3 ] (4 million elements) >>> and >>> b=",".join(a) >>> than >>> TypeError: sequence item 0: expecte

Re: confused on calculating date difference in days.

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: > firstly, I can't get a way to convert a string like "1/2/2005" in a > genuan date object which is needed for calculation. Why? Split the string up, convert the parts to `int` and just create a `datetime.date` object. > now once this

Re: WebBased Vector 2D Graphics

2007-10-16 Thread crazychrisy54
On Oct 5, 12:41 pm, Robin Becker <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > [EMAIL PROTECTED] wrote: > > ... > > > You certainly need to get on speed with webdevelopment. Otherwise you will > > fail miserably. > > > There are several options here: > > > - rendering a server-side

Re: confused on calculating date difference in days.

2007-10-16 Thread Ben Finney
"krishnakant Mane" <[EMAIL PROTECTED]> writes: > firstly, I can't get a way to convert a string like "1/2/2005" in a > genuan date object which is needed for calculation. Until recently, this was a wart in the Python standard library: datetime objects exist in the 'datetime' module, but parsing s

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Ben Finney
[EMAIL PROTECTED] writes: > I am happy to announce the first release of magnitude, a library for > computing with physical quantities. It is released under the Apache > v. 2 license. Thanks for this module, it will be good to have a standard place for these constants. > Home page: http://juanrey

Re: PyQt ProgressBar

2007-10-16 Thread Alexandre Badez
On Oct 16, 8:03 am, luca72 <[EMAIL PROTECTED]> wrote: > No one can help pls > > Regards > > Luca I've written a little app for testing this: import sys import time from PyQt4 import QtGui app = QtGui.QApplication(sys.argv) barra = QtGui.QProgressBar() barra.show() barra.setMinimum(0) barra.setM

Re: Simple HTML template engine?

2007-10-16 Thread jean-michel bain-cornu
> Can anyone recommend a simple python template engine for generating > HTML that relies only on the Pyhon Core modules? > > No need for caching, template compilation, etc. > > Speed is not a major issue. > > I just need looping and conditionals. Template inheritance would be a > bonus. I have

Re: Automatically organize module imports

2007-10-16 Thread Alexandre Badez
On Oct 16, 8:52 am, Thomas Wittek <[EMAIL PROTECTED]> wrote: > Jean-Paul Calderone: > > > On Mon, 15 Oct 2007 20:52:11 +0200, Thomas Wittek > > <[EMAIL PROTECTED]> wrote: > >> Is there a tool that can organize my import section? > > > Pyflakes will tell you which imports aren't being used (among ot

Re: confused on calculating date difference in days.

2007-10-16 Thread Ben Finney
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: > > > firstly, I can't get a way to convert a string like "1/2/2005" in > > a genuan date object which is needed for calculation. > > Why? Split the string up, convert the parts to

Good Book

2007-10-16 Thread Lars Johansen
HI are there any recommended books for an sysadmin who has been mostly writing shell scripts, but want to move up to create more complex programs. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Text Processing Help

2007-10-16 Thread Peter Otten
patrick.waldo wrote: > manipulation? Also, I conceptually get it, but would you mind walking > me through >> for key, group in groupby(instream, unicode.isspace): >> if not key: >> yield "".join(group) itertools.groupby() splits a sequence into groups with the same key; e. g

Re: confused on calculating date difference in days.

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 18:10:54 +1000, Ben Finney wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > >> On Tue, 16 Oct 2007 12:33:33 +0530, krishnakant Mane wrote: >> >> > firstly, I can't get a way to convert a string like "1/2/2005" in >> > a genuan date object which is needed for ca

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Joan M. Garcia
Ben Finney <[EMAIL PROTECTED]> writes: > Please don't ever recommend 'from foo import *' in end-user > documentation. It's generally a bad practice and should only be done > when the individual programmer understands the tradeoffs involved; > putting it in the documentation for a module is setting

Re: int to str in list elements..

2007-10-16 Thread John Machin
Marc 'BlackJack' Rintsch wrote: > On Tue, 16 Oct 2007 06:18:51 +, Tim Roberts wrote: > > > John Machin <[EMAIL PROTECTED]> wrote: > >>On Oct 15, 4:02 am, Abandoned <[EMAIL PROTECTED]> wrote: > >>> Hi.. > >>> I have a list as a=[1, 2, 3 ] (4 million elements) > >>> and > >>> b=",".join(a)

Re: how to print a traceback?

2007-10-16 Thread Gabriel Genellina
En Tue, 16 Oct 2007 01:03:08 -0300, <[EMAIL PROTECTED]> escribi�: > i'm struggling to get some proxy code working with liburl[2] and want > to print > some tracebacks in my class ProxyHTTPConnection::request(). > do i have to force an exception and print a backtrace in catch or > can i just print

Re: ANN: magnitude 0.9.1

2007-10-16 Thread juan
Ben Finney <[EMAIL PROTECTED]> writes: > Please don't ever recommend 'from foo import *' in end-user > documentation. It's generally a bad practice and should only be done > when the individual programmer understands the tradeoffs involved; > putting it in the documentation for a module is setting

numpy : efficient sum computations

2007-10-16 Thread TG
Hi there. I want to do some intensive computations with numpy, and I'm struggling a bit to find my wayy. Here is the problem : m and d are two matrices : > m.shape = (x,y,a,b) > d.shape = (a,b) I want to return > i.shape = (x,y) with > i[x,y] = sum(m[x,y] * d) I already found that > m[

Python's coming... from unexpected angles.

2007-10-16 Thread Diez B. Roggisch
Just found this: http://feeds.feedburner.com/~r/boingboing/iBag/~3/170523979/french-lady-finds-py.html I do believe that Python should be somewhat more upfront to brandish it's merits - but then, sneaky ways are ok with me to... Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE and opening with Python 2.5

2007-10-16 Thread Bjoern Schliessmann
Tony Mullen wrote: > Python itself seems to work. If I click python.exe it runs. > However, it does not appear in my start menu You could create the links yourself. Or reinstall Python 2.5.1. > and I cannot set it as the default application to open .py files. That's a problem of your OS. But

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Ben Finney
[EMAIL PROTECTED] (Joan M. Garcia) writes: > Ben Finney <[EMAIL PROTECTED]> writes: > > Please don't ever recommend 'from foo import *' in end-user > > documentation. [...] > > Got it, and solved. Thanks. Thanks for the quick response. A further issue, that requires a change of interface: Plea

Re: Python's coming... from unexpected angles.

2007-10-16 Thread Ben Finney
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Just found this: The direct link to the article is http://www.boingboing.net/2007/10/16/french-lady-finds-py.html>. > I do believe that Python should be somewhat more upfront to brandish > it's merits - but then, sneaky ways are ok with me to...

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > A further issue, that requires a change of interface: Please comply > with PEP 8 http://www.python.org/dev/peps/pep-0008/> for your > module interface. In particular, please name classes with TitleCase, > and functions, methods, and instance names with lowe

ANN: Shed Skin 0.0.24, 0.0.25

2007-10-16 Thread Mark Dufour
Hi all, I've just released Shed Skin 0.0.25. Together with the (unannounced) 0.0.24 release, there have been some interesting changes. Most importantly perhaps, Shed Skin now caches (most) 1-length strings, which can improve performance dramatically for string-intensive programs. I also performed

extension to list extend

2007-10-16 Thread James Stroud
Found that this would be handy today: alist = [1, 2, 3] alist.extend(['a', 'b', 'c'], 1) alist == [1, 'a', 'b', 'c', 2, 3] # True James -- James Stroud UCLA-DOE Institute of Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com -- http://mail.python.org

Re: Python's coming... from unexpected angles.

2007-10-16 Thread Eric Brunel
On Tue, 16 Oct 2007 11:14:57 +0200, Ben Finney <[EMAIL PROTECTED]> wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > >> Just found this: > > The direct link to the article is > http://www.boingboing.net/2007/10/16/french-lady-finds-py.html>. > >> I do believe that Python should be somewh

Re: Good Book

2007-10-16 Thread James Stroud
Lars Johansen wrote: > HI are there any recommended books for an sysadmin who has been mostly > writing shell scripts, but want to move up to create more complex > programs. Not that I am shamelessly promoting python here, but in all sincerity, Programming Python by Lutz is exactly what you want.

Re: extension to list extend

2007-10-16 Thread Peter Otten
James Stroud wrote: > Found that this would be handy today: > >alist = [1, 2, 3] >alist.extend(['a', 'b', 'c'], 1) >alist == [1, 'a', 'b', 'c', 2, 3] # True A better name for that would be insert(), but that is already used for single-item insertion. For the time being you can do >

Re: extension to list extend

2007-10-16 Thread James Stroud
Peter Otten wrote: > James Stroud wrote: > >> Found that this would be handy today: >> >>alist = [1, 2, 3] >>alist.extend(['a', 'b', 'c'], 1) >>alist == [1, 'a', 'b', 'c', 2, 3] # True > > A better name for that would be insert(), but that is already used for > single-item insertion.

Re: Automatically organize module imports

2007-10-16 Thread Thomas Wittek
Alexandre Badez: > If you're using Eclipse + PyDev, I strongly recommend you to give a > try to PyLint ("http://www.logilab.org/857";). Great. It has a warning about unused imports. Perfect. (Though, it was a bit tricky to install as easy_install didn't get the dependencies right on Win XP) Thank

Re: CGI and external JavaScript nightmare

2007-10-16 Thread Paul Boddie
On 11 Okt, 08:23, IamIan <[EMAIL PROTECTED]> wrote: > My website is built from a Python CGI and works great. I'm now > including Google Ads, which requires two pieces of JavaScript; the > first contains the display settings for the ads, and the second piece > is a very lengthy garbled js file > at

easy but difficult

2007-10-16 Thread Beema shafreen
hi everybody, I have a file separated by hash: as shown below, file: A#1 B#2 A#2 A#3 B#3 I need the result like this: A 1#2#3 B 2#3 how will generate the result like this from the above file can somebody tell me what i have to do.. My code: fh =open('abc_file','r') for

Re: easy but difficult

2007-10-16 Thread Matthieu Brucher
Hi, Use write() instead of print Matthieu 2007/10/16, Beema shafreen <[EMAIL PROTECTED]>: > > hi everybody, > I have a file separated by hash: > as shown below, > file: > A#1 > B#2 > A#2 > A#3 > B#3 > > I need the result like this: > A 1#2#3 > B 2#3 > > how will generate the result like this

Re: easy but difficult

2007-10-16 Thread Francesco Guerrieri
On 10/16/07, Beema shafreen <[EMAIL PROTECTED]> wrote: > hi everybody, > I have a file separated by hash: > as shown below, > file: > A#1 > B#2 > A#2 > A#3 > B#3 > > I need the result like this: > A 1#2#3 > B 2#3 > > how will generate the result like this from the above file > can somebody tell

Re: easy but difficult

2007-10-16 Thread Amit Khemka
On 10/16/07, Beema shafreen <[EMAIL PROTECTED]> wrote: > hi everybody, > I have a file separated by hash: > as shown below, > file: > A#1 > B#2 > A#2 > A#3 > B#3 > > I need the result like this: > A 1#2#3 > B 2#3 > > how will generate the result like this from the above file > can somebody tell

Re: Python's coming... from unexpected angles.

2007-10-16 Thread Ben Finney
"Eric Brunel" <[EMAIL PROTECTED]> writes: > Well, I'd definetely vote for a name change for PyPy, as in french, > it's pronounced "pee-pee", and yes, it means what you think it > means... ;-) Does that mean you pronounce the word for the serpent as "pee-thon"? Anyway, the pronunciation of "Pytho

Re: Newbi Q: What is a rational for strings not being lists in Python?

2007-10-16 Thread Dmitri O.Kondratiev
On 10/16/07, Matt McCredie <[EMAIL PROTECTED]> wrote: [quote] > The example you posted won't work with tuples either because they, > like strings, are also immutable. So, the best way to get the posted > code to work (which is a bad way to go about reversing a string, but I > digress) > [end-quote

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Laurent Pointal
[EMAIL PROTECTED] a écrit : > I am happy to announce the first release of magnitude, a > library for computing with physical quantities. It is > released under the Apache v. 2 license. > > A physical quantity is a number with a unit, like 10 > km/h. Units can be any of the SI units, plus a bunch o

Re: numpy : efficient sum computations

2007-10-16 Thread TG
Okay, another one which I don't have answer for. it is the reverse case, sort of : > phi.shape (x,y) > d.shape (a,b) I want to return m : > m.shape = (x,y,a,b) with m[x,y] = d * phi[x,y] currently, my code is : > m = empty(phi.shape + d.shape) > m[:,:] = d this repeats the matrix d x*y times,

Re: ANN: magnitude 0.9.1

2007-10-16 Thread Ben Finney
Laurent Pointal <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] a écrit : > > I am happy to announce the first release of magnitude, a library > > for computing with physical quantities. It is released under the > > Apache v. 2 license. > > [...] > > Home page: http://juanreyero.com/magnitude/ >

Re: easy but difficult

2007-10-16 Thread Paul McGuire
On Oct 16, 5:42 am, "Francesco Guerrieri" <[EMAIL PROTECTED]> wrote: > On 10/16/07, Beema shafreen <[EMAIL PROTECTED]> wrote: > > > > > > > hi everybody, > > I have a file separated by hash: > > as shown below, > > file: > > A#1 > > B#2 > > A#2 > > A#3 > > B#3 > > > I need the result like this:

Re: Newbi Q: What is a rational for strings not being lists in Python?

2007-10-16 Thread Simon Brunning
On 10/16/07, Benjamin <[EMAIL PROTECTED]> wrote: > Good explanation, but basically strings are immutable so they can be > used in dicts. Nope. Value types should always be immutable. -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunnin

Re: easy but difficult

2007-10-16 Thread Paul McGuire
On Oct 16, 5:46 am, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > On 10/16/07, Beema shafreen <[EMAIL PROTECTED]> wrote: > > > > > > > hi everybody, > > I have a file separated by hash: > > as shown below, > > file: > > A#1 > > B#2 > > A#2 > > A#3 > > B#3 > > > I need the result like this: > > A 1

Re: Newbi Q: What is a rational for strings not being lists in Python?

2007-10-16 Thread Neil Cerutti
On 2007-10-16, Simon Brunning <[EMAIL PROTECTED]> wrote: > On 10/16/07, Benjamin <[EMAIL PROTECTED]> wrote: > >> Good explanation, but basically strings are immutable so they can be >> used in dicts. > > Nope. Value types should always be immutable. > >

Re: Simple Text Processing Help

2007-10-16 Thread patrick . waldo
And now for something completely different... I see a lot of COM stuff with Python for excel...and I quickly made the same program output to excel. What if the input file were a Word document? Where is there information about manipulating word documents, or what could I add to make the same prog

Re: Simple Text Processing Help

2007-10-16 Thread patrick . waldo
And now for something completely different... I've been reading up a bit about Python and Excel and I quickly told the program to output to Excel quite easily. However, what if the input file were a Word document? I can't seem to find much information about parsing Word files. What could I add

[ANN] InformixDB-2.5 released

2007-10-16 Thread Carsten Haese
I am pleased to announce a new release of InformixDB, the DB-API 2.0 module for connecting to IBM Informix database engines. A lot has happened in the ten months since the last release: - Compatibility with CSDK 3.00 - Ability to manually interrupt or automatically time out SQL execution - Proper

Re: Simple HTML template engine?

2007-10-16 Thread Gerardo Herzig
allen.fowler wrote: >Hello, > >Can anyone recommend a simple python template engine for generating >HTML that relies only on the Pyhon Core modules? > >No need for caching, template compilation, etc. > >Speed is not a major issue. > >I just need looping and conditionals. Template inheritance would

Integrating a GUI with an asyncore-based server

2007-10-16 Thread Giampaolo Rodola'
Hi there. Just for the heck of it I'd like to write a simple front-end for an asyncore-based server I wrote by using Tkinter. I wrote a simple graphical interface consisting of two buttons: "Start server" and "Stop server". The first button should start the asyncore main loop while the second shoul

Integrating a GUI with an asyncore-based server

2007-10-16 Thread Giampaolo Rodola'
Hi there. Just for the heck of it I'd like to write a simple front-end for an asyncore-based server I wrote by using Tkinter. I wrote a simple graphical interface consisting of two buttons: "Start server" and "Stop server". The first button should start the asyncore main loop while the second shoul

Re: Python's coming... from unexpected angles.

2007-10-16 Thread Stefan Behnel
Ben Finney wrote: > "Eric Brunel" <[EMAIL PROTECTED]> writes: > >> Well, I'd definetely vote for a name change for PyPy, as in french, >> it's pronounced "pee-pee", and yes, it means what you think it >> means... ;-) > > Anyway, the pronunciation of "Python" (and hence the "Py" in "PyPy") > is ho

Re: Automatically organize module imports

2007-10-16 Thread Alexandre Badez
On Oct 16, 12:08 pm, Thomas Wittek <[EMAIL PROTECTED]> wrote: > Great. It has a warning about unused imports. Perfect. > (Though, it was a bit tricky to install as easy_install didn't get the > dependencies right on Win XP) > > Thank you! > -- > Thomas Wittek > Web:http://gedankenkonstrukt.de/ > Ja

Re: Newbi Q: What is a rational for strings not being lists in Python?

2007-10-16 Thread Paul McGuire
On Oct 15, 3:03 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > So, the best way to get the posted > code to work [...] is to cast the input parameter to a list first. > >>> s = "I am a string" > >>> x = list(s) > >>> x > > ['I', ' ', 'a', 'm', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g'] >>> "

Re: Integrating a GUI with an asyncore-based server

2007-10-16 Thread Michele Simionato
On Oct 16, 2:57 pm, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: > Hi there. > Just for the heck of it I'd like to write a simple front-end for an > asyncore-based server I wrote by using Tkinter. > I wrote a simple graphical interface consisting of two buttons: "Start > server" and "Stop server".

Dynamic and lazy import

2007-10-16 Thread Alexandre Badez
Hye everyone, I'm would like to do something a bit tricky. I would like when I do something like to create a __init__ package's (here calle my_package) file witch make an action when we try to import something in this package... Quiet like __getattribute__ work for a class, I would like this kin

while statements

2007-10-16 Thread Shawn Minisall
I just learned about while statements and get why you place them around inputs for validation, but I'm a little lost on exactly where to place it with what condition in this program where the number of fat grams exceeds the total number of calories so that it loops back and asks you the two que

Build Python 2.5 against Tk 8.5

2007-10-16 Thread Kevin Walzer
I'd like to experiment with Tk 8.5 (now in beta) in my Python application, but Python 2.5 requires Tk 8.4.x. What would I need to patch in the Python sources or build scripts to get it built against Tk 8.5? -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mail

Trying to Send Repeated Messages to a Server Using sockets

2007-10-16 Thread danfolkes
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do anything. I would love some help, here is the code: import socket import thread import time def Node(nod

Re: while statements

2007-10-16 Thread danfolkes
On Oct 16, 9:28 am, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I just learned about while statements and get why you place them around > inputs for validation, but I'm a little lost on exactly where to place > it with what condition in this program where the number of fat grams > exceeds the total

ctypes & Wrapping Complex Datatypes

2007-10-16 Thread gamename
Hi, I've just started using ctypes and so far, its great. But I'm running to some problems with complex datatypes. I'm not sure how to wrap something like this: /* This defines the Handle type in a header file. I don't think this needs wrapping, its just to show the handle definition for co

Re: while statements

2007-10-16 Thread Francesco Guerrieri
On 10/16/07, danfolkes <[EMAIL PROTECTED]> wrote: > Instead of: if(cal<=0) > > you could do : > cal=0 > while cal<=0: > cal = int(raw_input("Please enter the number of calories in your > food: ")) > > that would make sure that your input is > 0 Calories could be non integer :) francesco --

Re: confused on calculating date difference in days.

2007-10-16 Thread krishnakant Mane
hello, thanks all of you for providing valuable help. right now I am confused about the delta object. how can I extract the difference between two dates in terms of day using the delta object? I tried reading the python docs but did not understand the concept of delta object and how can I measure t

Re: ctypes & Wrapping Complex Datatypes

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 06:47:06 -0700, gamename wrote: > I've just started using ctypes and so far, its great. But I'm running > to some problems with complex datatypes. I'm not sure how to wrap > something like this: > >/* This defines the Handle type in a header file. I don't think > this n

Script to get the current Woot.com Product.

2007-10-16 Thread danfolkes
Hey, I just decided to check out urllib. This script gets the Woot.com product of the day and prints it. from urllib import urlopen docu = urlopen("http://www.woot.com";).read( ) woot = docu[docu.find("")] print woot - Daniel Folkes http://danfolkes.com [EMAIL PROTECTED] -- http://mail.p

Re: confused on calculating date difference in days.

2007-10-16 Thread Diez B. Roggisch
krishnakant Mane wrote: > hello, > thanks all of you for providing valuable help. > right now I am confused about the delta object. > how can I extract the difference between two dates in terms of day > using the delta object? > I tried reading the python docs but did not understand the concept of

Re: while statements

2007-10-16 Thread kyosohma
On Oct 16, 8:28 am, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I just learned about while statements and get why you place them around > inputs for validation, but I'm a little lost on exactly where to place > it with what condition in this program where the number of fat grams > exceeds the total

Re: IDLE and opening with Python 2.5

2007-10-16 Thread Tony Mullen
Well, for what it is worth, the solution to my problem is... just to wait a while. Even after re-starting the machine, I was still having the problems I described. Now I check it after a few hours of the machine being asleep and lo and behold, everything is as advertised. Seems to all be working

Re: confused on calculating date difference in days.

2007-10-16 Thread Shane Geiger
# Example import datetime def days_old(birth_year=1974,birth_month=12,birth_day=7): return (datetime.date.today() - datetime.date(birth_year,birth_month,birth_day) ).days >>> days_old() 12000 krishnakant Mane wrote: > hello, > thanks all of you for providing valuable help. > right now I am

Using Python to access CORBA server?

2007-10-16 Thread Dmitri O.Kondratiev
Need advice: What library can Python client use to access CORBA server using DII (Dynamic Invocation Interface) ? Thanks, Dima -- http://mail.python.org/mailman/listinfo/python-list

Re: Normalize a polish L

2007-10-16 Thread Peter Bengtsson
On Oct 15, 10:57 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Oct 16, 2:33 am, Peter Bengtsson <[EMAIL PROTECTED]> wrote: > > > > > In UTF8, \u0141 is a capital L with a little dash through it as can be > > seen in this image:http://static.peterbe.com/lukasz.png > > > I tried this:>>> import uni

Re: Build Python 2.5 against Tk 8.5

2007-10-16 Thread Martin v. Löwis
> I'd like to experiment with Tk 8.5 (now in beta) in my Python > application, but Python 2.5 requires Tk 8.4.x. Why do you say that? AFAIK, that's not the case. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Build Python 2.5 against Tk 8.5

2007-10-16 Thread Kevin Walzer
Martin v. Löwis wrote: >> I'd like to experiment with Tk 8.5 (now in beta) in my Python >> application, but Python 2.5 requires Tk 8.4.x. > > Why do you say that? AFAIK, that's not the case. It's been a while, but when I've tried to run my Tkinter app against Tk 8.5 with a stock Python installat

Problem with proxies

2007-10-16 Thread Ameet Nanda
Hi All, I access net using a proxy, which I have to authenticate everytime I try to access net from my system. Now when I use urllib2.urlopen(url) , I cant get ahead. I must provide proxy authentication , I tried reading docs online which speak of something called as FancyUrlOpener. Now i want to

Re: Simple HTML template engine?

2007-10-16 Thread Carl Banks
On Oct 16, 4:07 am, jean-michel bain-cornu <[EMAIL PROTECTED]> wrote: > > Can anyone recommend a simple python template engine for generating > > HTML that relies only on the Pyhon Core modules? > > > No need for caching, template compilation, etc. > > > Speed is not a major issue. > > > I just nee

Why does the message send only once?

2007-10-16 Thread danfolkes
Why does the message send only once? The node sends once, then fails after that. import socket import thread import time def Node(nodeAddress): '''connect to node and get its file load''' sN = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Echo client program HOST = nodeA

Re: easy but difficult

2007-10-16 Thread Bruno Desthuilliers
Paul McGuire a écrit : > On Oct 16, 5:46 am, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > (snip) > Another technique that helps improve script readability is to assign > the results of the split into separate variables, instead of just a > list. This way you can refer to the items with meaningful n

Re: sqlite and TemporaryFile under Windows

2007-10-16 Thread Paul McNett
Matthieu Brucher wrote: > > If this is the way of using sqlite, it is still cumbersome as a > lot of > > other classes that work on files can work on file-like (and isn't > it the > > whole point of Python ;) ? > > I don't think that sqlite can work on streams, or on fil

Re: sqlite and TemporaryFile under Windows

2007-10-16 Thread Matthieu Brucher
> > > Obviously it cannot, but what are the reason it can't ? > > I have no idea. > > > Well, I could, but in this case I have to delete the file myself, which > > the whole point of the use of TemporaryFile. > > Go with the flow dude! Unless you want to solve the issue by delving in > to the sourc

Re: Singleton

2007-10-16 Thread pythoncurious
Hi again, Just wanted to say thanks. I now see that I misunderstood where the problem was and I got useful information about how importing stuff works. My problem is solved and I'm grateful for your help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Normalize a polish L

2007-10-16 Thread Roberto Bonvallet
On Oct 15, 6:57 pm, John Machin <[EMAIL PROTECTED]> wrote: > To "asciify" such text, you need to build a look-up table that suits > your purpose. unicodedata.decomposition() is (accidentally) useful in > providing *some* of the entries for such a table. This is the only approach that can actually

Getting error message/trace over the C API

2007-10-16 Thread Sami Vaisanen
Hello group, I'm writing a C++ based application that embeds the python engine. Now I have a problem regarding exception/error information. Is there a way to get the exception message and possibly the traceback into a string for example? I've been eyeballing the PyErr_ module and it seems fairly

Re: Why does the message send only once?

2007-10-16 Thread Bjoern Schliessmann
danfolkes wrote: > Why does the message send only once? Because your server is designed to only accept one connection, wait forever except there is an exception, and quit thereafter. > def Server(address): > [...] > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.bind((HOST

Re: Why does the message send only once?

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 15:55:31 +, danfolkes wrote: > Why does the message send only once? > > The node sends once, then fails after that. Because the `Server` just seems to handle the first connection and is done then. Insert some ``print``\s to see what's going on. Ciao, Marc 'Black

documentation for tk.call interface

2007-10-16 Thread dbr517
I'm using Python + Tkinter for a small gui . . . there are LOTS of places inside Tkinter with code like this: self.tk.call('tkwait', 'variable', name) (this particular one is from the IntVar class). I've searched the Tkinter docs with no success; can someone point me at the documentation

Re: PyQt ProgressBar

2007-10-16 Thread David Boddie
On Mon Oct 15 14:24:09 CEST 2007, luca72 wrote: > Hello i have made anly one test like this: > > from time import sleep > barra = QtGui.QProgressBar() > barra.setMinimum(0) > barra.setMaximum(10) > for a in range(10): >sleep(1) >barra.setValue(a) >app.processEvents()

Re: Why does the message send only once?

2007-10-16 Thread Bruno Desthuilliers
danfolkes a écrit : You already posted the same question here one hour and a half ago. Please avoid. -- http://mail.python.org/mailman/listinfo/python-list

Re: Good Book

2007-10-16 Thread kyosohma
On Oct 16, 3:00 am, Lars Johansen <[EMAIL PROTECTED]> wrote: > HI are there any recommended books for an sysadmin who has been mostly > writing shell scripts, but want to move up to create more complex > programs. The Python Cookbook would probably be another good resource. While I don't like the

Re: PIL and getpixel()

2007-10-16 Thread [EMAIL PROTECTED]
> Just pack the RGB values into an `int` by shifting and or-ing. Untested: > > red, green, blue = img.getpixel(x, y) > pixel_as_int = red << 16 | green << 8 | blue > > Ciao, > Marc 'BlackJack' Rintsch thanx Marc will try that dn -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with proxies

2007-10-16 Thread coolman_suk
i have never used proxies, in college it works fine dont know abt ur wipro settings. anyway try this http://docs.python.org/lib/urllib2-examples.html then l8tr try this http://docs.python.org/lib/module-urllib2.html -- http://mail.python.org/mailman/listinfo/python-list

Re: documentation for tk.call interface

2007-10-16 Thread Kevin Walzer
[EMAIL PROTECTED] wrote: > I'm using Python + Tkinter for a small gui . . . there are LOTS of > places inside Tkinter with code like this: > > self.tk.call('tkwait', 'variable', name) > > (this particular one is from the IntVar class). > > I've searched the Tkinter docs with no success;

Re: re.sub

2007-10-16 Thread Massimo Di Pierro
Even stranger >>> re.sub('a', '\\n','bab') 'b\nb' >>> print re.sub('a', '\\n','bab') b b Massimo On Oct 16, 2007, at 1:54 AM, DiPierro, Massimo wrote: > Shouldn't this > print re.sub('a','\\n','bab') > b > b > > output > > b\nb > > instead? > > Massimo > > On Oct 16, 2007, at 1:34 AM, G

Re: re.sub

2007-10-16 Thread Chris Mellon
On 10/16/07, Massimo Di Pierro <[EMAIL PROTECTED]> wrote: > Even stranger > > >>> re.sub('a', '\\n','bab') > 'b\nb' > >>> print re.sub('a', '\\n','bab') > b > b > You called print, so instead of getting an escaped string literal, the string is being printed to your terminal, which is printing th

Re: Good Book

2007-10-16 Thread borroff
On Oct 16, 4:00 am, Lars Johansen <[EMAIL PROTECTED]> wrote: > HI are there any recommended books for an sysadmin who has been mostly > writing shell scripts, but want to move up to create more complex > programs. I believe there's a "Python for System Administration" book in the works, an equival

RE: re.sub

2007-10-16 Thread DiPierro, Massimo
That is not the problem. The problem is that re.sub('a','\\n','bab') cannot be the same as re.sub('a','\n','bab') This is evaluating the string to be substituted before the substitution. Massimo From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ch

how to convert string to number?

2007-10-16 Thread wang frank
Hi, I have struggling to efficiently convert a string list to number. Here is my problem. I have a file that contains lines such as: data_1 1 1 2 3.5 After I read the data from the file by using readlines(), each line contains a string. I use the re moduel to split the line into ['data_1',

RE: re.sub

2007-10-16 Thread DiPierro, Massimo
It is the fisrt line that is wrong, the second follows from the first, I agree. From: Tim Chase [EMAIL PROTECTED] Sent: Tuesday, October 16, 2007 1:20 PM To: DiPierro, Massimo Cc: python-list@python.org; Berthiaume, Andre Subject: Re: re.sub > Even strange

RE: re.sub

2007-10-16 Thread DiPierro, Massimo
Let me show you a very bad consequence of this... a=open('file1.txt','rb').read() b=re.sub('x',a,'x') open('file2.txt','wb').write(b) Now if file1.txt contains a \n or \" then file2.txt is not the same as file1.txt while it should be. Massimo From: Tim C

  1   2   >