Re: Getting an objetcs dict?

2008-09-01 Thread alex23
On Sep 2, 4:31 am, ssecorp <[EMAIL PROTECTED]> wrote: > X.__dict__() and ngot a dict of its variables. > > Now i get errors doing this. what am i doing wrong? The immediate problem is you're not reading the error messages. >>> X.__dict__() Traceback (most recent call last): File "", line 1, in

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-01 Thread Steven D'Aprano
On Tue, 02 Sep 2008 11:13:27 +1000, Ben Finney wrote: > [EMAIL PROTECTED] writes: > >> For Python 2.7/3.1 I'd now like to write a PEP regarding the >> underscores into the number literals, like: 0b_0101_, 268_435_456 >> etc. > > +1 on such a capability. > > -1 on underscore as the separator

Re: Put the output from all my programs in one place

2008-09-01 Thread alex23
On Sep 2, 6:30 am, Jesse Aldridge <[EMAIL PROTECTED]> wrote: > I want to put all the output from all of my python programs in one > place. Have you considered using the python logging module? http://docs.python.org/lib/module-logging.html http://www.onlamp.com/pub/a/python/2005/06/02/logging.html

Re: python mechanize/libxml2dom question

2008-09-01 Thread Stefan Behnel
bruce wrote: > i've got the following situation, with the following test url: > "http://schedule.psu.edu/soc/fall/Alloz/a-c/acctg.html#";. > > i can generate a list of the tables i want for the courses on the page. > however, when i try to create the xpath query, and plug it into the xpath > withi

python XPATH question - mechanize/libxml2dom

2008-09-01 Thread bruce
hi... i can use an xpath query to create a node from an html/dom representation. however, if i have a node, is there a way to generate an xpath query from the node. in testing with firefox/dom inspector, i can use "ancestor::*", but i can't determine where/how to implement this using mechanize/li

Re: Process "Killed"

2008-09-01 Thread dieter h
On Sat, Aug 30, 2008 at 11:07 AM, Eric Wertman <[EMAIL PROTECTED]> wrote: >> I'm doing some simple file manipulation work and the process gets >> "Killed" everytime I run it. No traceback, no segfault... just the >> word "Killed" in the bash shell and the process ends. The first few >> batch runs w

Re: Numeric literal syntax

2008-09-01 Thread Fredrik Lundh
Ben Finney wrote: I would argue that the precedent, already within Python, for using a space to separate pieces of a string literal, is more important than precedents from other programming languages. that precedent also tells us that the whitespace approach is a common source of errors. tak

Re: How to print first(national) char from unicode string encoded inutf-8?

2008-09-01 Thread Mark Tolonen
"Marco Bizzarri" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mon, Sep 1, 2008 at 3:25 PM, <[EMAIL PROTECTED]> wrote: When I do ${urllib.unquote(c.user.firstName)} without encoding to latin-1 I got different chars than I will get: no Łukasz but Å ukasz -- http://mail.pytho

Re: Numeric literal syntax

2008-09-01 Thread Ben Finney
[EMAIL PROTECTED] writes: > Ben Finney: > > I don't see any good reason (other than your familiarity with the > > D language) to use underscores for this purpose, and much more > > reason (readability, consistency, fewer arbitrary differences in > > syntax, perhaps simpler implementation) to use w

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread akineko
On Sep 1, 8:28 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > Can you clarify what is this "sticky" behavior ? Are you referring to > a toggle button ? If yes, then you might be after a simple > Checkbutton: > > checkbutton = Tkinter.Checkbutton(indicatoron=False, text='test') I wouldn't spend

python mechanize/libxml2dom question

2008-09-01 Thread bruce
hi... i've got the following situation, with the following test url: "http://schedule.psu.edu/soc/fall/Alloz/a-c/acctg.html#";. i can generate a list of the tables i want for the courses on the page. however, when i try to create the xpath query, and plug it into the xpath within python, i'm miss

python mechanize/libxml2dom question

2008-09-01 Thread bruce
hi... i've got the following situation, with the following test url: "http://schedule.psu.edu/soc/fall/Alloz/a-c/acctg.html#";. i can generate a list of the tables i want for the courses on the page. however, when i try to create the xpath query, and plug it into the xpath within python, i'm miss

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread Guilherme Polo
On Mon, Sep 1, 2008 at 11:01 PM, akineko <[EMAIL PROTECTED]> wrote: > On Sep 1, 6:34 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: >> This is an illusion you have, calling those methods are not the way >> for explicitly controlling button's behavior, not more than generating >> proper events. The

Re: Processes in Linux from Python

2008-09-01 Thread Derek Martin
On Mon, Sep 01, 2008 at 08:40:42AM +0200, Diez B. Roggisch wrote: > Johny schrieb: > >To get a number of the http processes running on my Linux( Debia box) > >I use > >ps -ef | grep "[h]ttpd" | wc -l [...] > The shell does the exact same thing. And by the way: i think you miss a > > grep -v grep

Re: (in memory) database

2008-09-01 Thread Zentrader
On Ubuntu you want to install something like python-sqlite (a search for "python" should turn up everything). There are 2 parts to this, SQLite and the python bindings to SQLite. So you seem to have SQLite installed but not the Python bindings. Also, on some systems you have to have python-sqlit

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread akineko
On Sep 1, 6:34 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > This is an illusion you have, calling those methods are not the way > for explicitly controlling button's behavior, not more than generating > proper events. The explicit way is to not use a button, instead > (ab)use Canvas. Some of

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-01 Thread bearophileHUGS
Ben Finney: > I don't see any good reason (other than your familiarity with the D > language) to use underscores for this purpose, and much more reason > (readability, consistency, fewer arbitrary differences in syntax, > perhaps simpler implementation) to use whitespace just as with string > liter

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread Guilherme Polo
On Mon, Sep 1, 2008 at 10:09 PM, akineko <[EMAIL PROTECTED]> wrote: > On Sep 1, 5:52 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > >> Are you trying to simulate clicks ? You should be doing it using >> event_generate, more below. >> > > Actually, I was trying to implement a "sticky" button. > (

Numeric literal syntax (was: Py 2.6 changes)

2008-09-01 Thread Ben Finney
[EMAIL PROTECTED] writes: > For Python 2.7/3.1 I'd now like to write a PEP regarding the > underscores into the number literals, like: 0b_0101_, 268_435_456 > etc. +1 on such a capability. -1 on underscore as the separator. When you proposed this last year, the counter-proposal was made htt

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread akineko
On Sep 1, 5:52 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > Are you trying to simulate clicks ? You should be doing it using > event_generate, more below. > Actually, I was trying to implement a "sticky" button. (Button Release is done later by another event) I already tried event_generate.

Re: Py 2.6 changes

2008-09-01 Thread Mensanator
On Sep 1, 2:15�pm, [EMAIL PROTECTED] wrote: > I have just re-read the list of changes in Python 2.6, it's huge, > there are tons of changes and improvements, I'm really > impressed:http://docs.python.org/dev/whatsnew/2.6.html > > I'll need many days to learn all those changes! I can see it fixes >

Re: Python 3.0b2 cannot map '\u12b'

2008-09-01 Thread Terry Reedy
Marc 'BlackJack' Rintsch wrote: First, thank you for the informative responses. The windows command prompt expects cp437 because that's what old DOS programs print to it. Grrr. When the interpreter runs, it opens the command prompt window with Python running, and the window closes when Py

Re: Py 2.6 changes

2008-09-01 Thread Mensanator
On Sep 1, 6:55�pm, [EMAIL PROTECTED] wrote: > Steven D'Aprano: > > > productory() -- I don't know that function, and googling mostly comes up > > with retail product searches. Do you mean product(), > > Darn my English, you are right, sorry, I meant a product() of > course :-) But the name product

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread Guilherme Polo
On Mon, Sep 1, 2008 at 7:45 PM, akineko <[EMAIL PROTECTED]> wrote: > Hi everyone, > > This is a memorandum so that other people can share the info. > > The following methods are declared in the Tkinter Button class. > tkButtonDown(), tkButtonEnter(), tkButtonInvoke(), tkButtonLeave(), > tkButtonUp(

Re: The Importance of Terminology's Quality

2008-09-01 Thread George Neuner
On Mon, 1 Sep 2008 21:03:44 + (UTC), Martin Gregorie <[EMAIL PROTECTED]> wrote: >On Mon, 01 Sep 2008 12:04:05 -0700, Robert Maas, http://tinyurl.com/uh3t >wrote: > >>> From: George Neuner <[EMAIL PROTECTED]> A friend of mine had an >>> early 8080 micros that was programmed through the front pa

Re: Py 2.6 changes

2008-09-01 Thread bearophileHUGS
Steven D'Aprano: > productory() -- I don't know that function, and googling mostly comes up > with retail product searches. Do you mean product(), Darn my English, you are right, sorry, I meant a product() of course :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 2.6 changes

2008-09-01 Thread Steven D'Aprano
On Mon, 01 Sep 2008 12:15:53 -0700, bearophileHUGS wrote: > Now math has factorial: > http://docs.python.org/dev/library/math.html#math.factorial Seen how > reduce() is removed from Python 3 (I know it's in itertools), and seeing > that for me to write a productory() function was the first usage I

Tkinter after() under VMware player

2008-09-01 Thread akineko
Hi everyone, I wrote a Tkinter program that has a blinking widget. The blinking is controlled by the after() method available in the Tkinter. It worked very nicely. However, when I tried the program with a Unix OS that is running under VMware (hosted OS), I noticed the blinking rate is greatly re

Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-01 Thread akineko
Hi everyone, This is a memorandum so that other people can share the info. The following methods are declared in the Tkinter Button class. tkButtonDown(), tkButtonEnter(), tkButtonInvoke(), tkButtonLeave(), tkButtonUp() However, they are not working, when you try, you will get: _tkinter.TclError

Re: encoding

2008-09-01 Thread Christian Heimes
Gandalf wrote: if i want to print utf-8 string i should writre: print u"hello word" but what happen if i want to print variable? u"hello world" is *not* an utf-8 encoded string. It's a unicode string. I suggest you read http://www.joelonsoftware.com/articles/Unicode.html Christian -- http

Re: encoding

2008-09-01 Thread Gandalf
On Sep 1, 11:59 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Gandalf schrieb: > > > if i want to print utf-8 string i should writre: > > > print u"hello word" > > No, you don't. You write > > print u"hello world".encode("utf-8") > > Read this: > > http://www.reportlab.com/i18n/python_unicode

Re: Py 2.6 changes

2008-09-01 Thread Alan G Isaac
[EMAIL PROTECTED] wrote: Now math has factorial: http://docs.python.org/dev/library/math.html#math.factorial That's rather underdocumented. Does it really attempt exact calculation for arbitrary integers?? Is there any way to request a nice fast approximation for large integers (e.g., with Gos

Re: encoding

2008-09-01 Thread Diez B. Roggisch
Gandalf schrieb: if i want to print utf-8 string i should writre: print u"hello word" No, you don't. You write print u"hello world".encode("utf-8") Read this: http://www.reportlab.com/i18n/python_unicode_tutorial.html but what happen if i want to print variable? Then you do print varia

Play AVI files as cut-scene... in BGE - HOW?

2008-09-01 Thread jmdeschamps
Blender Game Engine does not seem able to just play an AVI clip file... I want to play these files as cut-scenes in a game - subprocess it to the OS, and continue on return seems a good solution - but so sorry, it's been a while since I've delved in such places... I need a refresher. Must be plat

encoding

2008-09-01 Thread Gandalf
if i want to print utf-8 string i should writre: print u"hello word" but what happen if i want to print variable? thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: enhancing/wrapping an existing instance of a duck

2008-09-01 Thread Bruno Desthuilliers
Neville Dempsey a écrit : What do I need to add to HTMLDecorator? A simpler example: import cgi class ClassX(object): pass # ... with own __repr__ class ClassY(object): pass # ... with own __repr__ inst_x=ClassX() Why do you need to prefix your variables with 'inst_' ? inst_y=ClassY(

Re: The Importance of Terminology's Quality

2008-09-01 Thread Martin Gregorie
On Mon, 01 Sep 2008 12:04:05 -0700, Robert Maas, http://tinyurl.com/uh3t wrote: >> From: George Neuner <[EMAIL PROTECTED]> A friend of mine had an >> early 8080 micros that was programmed through the front panel using >> knife switches > > When you say "knife switches", do you mean the kind that

Put the output from all my programs in one place

2008-09-01 Thread Jesse Aldridge
I want to put all the output from all of my python programs in one place. I've been trying to get this working for the last few days, but there are lots of annoying little details that are making the process quite difficult. I'm wondering if anyone can help me get this working. Currently I have o

Re: enhancing/wrapping an existing instance of a duck

2008-09-01 Thread Bruno Desthuilliers
Neville Dempsey a écrit : Basically I have an existing (maybe a rather large and complicated (existing) instance) that I want to add new member to. I suppose you mean "attributes" ? Cheers N Hacks/attempts follow: from math import sqrt try2 duck_obj = [ i*i for i

Re: TkMessageBox - Using sys.exit() is a a great pain. Looking for other similar commands.

2008-09-01 Thread Guilherme Polo
On Mon, Sep 1, 2008 at 3:35 PM, <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using a TkMessageBox for handling some errors and displaying them > through the message boxes. > > My code is as below: > if selectedVer == strNoArchivedResults: >tkMessageBox._show("Error", \ >

Re: (in memory) database

2008-09-01 Thread M.-A. Lemburg
On 2008-08-31 15:15, mark wrote: > Hi there, > > I need to extract data from text files (~4 GB) on this data some > operations are performed like avg, max, min, group etc. The result is > formated and written in some other text files (some KB). > > I currently think about database tools might be

Re: Getting an objetcs dict?

2008-09-01 Thread Bruno Desthuilliers
ssecorp a écrit : I did nce (I think). class X X.__dict__() and ngot a dict of its variables. Now i get errors doing this. what am i doing wrong? cf Wojtek's answer. -- http://mail.python.org/mailman/listinfo/python-list

Re: Py 2.6 changes

2008-09-01 Thread Christian Heimes
[EMAIL PROTECTED] wrote: I presume it's better for me to not hold my breath while I wait CPython to be written in C99 :-) First you have to convince Microsoft to release C99 compiler ... good luck! Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Buffer objects

2008-09-01 Thread Terry Reedy
Tom Harris wrote: Greetings, I need a little help with buffer objects. Many Python objects export the buffer interface, or can be persuaded to create a buffer object with a buffer() call. ... It must be me but I have found the whole buffer thing difficult to understand from the docs, it appe

Re: Python 3.0b2 cannot map '\u12b'

2008-09-01 Thread Marc 'BlackJack' Rintsch
On Mon, 01 Sep 2008 14:25:01 -0400, Terry Reedy wrote: > Marc 'BlackJack' Rintsch wrote: >> On Mon, 01 Sep 2008 02:27:54 -0400, Terry Reedy wrote: >> >> Most likely because Python figured out that the terminal expects cp437. >> What does `sys.stdout.encoding` say? > > The interpreter in the comma

Py 2.6 changes

2008-09-01 Thread bearophileHUGS
I have just re-read the list of changes in Python 2.6, it's huge, there are tons of changes and improvements, I'm really impressed: http://docs.python.org/dev/whatsnew/2.6.html I'll need many days to learn all those changes! I can see it fixes several of the missing things/problems I have found in

Re: The Importance of Terminology's Quality

2008-09-01 Thread Robert Maas, http://tinyurl.com/uh3t
> From: George Neuner <[EMAIL PROTECTED]> > A friend of mine had an early 8080 micros that was programmed > through the front panel using knife switches When you say "knife switches", do you mean the kind that are shaped like flat paddles? I think that would be the IMSAI, which came after the ALTA

Re: how to find position of dictionary values

2008-09-01 Thread Terry Reedy
Alexandru Palade wrote: > lookfor = 'dfsdf' > for item, value in kev.items(): >if lookfor in value: >print item >print value.index(lookfor) >break # assuming you only want one result slight variation: lookfor = 'dfsdf' for item, value i

Benchmark differences between 32 and 64 bit Python?

2008-09-01 Thread python
Anyone have any benchmarks on the difference in performance between 32 and 64 bit versions of Python for specific categories of operation, eg. math, file, string, etc. operations? My question is OS neutral so feel free to share your experience with either Windows or Linux OS's. Thank you, Malcolm

Re: Command lime code

2008-09-01 Thread Terry Reedy
Manuel Ebert wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Okay, I'll take I wild guess: By "command lime code" you did not refer to the algorithmic domination of citrus fruit, but rather to that window with the tiny blinking cursor and loads of text in white on black. Also by 'chdir

Re: Getting an objetcs dict?

2008-09-01 Thread Wojtek Walczak
On Mon, 1 Sep 2008 11:31:42 -0700 (PDT), ssecorp wrote: > I did nce(I think). > > class X > > X.__dict__() and ngot a dict of its variables. > > Now i get errors doing this. what am i doing wrong? You're not asking smart questions: http://www.catb.org/~esr/faqs/smart-questions.html HINT: the attr

TkMessageBox - Using sys.exit() is a a great pain. Looking for other similar commands.

2008-09-01 Thread dudeja . rajat
Hi, I'm using a TkMessageBox for handling some errors and displaying them through the message boxes. My code is as below: if selectedVer == strNoArchivedResults: tkMessageBox._show("Error", \ type='ok', icon='error', \

Getting an objetcs dict?

2008-09-01 Thread ssecorp
I did nce(I think). class X X.__dict__() and ngot a dict of its variables. Now i get errors doing this. what am i doing wrong? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0b2 cannot map '\u12b'

2008-09-01 Thread Terry Reedy
Marc 'BlackJack' Rintsch wrote: On Mon, 01 Sep 2008 02:27:54 -0400, Terry Reedy wrote: I doubt the OP 'chose' cp437. Why does Python using cp437 even when the default encoding is utf-8? On WinXP >>> sys.getdefaultencoding() 'utf-8' >>> s='\u012b' >>> s Traceback (most recent call last):

Re: Some problems with classes

2008-09-01 Thread Bruno Desthuilliers
Chris Rebert a écrit : On Sun, Aug 31, 2008 at 6:39 PM, ssecorp <[EMAIL PROTECTED]> wrote: Why/how is it possible to add variables like this? I don't understand this mechanism: http://docs.python.org/tut/node11.html#SECTION001133 Under the covers, Python objects are implemented

Make money using free affiliate programs

2008-09-01 Thread Aquila
Making money with affiliate programs is a better way, please see this web-site: http://www.abicana.com/affiliatenetworks.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: How Compute # of Days between Two Dates?

2008-09-01 Thread Ari Makela
On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: > Oddly, Leaning Python has no mention of datetime (not date or time), at > least, that I could find. I'm considering the Nutshell book, 2nd ed., as a > better reference (and cross reference) to various topics. datetime is pretty new standard

Re: Printing list of dates starting today

2008-09-01 Thread Ari Makela
On 2008-09-01, Luka Djigas <[EMAIL PROTECTED]> wrote: > please, I need your help. I'm new to python, so I don't know if this > will seem like a stupid question to some of you ... There are several ways to do it. Have a look at the documentation of modules time and datetime. For this exact problem

Re: CSV reader and unique ids

2008-09-01 Thread Tim Golden
Mike P wrote: I'm trying to use the CSV module to read in some data and then use a hashable method (as there are millions of records) to find unique ids and push these out to another file, You could either zip with a counter or use the uuid module, depending on just how unique you want your ids

Re: Writing to ms excel

2008-09-01 Thread Alan G Isaac
http://docs.python.org/lib/module-csv.html -- http://mail.python.org/mailman/listinfo/python-list

Problem with Twisted

2008-09-01 Thread Grom
Hello. I have something like that: from twisted.words.protocols.jabber import xmlstream from twisted.internet import protocol from twisted.words.xish import domish, utility from twisted.internet import reactor from twisted.python import log import sys, hashlib log.startLogging(sys.stdout) def ma

FHA Refinance Loan

2008-09-01 Thread king . geek22
On October 1, 2008, new FHA Refinance Loan Guidelines will go into effect as part of The Housing and Economic Recovery Act of 2008. This new FHA Mortgage program is designed to help thousands of homeowners who are at risk of foreclosure in their curent conventional or sub- prime home loans. The det

Re: How Compute # of Days between Two Dates?

2008-09-01 Thread W. eWatson
Grant Edwards wrote: On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: Grant Edwards wrote: On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: That's the question in Subject. For example, the difference between 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 03/03

Re: Printing list of dates starting today

2008-09-01 Thread Fredrik Lundh
Luka Djigas wrote: please, I need your help. I'm new to python, so I don't know if this will seem like a stupid question to some of you ... I have a need to write to a file (or just print on screen, that part doesn't matter at this point) a list of dates, starting today. For example: > 02.09.2

Printing list of dates starting today

2008-09-01 Thread Luka Djigas
Hello everyone, please, I need your help. I'm new to python, so I don't know if this will seem like a stupid question to some of you ... I have a need to write to a file (or just print on screen, that part doesn't matter at this point) a list of dates, starting today. For example: 02.09.2008. tue

Buffer objects

2008-09-01 Thread Tom Harris
Greetings, I need a little help with buffer objects. Many Python objects export the buffer interface, or can be persuaded to create a buffer object with a buffer() call. First question, the buffer() function appears very quick. Does it just wrap the internal pointer and then exit? Second questio

Re: How Compute # of Days between Two Dates?

2008-09-01 Thread Grant Edwards
On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: >> >>> That's the question in Subject. For example, the difference between >>> 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and >>> 03/03/2008

Re: Using an existing instance as parent

2008-09-01 Thread Bruno Desthuilliers
André a écrit : Hi, I was trying to find a way to set, upon __init__() the parent of a class to an existing instance. ??? Sorry but I just can't make any sense of this. Here is a minimal example of what I'm trying to do: class A(object): def __init__(self, x): self.x = x class B(A):

python extension dynamic linking

2008-09-01 Thread Martin Landa
Hi, I am writing Python extension in C++, in this extension I am using methods from another Python extension. On Linux I am currently linking my extension with used Python extension -- what is quite ugly. gcc ... -lgdi where gdi is a link to C++ extension imported by 'module' I would like to av

Re: How Compute # of Days between Two Dates?

2008-09-01 Thread W. eWatson
Grant Edwards wrote: On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: That's the question in Subject. For example, the difference between 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in year

Re: Eleganz way to get rid of \n

2008-09-01 Thread Fredrik Lundh
Hans Müller wrote: I'm quite often using this construct: for l in open("file", "r"): do something here, l contains the \n or \r\n on windows at the end. nope -- if you open a file in text mode (without the "b"), the I/O layer will translate "\r\n" to "\n" on Windows. if you want even

Re: Eleganz way to get rid of \n

2008-09-01 Thread Bruno Desthuilliers
Hans Müller a écrit : Hello, I'm quite often using this construct: for l in open("file", "r"): do something here, l contains the \n or \r\n on windows at the end. I get rid of it this way: for l in open("file", "r"): while l[-1] in "\r\n": l = l[:-1] I find this a little bit

Re: Command lime code

2008-09-01 Thread Grant Edwards
On 2008-08-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am new to python. OK. > I did find a page which listed some code - IE "chdir" type > code but can not find it again. I have absolutely no clue what you mean. > Can you supply an address? Sure, in fact, I can supply two! http:/

Re: How Compute # of Days between Two Dates?

2008-09-01 Thread Grant Edwards
On 2008-09-01, W. eWatson <[EMAIL PROTECTED]> wrote: > That's the question in Subject. For example, the difference between > 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and > 03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in > years between, say,

Re: logging - how to use in a library?

2008-09-01 Thread Vinay Sajip
On Aug 29, 11:02 pm, Thomas Heller <[EMAIL PROTECTED]> wrote: > > BTW: Let me say that the more I useloggingthe more I like it.loggingis a > fantastic package! > Thank you, I can say the same for ctypes and py2exe :-) Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list

Re: Eleganz way to get rid of \n

2008-09-01 Thread josh logan
On Sep 1, 9:41 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Mon, 01 Sep 2008 15:25:03 +0200, Hans Müller wrote: > > I'm quite often using this construct: > > > for l in open("file", "r"): > >    do something > > Has someone a better solution ? > > The most general would be to use rstrip() wit

Re: SAXReaderNotAvailble: No parsers found

2008-09-01 Thread josh logan
On Aug 30, 8:59 pm, josh logan <[EMAIL PROTECTED]> wrote: > > Vincent Yau <[EMAIL PROTECTED]> writes: > > > I am trying to use Python SAX API to parse XML files.  I do see expat.py > > > somewhere underneath my Python 2.1.1 installation (on Solaris). > > > But I got this error when invoking the xml

Re: Eleganz way to get rid of \n

2008-09-01 Thread Wojtek Walczak
On Mon, 01 Sep 2008 15:25:03 +0200, Hans M�ller wrote: > I'm quite often using this construct: > > for l in open("file", "r"): > do something > Has someone a better solution ? The most general would be to use rstrip() without arguments: >>> a="some string\r\n" >>> a.rstrip() 'some string'

Re: Eleganz way to get rid of \n

2008-09-01 Thread josh logan
On Sep 1, 9:25 am, Hans Müller <[EMAIL PROTECTED]> wrote: > Hello, > > I'm quite often using this construct: > > for l in open("file", "r"): >         do something > > here, l contains the \n or \r\n on windows at the end. > I get rid of it this way: > > for l in open("file", "r"): >         while

Re: How to print first(national) char from unicode string encoded in utf-8?

2008-09-01 Thread Marco Bizzarri
On Mon, Sep 1, 2008 at 3:25 PM, <[EMAIL PROTECTED]> wrote: > > When I do ${urllib.unquote(c.user.firstName)} without encoding to > latin-1 I got different chars than I will get: no Łukasz but Å ukasz > -- > http://mail.python.org/mailman/listinfo/python-list That's crazy. "string".encode('latin1

CSV reader and unique ids

2008-09-01 Thread Mike P
Hi All, I'm trying to use the CSV module to read in some data and then use a hashable method (as there are millions of records) to find unique ids and push these out to another file, can anyone advise? Below is the code so far fin = open(CSV_INPUT, "rb") fout = open(CSV_OUTPUT, "wb") reader = c

Re: How to print first(national) char from unicode string encoded in utf-8?

2008-09-01 Thread sniipe
On 1 Wrz, 15:10, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote: > 2008/9/1 <[EMAIL PROTECTED]>: > > > > > Hi, > > > I have a problem with unicode string in Pylons templates(Mako). I will > > print first char from my string encoded in UTF-8 and urllib.quote(), > > for example string 'Łukasz': > > > ${

Eleganz way to get rid of \n

2008-09-01 Thread Hans Müller
Hello, I'm quite often using this construct: for l in open("file", "r"): do something here, l contains the \n or \r\n on windows at the end. I get rid of it this way: for l in open("file", "r"): while l[-1] in "\r\n": l = l[:-1] I find this a little bit clumsy

Using an existing instance as parent

2008-09-01 Thread André
Hi, I was trying to find a way to set, upon __init__() the parent of a class to an existing instance. Here is a minimal example of what I'm trying to do: class A(object): def __init__(self, x): self.x = x class B(A): def __init__(self, *args): if not isinstance(args[0], A): supe

Multiple window handling

2008-09-01 Thread Anish Chapagain
Hi!! I'm trying to program an application which have multiple windows and is capable of executing method defined inside class of one another, i tries a simpel frame work here and am creating Toplevel inside method as the new window to be genereated, and again want another window to be loaded when t

Re: How to print first(national) char from unicode string encoded in utf-8?

2008-09-01 Thread Marco Bizzarri
2008/9/1 <[EMAIL PROTECTED]>: > Hi, > > I have a problem with unicode string in Pylons templates(Mako). I will > print first char from my string encoded in UTF-8 and urllib.quote(), > for example string 'Łukasz': > > ${urllib.unquote(c.user.firstName).encode('latin-1')[0:1]} > > and I received thi

Re: Python 3.0b2 cannot map '\u12b'

2008-09-01 Thread josh logan
On Sep 1, 8:19 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 01 Sep 2008 02:27:54 -0400, Terry Reedy wrote: > > I doubt the OP 'chose' cp437.  Why does Python using cp437 even when the > > default encoding is utf-8? > > > On WinXP > >  >>> sys.getdefaultencoding() > > 'utf-8' >

How to print first(national) char from unicode string encoded in utf-8?

2008-09-01 Thread sniipe
Hi, I have a problem with unicode string in Pylons templates(Mako). I will print first char from my string encoded in UTF-8 and urllib.quote(), for example string 'Łukasz': ${urllib.unquote(c.user.firstName).encode('latin-1')[0:1]} and I received this information: : 'utf8' codec can't decode by

Re: __stack_chk_fail_local

2008-09-01 Thread gianluca massei
thanks for the help, maybe the solution will be useful: in "various Linux distributions are starting to ship with a version of the GNU C compiler which incorporates an extension which implements protection for stack-smashing". In that case the Makefile has to modified with CFLAGS = -fno-stack

Re: Know if a object member is a method

2008-09-01 Thread Fredrik Lundh
Luca wrote: Yes, this helps a lot. In facts I need to do something like a language parser. a *parser* that works on object structures created by executing a Python program? -- http://mail.python.org/mailman/listinfo/python-list

Re: Know if a object member is a method

2008-09-01 Thread Luca
On Mon, Sep 1, 2008 at 2:18 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > If your aim is to write something like a debugger, profiler, or some > other application that needs to inspect arbitrary objects and work out > what they do, then you probably should be using: > > isinstance(obj.methodNa

click heremore dollar

2008-09-01 Thread raju
http://www.moneymaking4.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

get paid on free offers

2008-09-01 Thread raju
http://www.moneymaking4.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

click here more tips in online about software

2008-09-01 Thread raju
http://www.moneymaking4.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

about computer tips inonline click here

2008-09-01 Thread raju
http://www.moneymaking4.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0b2 cannot map '\u12b'

2008-09-01 Thread Marc 'BlackJack' Rintsch
On Mon, 01 Sep 2008 02:27:54 -0400, Terry Reedy wrote: > I doubt the OP 'chose' cp437. Why does Python using cp437 even when the > default encoding is utf-8? > > On WinXP > >>> sys.getdefaultencoding() > 'utf-8' > >>> s='\u012b' > >>> s > Traceback (most recent call last): >File "", line

Re: Know if a object member is a method

2008-09-01 Thread Steven D'Aprano
On Mon, 01 Sep 2008 11:45:36 +0200, Luca asked about recognizing methods: > What is the best way to do this? The "most pythonic"? That depends on why you are doing it, and what you want to do with the information once you've found it. If you are experimenting in the interactive interpreter, the

Re: Know if a object member is a method

2008-09-01 Thread Tino Wildenhain
Luca wrote: On Mon, Sep 1, 2008 at 11:35 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: ... But not so easy to fool a type check: type(x) == new.function False Of course that's not bullet-proof either. I leave it as an exercise to discover how you might break that piece of code. Ok, so..

Re: Know if a object member is a method

2008-09-01 Thread Marc 'BlackJack' Rintsch
On Mon, 01 Sep 2008 11:45:36 +0200, Luca wrote: >> But not so easy to fool a type check: >> > type(x) == new.function >> False >> >> Of course that's not bullet-proof either. I leave it as an exercise to >> discover how you might break that piece of code. >> >> > Ok, so... > > What is the bes

Re: how to find position of dictionary values

2008-09-01 Thread Bruno Desthuilliers
lee a écrit : On Sep 1, 2:37 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: lee wrote: (snip) i agree with u, my data strusture is not efficient. but all the records,viz...name,phno, email,address are all generated at runtime , when the user enters them. so how can i design my datastructur

  1   2   >