Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Marc 'BlackJack' Rintsch
On Wed, 03 Sep 2008 01:23:47 -0400, Derek Martin wrote: On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: The subprocess module is also supposed to replace os.system and os.spawn*, neither of which involve opening pipes. Uh... it's a replacement for os.popen(), which -- guess what --

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Derek Martin
On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: Derek Martin wrote: On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: but the instances of `Popen` are no actions. There's no way to execute a `Popen` instance. Yes there is... you execute it when you

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: And if they model an action there must be some way to activate the action That's a reasonable assumption, but as I also said, the object might just describe the action -- essentially the equivalent of a struct in C. ``struct``\s in C

Re: Pass same parameter in Recursive function

2008-09-03 Thread Diez B. Roggisch
Davy schrieb: On Sep 3, 11:57 am, Chris Rebert [EMAIL PROTECTED] wrote: Assuming the function is tail-recursive or the unchanging arguments are immutable, just use a closure: [SNIP] Hi Chris, Thank you :) Perhaps I should clarify the problem. 1. the function is NOT tail-recursive 2. Yes, the

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Derek Martin
On Wed, Sep 03, 2008 at 06:40:10AM +, Marc 'BlackJack' Rintsch wrote: On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: And if they model an action there must be some way to activate the action That's a reasonable assumption, but as I also said, the object might just

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Peter Otten
hofer wrote: Something I have to do very often is filtering / transforming line based file contents and storing the result in an array or a dictionary. Very often the functionallity exists already in form of a shell script with sed / awk / grep , . . . and I would like to have the same

Re: eval() == evil? --- How to use it safely?

2008-09-03 Thread mario
On Aug 28, 11:51 pm, Fett [EMAIL PROTECTED] wrote: I am creating a program that requires some data that must be kept up to date. What I plan is to put this data up on a web-site then have the program periodically pull the data off the web-site. My problem is that when I pull the data

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Gabriel Genellina
En Tue, 02 Sep 2008 19:15:07 -0300, Derek Martin [EMAIL PROTECTED] escribió: The Linux man page unfortunately copies (verbatim) the FreeBSD man page, which gets it wrong. You can not open a process, but you can definitely open a pipe. (Ok, if it doesn't agree with you, it must be wrong)

Problems with running Python CGI Scripts

2008-09-03 Thread Edward FISHER
Hey guys. Im having problems running a python cgi. Im using the example code from: http://www.python.org/doc/essays/pp...east/sld041.htm as writen by Van Rossum himself I can get the script to run the python script but all that happens is that the black python box appears then disapears, the

Re: How to write verbose scripts

2008-09-03 Thread Hendrik van Rooyen
Steven D'Aprano stev...bersource.com.au wrote: Is there a better way of doing this than the way I am going about it? Not sure if its better, but I would keep the messages in a table or dict and have different tables or dicts for different levels of verbosity, and write a displayer that knows

Using httplib to access servlets on tomcat server

2008-09-03 Thread jorma kala
Hi, I'm trying unsuccesfully to use the httplib library to execute servlets on a local tomcat server. If I type the following http adress on my browser http://localhost:8080/test/Serv1 the servlet works fine. But if I try to access it with the following python code: conn =

sys.stdin on windows

2008-09-03 Thread [EMAIL PROTECTED]
I often grep particular patterns out of large logfiles and then pipeline the output to sort and uniq -c I thought today to knock up a script to do the counting in a python dict. This seems work in linux $ cat count.py #!/usr/bin/env python import sys from collections import defaultdict

Re: Using httplib to access servlets on tomcat server

2008-09-03 Thread Marco Bizzarri
On Wed, Sep 3, 2008 at 11:06 AM, jorma kala [EMAIL PROTECTED] wrote: Hi, I'm trying unsuccesfully to use the httplib library to execute servlets on a local tomcat server. If I type the following http adress on my browser http://localhost:8080/test/Serv1 the servlet works fine. But if I

Re: pyparsing: match empty line

2008-09-03 Thread Marek Kubica
Hi, First of all a big thank you for your excellent library and of course also for your extensive and enlightening answer! 1) Well done in resetting the default whitespace characters, since you are doing some parsing that is dependent on the presence of line ends. When you do this, it is

installing matplotlib with cygwiin

2008-09-03 Thread Anish Chapagain
Hi!! I need to run matplotlib for one project with pylab and scipy module, i'm using cygwin so as to link system call operation with few GUI support, but am unable to install numpy and scipy without these matplotlib is also not installed Please help me for proper installation of these module in

Serial I/O problem with pywin32 ?

2008-09-03 Thread Xavier
Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly losts chunks of

Re: Problems with running Python CGI Scripts

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 05:29:39 -0300, Edward FISHER [EMAIL PROTECTED] escribi�: I can get the script to run the python script but all that happens is that the black python box appears then disapears, the html that the python scripts should generate is never output. [...] This is calling the

installing matplotlib with numpy and scipy for Python in Cygwin

2008-09-03 Thread chapagainanish
Hi!! I'm having installation problem for installing numpy and scipy in Cygwin for Python, and am obstruct in madway for project, i followed scipy.org guidelines but there's few error thrown as failed..with exit status 1 please if someone has installed these module help me thank's and

Re: python - mechanize/browser/POST issue

2008-09-03 Thread Mohamed Yousef
Hello , i don't know about mechanize but in general all you have to do is a simple socket text sending connect to the server then send it POST headers to page in question.. what to send ? getting this your self is much better and one of the best tools is LiveHTTPHeaders - an addon for firefox -

Re: sys.stdin on windows

2008-09-03 Thread Gabriel Genellina
En Wed, 03 Sep 2008 06:16:03 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribi�: I often grep particular patterns out of large logfiles and then pipeline the output to sort and uniq -c I thought today to knock up a script to do the counting in a python dict. This seems work in linux $ cat

Re: eval() == evil? --- How to use it safely?

2008-09-03 Thread rustom
On Aug 29, 4:42 am, castironpi [EMAIL PROTECTED] wrote: May I suggest PyYAML? I second that. Yaml is very pythonic (being indentation based) and pyyaml is sweet. Only make sure you use safe_load not load and you will have only default construction for standard python objects -- lists,

Re: sys.stdin on windows

2008-09-03 Thread Tim Golden
Gabriel Genellina wrote: En Wed, 03 Sep 2008 06:16:03 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribi�: I often grep particular patterns out of large logfiles and then pipeline the output to sort and uniq -c I thought today to knock up a script to do the counting in a python dict. This

Re: sys.stdin on windows

2008-09-03 Thread [EMAIL PROTECTED]
On Sep 3, 11:16 pm, Tim Golden [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: En Wed, 03 Sep 2008 06:16:03 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribi : I often grep particular patterns out of large logfiles and then pipeline the output to sort and uniq -c I thought today to

Re: Renumbering

2008-09-03 Thread Philipp Pagel
Francesco Pietra [EMAIL PROTECTED] wrote: ATOM 3424 N LEU B 428 143.814 87.271 77.726 1.00115.20 2SG3426 ATOM 3425 CA LEU B 428 142.918 87.524 78.875 1.00115.20 2SG3427 [...] As you can see, the number of lines for a particular value in column 6 changes

Re: python - mechanize/browser/POST issue

2008-09-03 Thread Wojtek Walczak
On Tue, 2 Sep 2008 19:39:05 -0700, bruce wrote: using mechanize/Browser, i can easily do a url/get, and process submitting a form that uses a GET as the action. however, I'm not quite sure how to implement the submittal of a form, that uses the POST action. Anyone have a short chunk of code

Re: How to write verbose scripts

2008-09-03 Thread Bruno Desthuilliers
John Machin a écrit : On Sep 3, 3:52 am, Mensanator [EMAIL PROTECTED] wrote: On Sep 2, 11:55 am, Steven D'Aprano [EMAIL PROTECTED] if (p 1)==1: print_evens = True else: print_evens = False if (p 2)==2: print_odds = True else: print_odds = False if (p 4)==4:

Re: How to write verbose scripts

2008-09-03 Thread Uwe Schmitt
On 2 Sep., 18:55, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I find myself writing command line tools in Python where I wish to include verbose output to stdout. I start with a helper function: def print_(obj, level=0):     if _verbosity = level:         print obj And

Re: installing matplotlib with numpy and scipy for Python in Cygwin

2008-09-03 Thread Uwe Schmitt
On 3 Sep., 11:42, chapagainanish [EMAIL PROTECTED] wrote: Hi!! I'm having installation problem for installing numpy and scipy in Cygwin for Python, and am obstruct in madway for project, i followed scipy.org guidelines but there's few error thrown as         failed..with exit status 1

Re: installing matplotlib with numpy and scipy for Python in Cygwin

2008-09-03 Thread Anish Chapagain
On Sep 3, 12:39 pm, Uwe Schmitt [EMAIL PROTECTED] wrote: On 3 Sep., 11:42, chapagainanish [EMAIL PROTECTED] wrote: Hi!! I'm having installation problem for installing numpy and scipy in Cygwin for Python, and am obstruct in madway for project, i followed scipy.org guidelines but there's

Re: Python IDEs with F5 or hotkey shell interaction

2008-09-03 Thread Marco Bizzarri
On Tue, Sep 2, 2008 at 4:01 PM, mmm [EMAIL PROTECTED] wrote: I might look at Eclypse with pydev Jedit And these commercial/professional IDEs Wing Komodo IDE Zeus But before doing so I wanted to know form experienced users: ** How hard is it to configure any of the general

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Without them it looks better: import sys for line in sys.stdin: try: a, b = map(int, line.split(None, 2)[:2]) except ValueError: pass else: if a + b == 42: print b I'm

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Peter Otten
Roy Smith wrote: In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Without them it looks better: import sys for line in sys.stdin: try: a, b = map(int, line.split(None, 2)[:2]) except ValueError: pass else: if a + b == 42:

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread bearophileHUGS
Roy Smith: No reason to limit how many splits get done if you're explicitly going to slice the first two. You are probably right for this problem, because most lines are 2 items long, but in scripts that have to process lines potentially composed of many parts, setting a max number of parts

new python docs

2008-09-03 Thread Rick Dooling
Wow! I've been away in other pursuits. The new docs are gorgeous and searchable. http://docs.python.org/dev/index.html Thank you, python.org. -- http://mail.python.org/mailman/listinfo/python-list

max(), sum(), next()

2008-09-03 Thread bearophileHUGS
Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: sum(s for s in [a, b] if len(s) 2) 0 In a statically typed language in that situation you may answer the initializer value of the

Re: How to write verbose scripts

2008-09-03 Thread BJörn Lindqvist
2008/9/3 Hendrik van Rooyen [EMAIL PROTECTED]: Steven D'Aprano stev...bersource.com.au wrote: Is there a better way of doing this than the way I am going about it? Not sure if its better, but I would keep the messages in a table or dict and have different tables or dicts for different levels

Custom handler for logging

2008-09-03 Thread Luigi Paioro
Dear all, concerning the logging module, I have written a new Handler which stores the logging messages in an SQLite database. It works well, but when I try to use it exploiting a configuration file I have a problem since the class entry does not accept a class which is not within the logging

Re: pyparsing: match empty line

2008-09-03 Thread Paul McGuire
On Sep 3, 4:26 am, Marek Kubica [EMAIL PROTECTED] wrote: Hi, First of all a big thank you for your excellent library and of course also for your extensive and enlightening answer! I'm glad pyparsing has been of help to you. Pyparsing is building its own momentum these days. I have a new

Re: Custom handler for logging

2008-09-03 Thread Peter Otten
Luigi Paioro wrote: concerning the logging module, I have written a new Handler which stores the logging messages in an SQLite database. It works well, but when I try to use it exploiting a configuration file I have a problem since the class entry does not accept a class which is not within

Re: new python docs

2008-09-03 Thread Colin J. Williams
Rick Dooling wrote: Wow! I've been away in other pursuits. The new docs are gorgeous and searchable. http://docs.python.org/dev/index.html Thank you, python.org. Yes, they look crisp and clear. It would have been nice if the Apple folk, in their clear Style Guide, had provided

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: I might take it one step further, however, and do: fields = line.split()[:2] a, b = map(int, fields) in fact, I might even get rid of the very generic, but conceptually overkill, use of map() and

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Roy Smith: No reason to limit how many splits get done if you're explicitly going to slice the first two. You are probably right for this problem, because most lines are 2 items long, but in scripts that have to process lines

Re: Custom handler for logging

2008-09-03 Thread Luigi Paioro
Thanks, it works perfectly! Luigi Peter Otten ha scritto: Luigi Paioro wrote: concerning the logging module, I have written a new Handler which stores the logging messages in an SQLite database. It works well, but when I try to use it exploiting a configuration file I have a problem since

properties setting each other

2008-09-03 Thread mk
Hello everyone, I try to set two properties, value and square in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: import math class Squared2(object): def

Re: installing matplotlib with numpy and scipy for Python in Cygwin

2008-09-03 Thread Diez B. Roggisch
Anish Chapagain schrieb: On Sep 3, 12:39 pm, Uwe Schmitt [EMAIL PROTECTED] wrote: On 3 Sep., 11:42, chapagainanish [EMAIL PROTECTED] wrote: Hi!! I'm having installation problem for installing numpy and scipy in Cygwin for Python, and am obstruct in madway for project, i followed scipy.org

Re: pyparsing: match empty line

2008-09-03 Thread Marek Kubica
On Wed, 03 Sep 2008 06:12:47 -0700, Paul McGuire wrote: On Sep 3, 4:26 am, Marek Kubica [EMAIL PROTECTED] wrote: I could set the whitespace on every element, but that is as you surely agree quite ugly. Do you accept patches? I'm thinking about some kind of factory-class which would

Re: max(), sum(), next()

2008-09-03 Thread Sion Arrowsmith
[EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 help(sum) sum(...) sum(sequence, start=0) - value sum(range(x) for x in range(5)) Traceback (most recent call last): File stdin, line 1, in module

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-02, Christian Heimes [EMAIL PROTECTED] wrote: Fredrik Lundh wrote: Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion?

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney [EMAIL PROTECTED] wrote: Ben Finney [EMAIL PROTECTED] writes: 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,

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Peter Otten
Roy Smith wrote: In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: I might take it one step further, however, and do: fields = line.split()[:2] a, b = map(int, fields) in fact, I might even get rid of the very generic, but conceptually

Re: properties setting each other

2008-09-03 Thread Wojtek Walczak
On Wed, 03 Sep 2008 15:57:50 +0200, mk wrote: I try to set two properties, value and square in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: Is there a way to achieve this

Re: properties setting each other

2008-09-03 Thread Wojtek Walczak
On Wed, 3 Sep 2008 14:31:17 + (UTC), Wojtek Walczak wrote: class Square(object): def __init__(self, val): self._square = pow(val, 2) self._value = math.sqrt(self.square) ^^ or just: self._value = val :-) -- Regards,

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 15:57:50 mk, vous avez écrit : I try to set two properties, value and square in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop:   import math  

Re: properties setting each other

2008-09-03 Thread Diez B. Roggisch
mk schrieb: Hello everyone, I try to set two properties, value and square in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: import math class Squared2(object): def

Re: properties setting each other

2008-09-03 Thread Bruno Desthuilliers
mk a écrit : Hello everyone, I try to set two properties, value and square in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: import math class Squared2(object): def

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 16:44:10 Maric Michaud, vous avez écrit :          def _setsquare(self, v) :                  # some extra logic here                  self._square = s          def fsetsquare(self,s):                  self._setsquare(s)                  self._setvalue =

Re: Numeric literal syntax

2008-09-03 Thread Grant Edwards
On 2008-09-03, Ben Finney [EMAIL PROTECTED] wrote: Another reason in support of spaces (rather than underscores) to separate digit groups: it's the only separator that follows the SI standard for representing numbers: ??? for numbers with many digits the digits may be divided into

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Xavier
I tried under Linux... same problem. So... it may comes from my little lines of code... or from my GPS. -- http://mail.python.org/mailman/listinfo/python-list

os.system dual behaviour

2008-09-03 Thread iu2
Hi guys I do os.system('ls e') On one linux machine it emits ls output to the file e as expected. On another linux machine it emits ls to the standard output, and nothing to e! Both machines run Fedora linux. The command ls e entered at the shell (no python) behaves ok on both machines.

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Diez B. Roggisch
Xavier schrieb: Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly

Re: Numeric literal syntax

2008-09-03 Thread bearophileHUGS
Ben Finney: … for numbers with many digits the digits may be divided into groups of three by a thin space, in order to facilitate reading. Neither dots nor commas are inserted in the spaces between groups of three.

Re: properties setting each other

2008-09-03 Thread mk
Thanks to everyone for answers.. *but*, if you want to add more logic in the setters, you could want to add two extra methods : def _setsquare(self, v) : # some extra logic here self._square = s def fsetsquare(self,s):

Re: Numeric literal syntax

2008-09-03 Thread Cliff
On Sep 2, 12:34 am, Fredrik Lundh [EMAIL PROTECTED] wrote: 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

Re: properties setting each other

2008-09-03 Thread Maric Michaud
Le Wednesday 03 September 2008 17:40:43 mk, vous avez écrit : Note that if one property can really be computed from another, this kind of thing could be considered as bad design (except if the computation is heavy). Hmm, why? Is the line of thinking smth like: because the variables should

PyGUI as a standard GUI API for Python?

2008-09-03 Thread Michael Palmer
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic APIs: PyGUI and wax. The

Coming from .NET and VB and C

2008-09-03 Thread ToPostMustJoinGroup22
I'm coming from a .NET, VB, C background. C was good, and VB was better (with all of its libraries). Than .NET came along and all the libraries you can require are ready to go. I have no preference with MySQL or SQL, stored procedures or ad-hoc queries. SO, I'm interested in using my Google

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic

Re: Coming from .NET and VB and C

2008-09-03 Thread Simon Brunning
2008/9/3 ToPostMustJoinGroup22 [EMAIL PROTECTED]: Any suggestions for someone new to the scene like me? Welcome! There's a number of resources that you might find useful here: http://wiki.python.org/moin/BeginnersGuide -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Re: Coming from .NET and VB and C

2008-09-03 Thread Eric Wertman
Using Python. I found Dive Into Python which I will be reading shortly The title of the book is good advice all by itself. Especially with prior programming experience, you'll get started very quickly. What will take longer is the assimilation of some of python's neater and more idiomatic

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-03 Thread Marc 'BlackJack' Rintsch
On Wed, 03 Sep 2008 03:09:18 -0400, Derek Martin wrote: On Wed, Sep 03, 2008 at 06:40:10AM +, Marc 'BlackJack' Rintsch wrote: On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: And if they model an action there must be some way to activate the action That's a reasonable

Writing Unicode to database using ODBC

2008-09-03 Thread Mudcat
In short what I'm trying to do is read a document using an xml parser and then upload that data back into a database. I've got the code more or less completed using xml.etree.ElementTree for the parser and dbi/ odbc for my db connection. To fix problems with unicode I built a work-around by

Using strftime

2008-09-03 Thread frankrentef
I have one line of code that put's an old date in my code. ie.textBoxSet('_ct10_PlaceHolder_txtEnd', '8/15/2008') What I wish to do in another similiar line is have the field populated with the current system date? How best to do this? I've read some of the strftime documentation but as of

Help needed to freeze a script.

2008-09-03 Thread LB
Hi, I would like to freeze a numpy based script in order to have an application which could run without having to install numpy and cie. Indeed, I'm not root on the targeted computer and I can't easily make a complete install of numpy and scipy. So I decided to test the freeze.py tool shipped

RE: Using strftime

2008-09-03 Thread Ahmed, Shakir
You can try Import time mytimeymd = time.strftime('%y%m%d') print mytimeymd -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of frankrentef Sent: Wednesday, September 03, 2008 1:21 PM To: python-list@python.org Subject: Using strftime I have one line of

RE: Help on try-except

2008-09-03 Thread Matthew Burns
The reason it takes so long is you are not using xrange The range function iterates through the entire data set EVERY time, regardless of whether it needs to This increases processer use EXPONENTIALLY as that number gets larger. I am not quite sure how xrange works, but it keeps only one number in

Re: Is try-except slow?

2008-09-03 Thread Fredrik Lundh
process wrote: is this faster btw? I guess big doesn't help, it's only retrieved once anyway? But is rows retrieved in every loop? the python interpreter aint too smart? def getPixels(fileName): im = PIL.Image.open(fileName) colors = [] r, c = im.size big = range(0, c)

Looking for File comparison utility that produces actual differences

2008-09-03 Thread dudeja . rajat
Hi, I looking for a file comparison utility in Python that works like 'diff' command in Unix and 'comp' in Windows. The present 'cmd' in filecmp module only presents output in the form of 1 or 0 i.e whether the 2 files differ or not? So, I'm lookin for something that generates actual

Re: Looking for File comparison utility that produces actual differences

2008-09-03 Thread Wojtek Walczak
On Wed, 3 Sep 2008 19:40:40 +0100, [EMAIL PROTECTED] wrote: I looking for a file comparison utility in Python that works like 'diff' command in Unix and 'comp' in Windows. The present 'cmd' in filecmp module only presents output in the form of 1 or 0 i.e whether the 2 files differ or not?

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Michael Palmer
On Sep 3, 12:57 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Michael Palmer schrieb: The other, PyGUI, has an even nicer API and more docs but has relatively few widgets implemented at this time. It also strives for compatibility with several toolkits (two at this time), which I think

Re: Looking for File comparison utility that produces actual differences

2008-09-03 Thread Jeff McNeil
On Sep 3, 2:40 pm, [EMAIL PROTECTED] wrote: Hi, I looking for a file comparison utility in Python that works like 'diff' command in Unix and 'comp' in Windows. The present 'cmd' in filecmp module only presents output in the form of 1 or 0 i.e whether the 2 files differ or not? So, I'm

creating a similar object from an derived class

2008-09-03 Thread Scott
Let's say I have an object: class foo(): def create_another() return foo() def blah(): x = self.create_another() ... do something with X Now I create a inherited class of this object: class bar(foo): ... If I call bar.create_another(), it will return a foo()

Re: max(), sum(), next()

2008-09-03 Thread Laszlo Nagy
[EMAIL PROTECTED] wrote: Empty Python lists [] don't know the type of the items it will contain, so this sounds strange: sum([]) 0 Because that [] may be an empty sequence of someobject: You are right in that sum could be used to sum arbitrary objects. However, in 99.99% of

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: I disagree with that. Meta-wrappers like this will always suffer from problems, as they have difficulties providing a consistent api. For example wx is said to be very windows-toolkit-centric in it's API. Yes I know that it works under Linux with GTK, but it does not come

Re: Help needed to freeze a script.

2008-09-03 Thread Michael Palmer
On Sep 3, 1:30 pm, LB [EMAIL PROTECTED] wrote: Hi, I would like to freeze a numpy based script in order to have an application which could run without having to install numpy and cie. Indeed, I'm not root on the targeted computer and I can't easily make a complete install of numpy and

Re: os.system dual behaviour

2008-09-03 Thread Emile van Sebille
iu2 wrote: Hi guys I do os.system('ls e') On one linux machine it emits ls output to the file e as expected. On another linux machine it emits ls to the standard output, and nothing to e! Both machines run Fedora linux. The command ls e entered at the shell (no python) behaves ok on both

Re: properties setting each other

2008-09-03 Thread Bruno Desthuilliers
Maric Michaud a écrit : Le Wednesday 03 September 2008 17:40:43 mk, vous avez écrit : Note that if one property can really be computed from another, this kind of thing could be considered as bad design (except if the computation is heavy). Hmm, why? Is the line of thinking smth like: because

Re: Is try-except slow?

2008-09-03 Thread Robert Kern
Steven D'Aprano wrote: On Tue, 02 Sep 2008 18:56:48 -0500, Robert Kern wrote: ssecorp wrote: or why does this take so god damn long time? Several reasons. One of which is that try: except: is slow. I beg to differ. Setting up a try...except block is very fast. Here's an example in Python

Re: creating a similar object from an derived class

2008-09-03 Thread Matimus
On Sep 3, 12:09 pm, Scott [EMAIL PROTECTED] wrote: Let's say I have an object: class foo():    def create_another()        return foo()    def blah():        x = self.create_another()        ... do something with X Now I create a inherited class of this object: class bar(foo):    

Re: Coming from .NET and VB and C

2008-09-03 Thread Bruno Desthuilliers
ToPostMustJoinGroup22 a écrit : I'm coming from a .NET, VB, C background. C was good, and VB was better (with all of its libraries). Than .NET came along and all the libraries you can require are ready to go. I have no preference with MySQL or SQL, stored procedures or ad-hoc queries. SO,

Re: creating a similar object from an derived class

2008-09-03 Thread Bruno Desthuilliers
Scott a écrit : Let's say I have an object: s/object/class/ class foo(): def create_another() return foo() class Foo(object): def create_another(self): return Foo() def blah(): def blah(self): x = self.create_another() ... do something with

Re: Usual practice: running/testing modules in a package

2008-09-03 Thread Casey
On Aug 26, 10:21 pm, Casey [EMAIL PROTECTED] wrote: On Aug 12, 9:57 pm, alito [EMAIL PROTECTED] wrote: A wrapper on the level up works: ~/python$ cat importercaller.py from testpackage import config config.hello() ~/python$ python importercaller.py hello So, how do I run these

python/xpath question..

2008-09-03 Thread bruce
morning i apologize up front as this is really more of an xpath question.. in my python, i'm using the xpath function to iterate/parse some html. i can do something like s=d.xpath(//tr/td/text()) count=len(s) and get the number of nodes that have text i can then do something like

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-03 Thread Roy Smith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Roy Smith wrote: In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: I might take it one step further, however, and do: fields = line.split()[:2] a, b = map(int, fields)

Late initialization using __getattribute__

2008-09-03 Thread bukzor
I want to make a MixIn class that waits to initialize its super- classes until an attribute of the object is accessed. Not generally useful, but desirable in my case. I've written this, and it works, but would like to take any suggestions you guys have. I've commented out the delattr call because

Python on the web - newby question

2008-09-03 Thread SimonPalmer
Apologies in advance if this is either a) the wrong board or b) been answered a million times elsewhere, but... I have been given an assignment to get a python module up and running behind an existing web site. At the moment the rest of the site is developed in PHP but the hosts have said they

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread OKB (not okblacke)
Michael Palmer wrote: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. How about Dabo? http://www.dabodev.com/ -- --OKB (not okblacke) Brendan

Re: Late initialization using __getattribute__

2008-09-03 Thread Bruno Desthuilliers
bukzor a écrit : I want to make a MixIn class that waits to initialize its super- classes until an attribute of the object is accessed. Not generally useful, but desirable in my case. I've written this, and it works, but would like to take any suggestions you guys have. You shouldn't mess with

Re: Python on the web - newby question

2008-09-03 Thread Bruno Desthuilliers
SimonPalmer a écrit : Apologies in advance if this is either a) the wrong board or b) been answered a million times elsewhere, but... I have been given an assignment to get a python module up and running behind an existing web site. At the moment the rest of the site is developed in PHP but

Re: [wwwsearch-general] python mechanize/libxml2dom question

2008-09-03 Thread John J Lee
On Mon, 1 Sep 2008, bruce wrote: [...] how can i [...] libxml2dom [...] Just a general point: try lxml.etree instead? Friendlier API. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Late initialization using __getattribute__

2008-09-03 Thread bukzor
On Sep 3, 12:19 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: bukzor a écrit : I want to make a MixIn class that waits to initialize its super- classes until an attribute of the object is accessed. Not generally useful, but desirable in my case. I've written this, and it works, but

  1   2   3   >