Re: Two functionaly identical functions -> different results ??!

2008-11-19 Thread Chris Rebert
On Wed, Nov 19, 2008 at 11:24 PM, Barak, Ron <[EMAIL PROTECTED]> wrote: > Hi Guys, > > I cannot see any difference between read1() and read2() below, and yet, one > is okay, the other give an exception. > > In the first run, read2() is executed, and as expected, the text file is > printed > > $ cat

RE: Why is try...except in my code not working (gzip/text files) ?

2008-11-19 Thread Barak, Ron
Thanks Gabriel, Okay, I get it: I was under the impression that the format check would be done on the open. Bye, Ron. -Original Message- From: Gabriel Genellina [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2008 02:06 To: python-list@python.org Subject: Re: Why is try...except in

DISNEY VISA CARD

2008-11-19 Thread MEGAL
DISNEY VISA CARD http://www.disneyvisacards.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting list of complex numbers

2008-11-19 Thread Terry Reedy
Paul Rubin wrote: Terry Reedy <[EMAIL PROTECTED]> writes: Do your tuple destructuring in the first statement in your body and nothing will break. Why get rid of a useful feature that unclutters code? Because, as has been posted before, it is rarely used, it is replaceable, its presence inte

Two functionaly identical functions -> different results ??!

2008-11-19 Thread Barak, Ron
Hi Guys, I cannot see any difference between read1() and read2() below, and yet, one is okay, the other give an exception. In the first run, read2() is executed, and as expected, the text file is printed $ cat ./gzip_try.py import gzip FILE = "text_file.txt" def read2(): try: fl =

Re: Module Structure/Import Design Problem

2008-11-19 Thread Arnaud Delobelle
Rafe <[EMAIL PROTECTED]> writes: > Hi, > > I am in a situation where I feel I am being forced to abandon a clean > module structure in favor of a large single module. If anyone can save > my sanity here I would be forever grateful. > > My problem is that classes in several modules share a common b

[ANN] logilab-astng 0.17.4

2008-11-19 Thread Sylvain Thénault
Hi there! Back from holidays, I finally took a few hours to fix a few bugs in astng an publish a 0.17.4 release. It fixes some crashes, the "using possibly undefined loop variable" false positive reported by Maarteen and Skip and add some support for python 2.5 relative imports. See the ChangeLog

Re: Using eval, or something like it...

2008-11-19 Thread r0g
John Machin wrote: > On Nov 20, 11:44 am, r0g <[EMAIL PROTECTED]> wrote: >> Hi There, >> >> I know you can use eval to dynamically generate the name of a function >> you may want to call. Can it (or some equivalent method) also be used to >> do the same thing for the variables of a class e.g. >> >>

Re: Programming exercises/challenges

2008-11-19 Thread Arnaud Delobelle
Edwin <[EMAIL PROTECTED]> writes: [...] > a diary manager compatible with my Emacs diary file (sometimes I don't > want to open Emacs for a quick note) You mean that you sometimes don't have emacs open? -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: help with comparison

2008-11-19 Thread Tim Roberts
tekion <[EMAIL PROTECTED]> wrote: > >Could some one take a look at the below code snipet which keep >failing: > >import optparse >p = optparse.OptionParser(description="script to do stuff", >prog="myscript.py", ) >p.add_option("-c" "--compress", help="0 is noncompress") >function1(options.compr

Re: Getting fractional part from a float without using string operations

2008-11-19 Thread Chris Rebert
On Wed, Nov 19, 2008 at 10:01 PM, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Yes it works for most of the cases. But it doesn't for the following case: > str(abs(int(1234567.89)-1234567.89)) > '0.88999898' Since you really care about significant figures here, have you considered us

Re: Multiple equates

2008-11-19 Thread Tim Roberts
jzakiya <[EMAIL PROTECTED]> wrote: > >I looked online and in books, but couldn't find a definitive answer to >this. > >I have an array and set multiple elements to either True or False at >one time. > >Question: Which way is faster (or does it matter)? Answer: it does not matter. This is prematur

Re: Moving file on remote server: How?

2008-11-19 Thread MarkusJ_NZ
On Nov 20, 3:54 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 20, 3:40 pm, MarkusJ_NZ <[EMAIL PROTECTED]> wrote: > > > Can someone please tell me if / how I can move a file between folders > > on a remote server via FTP using Python. > > I'm assuming you're using ftplib? > > Try ftp.rename() (alth

Re: Getting fractional part from a float without using string operations

2008-11-19 Thread srinivasan srinivas
Yes it works for most of the cases.  But it doesn't for the following case: >>> str(abs(int(1234567.89)-1234567.89)) '0.88999898' Thanks, Srini - Original Message From: Tino Wildenhain <[EMAIL PROTECTED]> To: srinivasan srinivas <[EMAIL PROTECTED]> Cc: Jeremiah Dodds <[EMAIL PROTEC

Re: Moving file on remote server: How?

2008-11-19 Thread alex23
On Nov 20, 3:40 pm, MarkusJ_NZ <[EMAIL PROTECTED]> wrote: > Can someone please tell me if / how I can move a file between folders > on a remote server via FTP using Python. I'm assuming you're using ftplib? Try ftp.rename() (although I'm not in a position to test this...) -- http://mail.python.or

Moving file on remote server: How?

2008-11-19 Thread MarkusJ_NZ
Hi, I am using python to FTP into a remote server and copy a file to a local machine. After I have downloaded the file I would like to move the file on the remote server to an archive directory. Can someone please tell me if / how I can move a file between folders on a remote server via FTP using

Re: Finding the instance reference of an object

2008-11-19 Thread Douglas Alan
Joe Strout <[EMAIL PROTECTED]> writes: >> Q. What type of calling semantics do Python and Java use? >> >> A. Call-by-sharing. > > Fair enough, but if the questioner then says "WTF is call-by-sharing," > we should answer "call-by-sharing is the term we prefer for call-by- > value in the case wh

Re: Exception difference 2.4 ==> 2.5

2008-11-19 Thread Ross Ridge
D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >I managed to move everything into one test file and switched to the >SimpleXMLRPCServer module but to no avail. The new code is at >ftp://ftp.druid.net/pub/distrib/test_2.5 It seems be this issue: http://bugs.python.org/issue1739842 Your hand

Re: help with comparison

2008-11-19 Thread George Sakkis
On Nov 19, 10:21 pm, tekion <[EMAIL PROTECTED]> wrote: > Hi, > Could some one take a look at the below code snipet which keep > failing: > > import optparse > p = optparse.OptionParser(description="script to do stuff", > prog="myscript.py", ) > p.add_option("-c" "--compress", help="0 is noncomp

Re: help with comparison

2008-11-19 Thread John Machin
On Nov 20, 2:21 pm, tekion <[EMAIL PROTECTED]> wrote: > Hi, > Could some one take a look at the below code snipet which keep > failing: > > import optparse > p = optparse.OptionParser(description="script to do stuff", > prog="myscript.py", ) > p.add_option("-c" "--compress", help="0 is noncompr

Module Structure/Import Design Problem

2008-11-19 Thread Rafe
Hi, I am in a situation where I feel I am being forced to abandon a clean module structure in favor of a large single module. If anyone can save my sanity here I would be forever grateful. My problem is that classes in several modules share a common base class which needs to implement a factory m

[ANN]: circuits-1.0a2 released!

2008-11-19 Thread James Mills
Hi all, I'm pleased to announce the release of circuits-1.0a2 Overview == circuits is an event-driven framework with a focus on Component Software Architectures where System Functionality is defined in Components. Components communicate with one another by propagating events throughout the s

help with comparison

2008-11-19 Thread tekion
Hi, Could some one take a look at the below code snipet which keep failing: import optparse p = optparse.OptionParser(description="script to do stuff", prog="myscript.py", ) p.add_option("-c" "--compress", help="0 is noncompress") function1(options.compress) here's what the what function defi

Re: Quick nested loop syntax?

2008-11-19 Thread alex23
On Nov 20, 3:48 am, Johannes Bauer <[EMAIL PROTECTED]> wrote: > a = { "a", "b", "c" } > b = { 4, 9, 13} > for (x, y) in someoperator(a, b): >         print(x, y) > > which would print all tuples of > "a", 4 > "a", 9 > "a", 13 > "b", 4 > "b", 9 > "b", 13 > "c", 4 > "c", 9 > "c", 13 If you're using

Re: Exception difference 2.4 ==> 2.5

2008-11-19 Thread D'Arcy J.M. Cain
On Wed, 19 Nov 2008 17:08:13 -0500 Terry Reedy <[EMAIL PROTECTED]> wrote: > > am running Python 2.5.2. I was able to reduce the program to a > > reasonably small version that exhibits the problem. It is in two files > > in ftp://ftp.druid.net/pub/distrib/Test_2.5.tgz including Fredrik > > Lundh's

Re: sorting list of complex numbers

2008-11-19 Thread Paul Rubin
Terry Reedy <[EMAIL PROTECTED]> writes: > >> Do your tuple destructuring in the first statement in your body and > >> nothing will break. Why get rid of a useful feature that unclutters code? > > Unless you were using a lambda, which is quite useful as argument to > > "sort". > > So write a sepa

Re: Using eval, or something like it...

2008-11-19 Thread r0g
George Sakkis wrote: > On Nov 19, 7:44 pm, r0g <[EMAIL PROTECTED]> wrote: >> Hi There, >> >> I know you can use eval to dynamically generate the name of a function >> you may want to call. Can it (or some equivalent method) also be used to >> do the same thing for the variables of a class e.g. >> >

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-19 Thread Jeremiah Dodds
On Wed, Nov 19, 2008 at 8:58 PM, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 20, 10:14 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > If you had a menu in a browser interface that had the items, say, > > 'Stop' and 'Reload', what would you expect to happen if you clicked on > > them? > > If you had

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-19 Thread alex23
On Nov 20, 10:14 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > If you had a menu in a browser interface that had the items, say, > 'Stop' and 'Reload', what would you expect to happen if you clicked on > them? If you had a keyword called 'def', which defined functions, would you expect it to define

Re: Programming exercises/challenges

2008-11-19 Thread Edwin
On Nov 18, 6:39 pm, [EMAIL PROTECTED] wrote: > Hi guys, > > I'm learning Python by teaching myself, and after going through several > tutorials I feel like I've learned the basics. Since I'm not taking a > class or anything, I've been doing challenges/programs to reinforce the > material and improv

Re: Using eval, or something like it...

2008-11-19 Thread John Machin
On Nov 20, 11:44 am, r0g <[EMAIL PROTECTED]> wrote: > Hi There, > > I know you can use eval to dynamically generate the name of a function > you may want to call. Can it (or some equivalent method) also be used to > do the same thing for the variables of a class e.g. > > class Foo(): >   bar = 1 >

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread greg
Antoon Pardon wrote: You are changing your argument. In a follow up you made the point that call by value should be as it was intended by the writers of the algol 60 report. No, I was countering the argument that "call by value" is short for "call by copying the value". I was pointing out that

Re: Using eval, or something like it...

2008-11-19 Thread George Sakkis
On Nov 19, 7:44 pm, r0g <[EMAIL PROTECTED]> wrote: > Hi There, > > I know you can use eval to dynamically generate the name of a function > you may want to call. Can it (or some equivalent method) also be used to > do the same thing for the variables of a class e.g. > > class Foo(): >   bar = 1 >  

Python / Debian package dependencies

2008-11-19 Thread Steven Samuel Cole
Hi all, I am trying to build a debian package for my python modules using stdeb and dpkg-buildpackage. The package building itself works, I also managed to have an entry point created and I can use my python modules on the Ubuntu virtual machine I use to test the package. The problem is that my m

Re: Using eval, or something like it...

2008-11-19 Thread James Mills
DON'T USE eval! On Thu, Nov 20, 2008 at 10:44 AM, r0g <[EMAIL PROTECTED]> wrote: > Hi There, > > I know you can use eval to dynamically generate the name of a function > you may want to call. Can it (or some equivalent method) also be used to > do the same thing for the variables of a class e.g. >

Using eval, or something like it...

2008-11-19 Thread r0g
Hi There, I know you can use eval to dynamically generate the name of a function you may want to call. Can it (or some equivalent method) also be used to do the same thing for the variables of a class e.g. class Foo(): bar = 1 gum = 2 mylist = ['bar','gum'] a = Foo() for each in mylist: a

Re: Finding the instance reference of an object

2008-11-19 Thread Aaron Brady
On Nov 19, 12:28 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 19, 2008, at 11:05 AM, Douglas Alan wrote: > > (2) It is also unarguably true that saying that Python or Java use > >    "call-by-value", and saying nothing more is going to be profoundly > >    confusing to anyone who is learning

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-19 Thread Aaron Brady
On Nov 19, 12:05 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > >         I wouldn't expect a language like Ada to somehow re-evaluate a > default argument on each call; why would I expect Python to do such? Lots of people do. If you had a menu in a browser interface that had the items, say,

Re: Why is try...except in my code not working (gzip/text files) ?

2008-11-19 Thread Gabriel Genellina
En Wed, 19 Nov 2008 13:25:03 -0200, Barak, Ron <[EMAIL PROTECTED]> escribió: I need to read a file that is either a gzip or a text file (on both *nix and Windows). Since I didn't find a way to determine a file type, I thought of using the following: import gzip FILE = "../dpm/save_state-

Re: how to acces the block inside of a context manager as sourcecode

2008-11-19 Thread Aaron Brady
See below. On Nov 19, 8:02 am, Daniel <[EMAIL PROTECTED]> wrote: > Hi Aaron, > > let me give you the reason for the context manager: > I am driving handware with a python script, basically a data acquisition > program which looks like this: > > with dataStore('measurement1.dat') as d: >         ma

Re: Problem with writing a long line in a text file

2008-11-19 Thread John Machin
On Nov 20, 9:31 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 19, 2008, at 3:27 PM, Mohsen Akbari wrote: > > > I'm a newbie in python and I have this problem with the code that   > > I'm writing. There is a very long line which I wish to output it to   > > a text file.But when I do this, in th

Re: Python image library issue: domain users cannot save files?

2008-11-19 Thread Gabriel Genellina
En Wed, 19 Nov 2008 13:43:07 -0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: Has anyone try to use PIL in a windows domain environment? I am having a permission issue. If I am a domain user, even I have the permission to write a folder, when I tried to do simple things like Image.open (

Re: Building musical chords starting from (a lot of) rules

2008-11-19 Thread Mr . SpOOn
I think I've found a nice way to represent and build chords. At least, at the moment it satisfy me, maybe later I'll understand how it sucks. I'm using two separate classes: one represent a chord and is implemented as a set of Notes; the other represents the structure (type) of the chord and is a

Re: Problem with writing a long line in a text file

2008-11-19 Thread Joe Strout
On Nov 19, 2008, at 3:27 PM, Mohsen Akbari wrote: I'm a newbie in python and I have this problem with the code that I'm writing. There is a very long line which I wish to output it to a text file.But when I do this, in the output file, the result appears in two lines. Appears that way whe

Problem with writing a long line in a text file

2008-11-19 Thread Mohsen Akbari
Dear guys, I'm a newbie in python and I have this problem with the code that I'm writing. There is a very long line which I wish to output it to a text file.But when I do this, in the output file, the result appears in two lines. I thought maybe that's because the maximum possible length of the te

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Terry Reedy
Jerry Hill wrote: On Wed, Nov 19, 2008 at 4:12 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: Then why is there a link on the download site? Where specifically did you spot that link? I can't see any. I believe the link in question is on the page http://www.python.org/download/ titled "Pyth

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Nov 18, 10:22 am, Steve Holden <[EMAIL PROTECTED]> wrote > in thread "Python-URL! weekly Python news and links (Nov 17)": >> [EMAIL PROTECTED] wrote: >> [...] >>> One of the reasons I would like to formulate a good >>> model of an object's value and type is so that I c

Re: Designing superclasses so inherited methods return objects with same type as the instance.

2008-11-19 Thread Arnaud Delobelle
"Felix T." <[EMAIL PROTECTED]> writes: > I have a class called Interval(type.ObjectType) that is supposed to > mimic closed mathematical intervals. Right now, it has a lot of > methods like this: > > def __add__(self,other): > if type(other) in Numerical: > return Interval(

Re: Exception difference 2.4 ==> 2.5

2008-11-19 Thread Terry Reedy
D'Arcy J.M. Cain wrote: If true I hope that a new version is forthcoming on the 2.5 branch. Yes, couple of weeks. I am running Python 2.5.2. I was able to reduce the program to a reasonably small version that exhibits the problem. It is in two files in ftp://ftp.druid.net/pub/distrib/Test_

F2PY: Access Fortran module data from multiple python module

2008-11-19 Thread Yann Vonder
Hi all, Here is a description of what I am trying to implement using F2PY: I have created two python extension modules using F2PY. The first extension module (say fsubr1.so) contains a Fortran module (say "tmod") and a subroutine (say "subr1") that modifies the data contained in "tmod". The second

Re: calling python scripts as a sub-process

2008-11-19 Thread Catherine Moroney
Dan Upton wrote: On Wed, Nov 19, 2008 at 2:38 PM, Catherine Moroney <[EMAIL PROTECTED]> wrote: Dan Upton wrote: On Wed, Nov 19, 2008 at 2:13 PM, Philip Semanchuk <[EMAIL PROTECTED]> wrote: On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: The command (stored as an array of strings) that

Designing superclasses so inherited methods return objects with same type as the instance.

2008-11-19 Thread Felix T.
I have a class called Interval(type.ObjectType) that is supposed to mimic closed mathematical intervals. Right now, it has a lot of methods like this: def __add__(self,other): if type(other) in Numerical: return Interval(self.lower_bound+other, self.upper_bound +other)

Re: calling python scripts as a sub-process

2008-11-19 Thread Jeremy Sanders
Dan Upton wrote: > I think when I came across this error, I added shell=True, e.g. > > sub1 = subprocess.Popen(command, shell=True) That's really papering over the bug. You need to have the parameters separately, including the name of the program, separately in the list. You need to remove any s

Re: calling python scripts as a sub-process

2008-11-19 Thread Jeremy Sanders
Catherine Moroney wrote: > I have one script (Match1) that calls a Fortran executable as a > sub-process, and I want to write another script (Match4) that > spawns off several instances of Match1 in parallel and then waits > until they all finish running. The only way I can think of doing this >

Re: Getting fractional part from a float without using string operations

2008-11-19 Thread John Machin
On Nov 20, 3:38 am, "Blind Anagram" <[EMAIL PROTECTED]> wrote: > "MRAB" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > On Nov 19, 1:44 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > On Nov 20, 12:35 am, srinivasan srinivas <[EMAIL PROTECTED]> > > wrote: > > > > > | >>> import

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Martin v. Löwis
> Copied from the download page: It would have helped if you had provided the URL instead. I didn't recognize that you were talking about http://www.python.org/download/ as I rarely ever view this page. On http://www.python.org/download/releases/2.6/ no such link is included. I have now dele

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Jerry Hill
On Wed, Nov 19, 2008 at 4:12 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> Then why is there a link on the download site? > > Where specifically did you spot that link? I can't see any. I believe the link in question is on the page http://www.python.org/download/ titled "Python 2.6 Windows I

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Benjamin Kaplan
On Wed, Nov 19, 2008 at 4:12 PM, "Martin v. Löwis" <[EMAIL PROTECTED]>wrote: > > Then why is there a link on the download site? > > Where specifically did you spot that link? I can't see any. > Copied from the download page: - Python 2.6 compressed source tarball

Re: wxPython Crashes with basic example

2008-11-19 Thread Benjamin Kaplan
I looked up the error code- c005 is Microsoft's cryptic way of telling you that you had a seg fault. You might want to ask this on the wxPython mailing list (http://www.wxpython.org/maillist.php) since I'm pretty sure it's an issue with wx. On Wed, Nov 19, 2008 at 3:04 PM, Samuel Morhaim <[EMAI

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread Martin v. Löwis
> Then why is there a link on the download site? Where specifically did you spot that link? I can't see any. > You are saying that > for python 2.6 forward, there is no plan to support a stock python for > IA64? Is there any particular reason why this is so? Yes. It's too much effort to build,

Re: Finding the instance reference of an object

2008-11-19 Thread Craig Allen
I've just come to the conclusion it's not possible to call functions in python, to do so is undefined and indeterminate, like dividing by zero. Henceforth no calling functions for me as clearly it's the devil's playground. -- http://mail.python.org/mailman/listinfo/python-list

Eric IDE Autocomplete

2008-11-19 Thread Samuel Morhaim
If anyone is familiar with this editor, can you tell me how to enable autocomplete and tooltips, IDLE-style?I add the API thing, and everything but it display a lot of methods that dont make sense in the context.. for example if i do import sys sys. <-- Ctrl Space.. I get a list of about 10

Re: Exception difference 2.4 ==> 2.5

2008-11-19 Thread D'Arcy J.M. Cain
On Wed, 19 Nov 2008 11:20:48 -0800 "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Wed, Nov 19, 2008 at 8:24 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > > Interesting. I installed 2.6 and tried it. My unit test still failed > > but for a different reason that I will have to investigate but t

Re: 404 not found on for Python 2.6 Itanium

2008-11-19 Thread nadiasvertex
Then why is there a link on the download site? You are saying that for python 2.6 forward, there is no plan to support a stock python for IA64? Is there any particular reason why this is so? -={C}=- Christian Heimes wrote: > [EMAIL PROTECTED] wrote: > > Anyone know where else I can download 2.6

Re: Will MySQLdb, the Python shim, be supported for Python 2.6 or 3.x?

2008-11-19 Thread John Nagle
Alia Khouri wrote: John Nagle wrote: Whoever did the port somehow created a dependency on the Intel math library, "libguide40.dll" and "libmmd.dll". That shouldn't be needed in the MySQL Python shim. It's not freely distributable, either; you have to buy the Intel C++ compiler to get it.

Re: calling python scripts as a sub-process

2008-11-19 Thread Dan Upton
On Wed, Nov 19, 2008 at 2:38 PM, Catherine Moroney <[EMAIL PROTECTED]> wrote: > Dan Upton wrote: >> >> On Wed, Nov 19, 2008 at 2:13 PM, Philip Semanchuk <[EMAIL PROTECTED]> >> wrote: >>> >>> On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: >>> The command (stored as an array of strings) t

Re: spam update

2008-11-19 Thread Grant Edwards
On 2008-11-19, Shawn Milochik <[EMAIL PROTECTED]> wrote: > At the time there was a lot of chatter on the list about > people "plonking" posts from Google Groups. That's "a" > solution, if that's where the spam comes from, but it > penalizes the legitimate users who don't subscribe to the > mailing

Re: calling python scripts as a sub-process

2008-11-19 Thread Catherine Moroney
Dan Upton wrote: On Wed, Nov 19, 2008 at 2:13 PM, Philip Semanchuk <[EMAIL PROTECTED]> wrote: On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: The command (stored as an array of strings) that I'm executing is: ['python ../src_python/Match1.py ', '--file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228

Re: calling python scripts as a sub-process

2008-11-19 Thread Catherine Moroney
I just tried that, and I get the same error. Interestingly enough, a shorter (and incorrect) version of the command works well enough so that it gets into the Match1 code and does the argument check there. The following code gets into Match1: >>> command = ['python', '../src_python/Match1.py','

Re: spam update

2008-11-19 Thread Shawn Milochik
On Tue, Nov 18, 2008 at 11:23 AM, <[EMAIL PROTECTED]> wrote: > With some help from the python.org postmasters over the weekend I figured > out why some seemingly obvious spam messages seem to be making it to the > python-list@python.org mailing list. Messages gatewayed from Usenet don't > pass th

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-19 Thread George Sakkis
On Nov 19, 1:05 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 19 Nov 2008 05:41:57 -0800 (PST), Rick Giuly > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > > > (By "better" I mean that over many years of time programmers will be > > more productive because the

Re: Exception difference 2.4 ==> 2.5

2008-11-19 Thread Chris Rebert
On Wed, Nov 19, 2008 at 8:24 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: > On Tue, 18 Nov 2008 22:33:35 -0800 > "Chris Rebert" <[EMAIL PROTECTED]> wrote: >> What happens under Python 2.6? > > Interesting. I installed 2.6 and tried it. My unit test still failed > but for a different reason tha

Re: calling python scripts as a sub-process

2008-11-19 Thread Mike Driscoll
On Nov 19, 1:03 pm, Catherine Moroney <[EMAIL PROTECTED]> wrote: > I have one script (Match1) that calls a Fortran executable as a > sub-process, and I want to write another script (Match4) that > spawns off several instances of Match1 in parallel and then waits > until they all finish running.  Th

Re: calling python scripts as a sub-process

2008-11-19 Thread Dan Upton
On Wed, Nov 19, 2008 at 2:13 PM, Philip Semanchuk <[EMAIL PROTECTED]> wrote: > > On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: > >> The command (stored as an array of strings) that I'm executing is: >> >> ['python ../src_python/Match1.py ', >> '--file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003

Re: calling python scripts as a sub-process

2008-11-19 Thread Philip Semanchuk
On Nov 19, 2008, at 2:03 PM, Catherine Moroney wrote: The command (stored as an array of strings) that I'm executing is: ['python ../src_python/Match1.py ', '-- file_ref=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_BF_F03_0024.hdf ', '--file_cmp=MISR_AM1_GRP_ELLIPSOID_GM_P228_O003571_DF_F03_0024.

Re: Programming exercises/challenges

2008-11-19 Thread Stef Mientki
hi Ben, [EMAIL PROTECTED] wrote: Hi guys, I'm learning Python by teaching myself, and after going through several tutorials I feel like I've learned the basics. Since I'm not taking a class or anything, I've been doing challenges/programs to reinforce the material and improve my skills. I st

calling python scripts as a sub-process

2008-11-19 Thread Catherine Moroney
I have one script (Match1) that calls a Fortran executable as a sub-process, and I want to write another script (Match4) that spawns off several instances of Match1 in parallel and then waits until they all finish running. The only way I can think of doing this is to call it as a sub-process, ra

Re: Avoiding local variable declarations?

2008-11-19 Thread Arnaud Delobelle
greg <[EMAIL PROTECTED]> writes: > Arnaud Delobelle wrote: > >> Neutral element is correct. But maybe its use is limited to >> mathematicians in the english-speaking word. > > I've only ever seen "identity element" in English mathematics. > "Neutral element" sounds like something my car's gearbox

GzipFile as a Context manager

2008-11-19 Thread Mikolai Fajer
Is there a reason that the gzip.GzipFile class does not have __enter__ and __exit__ methods that mimic those of the file object? I expected the following to work but it doesn't: import gzip with gzip.open('temp.gz', 'w') as fhandle: gzip.write('Hello world.') If there is no reason to avoid t

Re: wxPython Crashes with basic example

2008-11-19 Thread Benjamin Kaplan
On Wed, Nov 19, 2008 at 12:51 PM, Samuel Morhaim <[EMAIL PROTECTED]>wrote: > Hi, I am trying to run the basic wxpython example as seen here > http://www.zetcode.com/wxpython/firststeps/ and everytime i run it, it > crashes python/wxpython .. meaning it doesnt close gracefully. > The error I get is

Re: wxPython BoxSizer

2008-11-19 Thread Mike Driscoll
On Nov 19, 12:22 pm, Jamie McQuay <[EMAIL PROTECTED]> wrote: > > > FYI: There's a great wxPython mailing list too. Check it out > > > here:http://wxpython.org/maillist.php > > > thanks, i will take a look. > > Here is the answer i got from the mailing list (and it works) > > Try adding a spacer on

Re: Quick nested loop syntax?

2008-11-19 Thread Vlastimil Brom
2008/11/19 Johannes Bauer <[EMAIL PROTECTED]> > Hi group, > > if I remember correctly, wasn't there a way to quickly iterate through > nested loops? Something like > > a = { "a", "b", "c" } > b = { 4, 9, 13} > for (x, y) in someoperator(a, b): >print(x, y) > > which would print all tuples

Re: Finding the instance reference of an object

2008-11-19 Thread Joe Strout
On Nov 19, 2008, at 11:05 AM, Douglas Alan wrote: Personally, I find this whole debate kind of silly, as it is based on a completely fallacious either/or dichotomy. (1) It is unarguably true that Python and Java use a type of call-by-value. This follows from the standard definition of ca

Re: wxPython BoxSizer

2008-11-19 Thread Jamie McQuay
> > > FYI: There's a great wxPython mailing list too. Check it out > > here:http://wxpython.org/maillist.php > > thanks, i will take a look. Here is the answer i got from the mailing list (and it works) Try adding a spacer on both sides of text. i.e) box.AddStretchSpacer() box.Add(myText, 0, w

Re: Quick nested loop syntax?

2008-11-19 Thread Terry Reedy
Johannes Bauer wrote: Hi group, if I remember correctly, wasn't there a way to quickly iterate through nested loops? Something like a = { "a", "b", "c" } b = { 4, 9, 13} for (x, y) in someoperator(a, b): print(x, y) from itertools import product a = { "a", "b", "c" } b = { 4, 9, 13} f

Re: Finding the instance reference of an object

2008-11-19 Thread Douglas Alan
greg <[EMAIL PROTECTED]> writes: > Steven D'Aprano wrote: >> At least some sections of the Java community seem to prefer a >> misleading and confusing use of the word "value" over clarity and >> simplicity, but I for one do not agree with them. > I don't see anything inherently confusing or misl

Re: Quick nested loop syntax?

2008-11-19 Thread Mark Dickinson
On Nov 19, 5:48 pm, Johannes Bauer <[EMAIL PROTECTED]> wrote: > Hi group, > > if I remember correctly, wasn't there a way to quickly iterate through > nested loops? Something like Python 2.6 has itertools.product: http://docs.python.org/library/itertools.html#itertools.product If you don't have

wxPython Crashes with basic example

2008-11-19 Thread Samuel Morhaim
Hi, I am trying to run the basic wxpython example as seen here http://www.zetcode.com/wxpython/firststeps/ and everytime i run it, it crashes python/wxpython .. meaning it doesnt close gracefully. The error I get is Problem signature: Problem Event Name: APPCRASH Application Name: pythonw.exe

Re: Possible bug in Tkinter for Python 2.6

2008-11-19 Thread Terry Reedy
Anton Vredegoor wrote: On Wed, 19 Nov 2008 10:57:53 +0100 "Eric Brunel" <[EMAIL PROTECTED]> wrote: I'm trying out Python 2.6 and I found what might be a bug in the Tkinter module. How can I report it? maybe here: http://bugs.python.org/issue3774 The fix will be in 2.6.1, which might be in D

Quick nested loop syntax?

2008-11-19 Thread Johannes Bauer
Hi group, if I remember correctly, wasn't there a way to quickly iterate through nested loops? Something like a = { "a", "b", "c" } b = { 4, 9, 13} for (x, y) in someoperator(a, b): print(x, y) which would print all tuples of "a", 4 "a", 9 "a", 13 "b", 4 "b", 9 "b", 13 "c", 4 "c", 9 "c",

Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Mark Dickinson
On Nov 19, 4:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Yep; looks like a bug in the set/frozenset implementation. Thanks! I was about to report this to bugs.python.org, but it looks as though Raymond's been at the time machine again: http://bugs.python.org/issue1721812 It's fixed

Re: python vs smalltalk 80

2008-11-19 Thread George Sakkis
On Nov 19, 1:53 am, gavino <[EMAIL PROTECTED]> wrote: > python vs smalltalk 80 > > which is nicer? Dunno but there's an interesting talk about this: http://www.youtube.com/watch?v=oHg5SJYRHA0 -- http://mail.python.org/mailman/listinfo/python-list

Re: XML -> Tab-delimited text file (using lxml)

2008-11-19 Thread Gibson
On Nov 19, 11:03 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > Use iterparse() instead of parsing the file into memory completely. > > *stuff* > > Stefan That worked wonders. Thanks a lot, Stefan. So, iterparse() uses an iterate -> parse method instead of parse() and iter()'s parse -> iterate

Re: wxPython BoxSizer

2008-11-19 Thread Jamie McQuay
> > Try the style=wx.CENTER like this: > > box.Add(myText,0,wx.CENTER) tried but i still get the same result. The text is either at the top of the panel (centered) or in the middle (on the left side). If i manually call CenterOnParent when the panel is resized it goes to the center but i want t

python template: may help at starting a new script

2008-11-19 Thread Stephane Bulot
Hello, I've created a python script template that I've been using for a while, but that I improved recently. This script is a class that you can inherit into your main class. In the source package, you have a main template, a thread template, and two example files. If you are interested in this p

Re: PEP 324 error

2008-11-19 Thread Terry Reedy
Andrew wrote: It appears PEP 324 is missing the part about check_call(): http://www.python.org/dev/peps/pep-0324/ ... ... In the docstring of subprocess in python 2.5: ... I don't know if check_call is going to be deprecated, but there still appears to be a missing function. I'm not sure i

Re: Programming exercises/challenges

2008-11-19 Thread Mr . SpOOn
On Wed, Nov 19, 2008 at 3:41 PM, Philip Semanchuk <[EMAIL PROTECTED]> wrote: > I'm not sure why you'd need to host the Python code anywhere other than your > home computer. If you wanted to pull thousands of pages from a site like > that, you'd need to respect their robots.txt file. Don't forget to

Re: wxPython BoxSizer

2008-11-19 Thread Mike Driscoll
Hi Jamie, On Nov 19, 9:16 am, Jamie McQuay <[EMAIL PROTECTED]> wrote: > Simple question, i just can't make it work. > > I need to center a StaticText component in its parent (Panel).  I want > to do this with BoxSizer(s). > > if i use: > box = wx.BoxSizer(wx.VERTICAL)   #or wx.HORIZONTAL > box.Add

Re: sorting list of complex numbers

2008-11-19 Thread Hrvoje Niksic
Terry Reedy <[EMAIL PROTECTED]> writes: > Hrvoje Niksic wrote: >> Terry Reedy <[EMAIL PROTECTED]> writes: >> >>> Do your tuple destructuring in the first statement in your body and >>> nothing will break. >> >> Unless you were using a lambda, which is quite useful as argument to >> "sort". > > So

Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Terry Reedy
srinivasan srinivas wrote: Hi, I am getting an error while executing the following snippet. If i comment out method __repr__ , it works fine. class fs(frozenset): def __new__(cls, *data): data = sorted(data) self = frozenset.__new__(cls, data) self.__data = data

  1   2   >