Re: Usage of main()

2009-09-04 Thread alex23
Sean DiZazzo wrote: > What are you using to test the scripts?  I could be completely wrong, > but I find it hard to believe that the second version is much (if any) > faster than the first.  Then again, I don't know much about the > internals... Sorry, Sean, unfortunately you are wrong, although

Re: Usage of main()

2009-09-04 Thread Sean DiZazzo
On Sep 3, 11:55 pm, alex23 wrote: > Sean DiZazzo wrote: > > What are you using to test the scripts?  I could be completely wrong, > > but I find it hard to believe that the second version is much (if any) > > faster than the first.  Then again, I don't know much about the > > internals... > > Sor

Re: Usage of main()

2009-09-04 Thread Manuel Graune
Sean DiZazzo writes: > I'm trying to come up with an answer for you, but I can't... > > The if __name__ == "__main__": idiom *is* the standard way to write > python programs, but it's not there to speed up programs. It's there > so that your program can be executed differently whether it is call

Re: match braces?

2009-09-04 Thread lallous
Hello, Thank you all for your replies. A simple suggestion as Chris' actually might help. I am used to two spaces indentation since years, and apparently two spaces won't make it clear if no visuals were present (braces, or begin/end, ...) Though it is not comfortable to change a style, I will

Re: The future of Python immutability

2009-09-04 Thread r
"""The future of Python immutability""" Define future: The future is a time period commonly understood to contain all events that have yet to occur. It is the opposite of the past, and is the time after the present Define immutability: Not subject or susceptible to change. In object-oriented

Re: Usage of main()

2009-09-04 Thread Carl Banks
On Sep 3, 11:55 pm, alex23 wrote: > Sean DiZazzo wrote: > > What are you using to test the scripts?  I could be completely wrong, > > but I find it hard to believe that the second version is much (if any) > > faster than the first.  Then again, I don't know much about the > > internals... > > Sor

Re: possible attribute-oriented class

2009-09-04 Thread Peter Otten
Ken Newton wrote: > class AttrClass(object): > """AttrClass lets you freely add attributes in nested manner""" > > def __init__(self): > pass > def __setitem__(self, key, value): > return self.__dict__.__setitem__(key, value) > def __repr__(self): > return

Re: Usage of main()

2009-09-04 Thread Carl Banks
On Sep 3, 11:39 pm, Simon Brunning wrote: > 2009/9/4 Manuel Graune : > > > How come the main()-idiom is not "the standard way" of writing a > > python-program (like e.g. in C)? > > Speaking for myself, it *is* the standard way to structure a script. I > find it more readable, since I can put my ma

Re: The future of Python immutability

2009-09-04 Thread Francesco Bochicchio
On Sep 3, 9:07 pm, Nigel Rantor wrote: > > Right, this is where I would love to have had more experience with Haksell. > > Yes, as soon as you get to a situation where no thread can access shared > state that is mutable your problems go away, you're also getting no work > done becasue the threads,

Re: The future of Python immutability

2009-09-04 Thread Ulrich Eckhardt
Nigel Rantor wrote: > John Nagle wrote: >> Immutability is interesting for threaded programs, because >> immutable objects can be shared without risk. Consider a programming >> model where objects shared between threads must be either immutable or >> "synchronized" in the sense that Java uses

Re: The future of Python immutability

2009-09-04 Thread Paul Rubin
Ulrich Eckhardt writes: > Lastly, for the message passing, you also need shared, mutable structures > (queues), so you can't live completely without conventional locking. But that can be completely behind the scenes in the language or library implementation. The application programmer doesn't ha

cross platform distribution

2009-09-04 Thread vpr
Hi All After a couple of experiments, searching around and reading Steve Holden's lament about bundling and ship python code, I thought I'd direct this to to the group. I'm using Python 2.6 btw. I've build a commercial application that I'd like to bundle and ship. I'd like to protect some of my I

Re: match braces?

2009-09-04 Thread Steven D'Aprano
On Fri, 04 Sep 2009 00:25:34 -0700, lallous wrote: > Hello, > > Thank you all for your replies. > > A simple suggestion as Chris' actually might help. > > I am used to two spaces indentation since years, and apparently two > spaces won't make it clear if no visuals were present (braces, or > be

Re: python module for data comparison of 2 MySQL servers

2009-09-04 Thread Kushal Kumaran
On Wed, Sep 2, 2009 at 5:30 AM, <> wrote: > I have 2 MySQL servers in 2 different data centers. > Between them, there is data replication setup. > > Is there a python tool so I can do data comparison for daily records? > > Basically, just access both servers and do a diff in memory and print out >

Re: obscure problem using elementtree to make xhtml website

2009-09-04 Thread Richard Brodie
"Stefan Behnel" wrote in message news:4aa01462$0$31340$9b4e6...@newsspool4.arcor-online.net... >>Not a bug in IE (this time), which is correctly parsing the file as html. > > ... which is obviously not the correct thing to do when it's XHTML. It isn't though; it's HTML with a XHTML DOCTYPE, a

Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-04 Thread The Music Guy
I have a peculiar problem that involves multiple inheritance and method calling. I have a bunch of classes, one of which is called MyMixin and doesn't inherit from anything. MyMixin expects that it will be inherited along with one of several other classes that each define certain functionality. It

Re: Usage of main()

2009-09-04 Thread Jan Kaliszewski
So yes, depending on the nature of your code, its quite conceivable to find distinct performance differences between code using the __main__ idiom and code without. But -- it should be emphasized -- it's faster thanks to running code (an doing name lookups) within a function, and *not* thanks to

Re: Why does this group have so much spam?

2009-09-04 Thread BJ Swope
And I would kindly appreciate it if you fellas wouldn't go solving this little spam problem! Selling Anti-Spam industry leading appliances has managed to put me in a rather nice house and I'd hate to lose it just because you fellas went and solved the problem! ;) On Thu, Sep 3, 2009 at 11:24 PM

Re: Usage of main()

2009-09-04 Thread Jan Kaliszewski
04-09-2009 o 08:37:43 r wrote: Why use a nested function when you already *in* main? I understand you name global scope as 'main'. But (independently of using the __main__ idiom and so on) it is still good idea not to place to much code in the global scope but to place your app-logic code in

Re: The future of Python immutability

2009-09-04 Thread Hendrik van Rooyen
On Thursday 03 September 2009 21:07:21 Nigel Rantor wrote: > That is not the challenge, that's the easy part. The challenge is > getting useful information out of a system that has only been fed > immutable objects. Is it really that difficult? (completely speculative): class MyAnswer(object):

Re: python module for data comparison of 2 MySQL servers

2009-09-04 Thread Tino Wildenhain
Hi, Am 02.09.2009 02:00, schrieb none: I have 2 MySQL servers in 2 different data centers. Between them, there is data replication setup. Is there a python tool so I can do data comparison for daily records? Why should the data differ and the replication not detect and correct it? I frequentl

Re: obscure problem using elementtree to make xhtml website

2009-09-04 Thread Stefan Behnel
Richard Brodie wrote: > "Stefan Behnel" wrote: >> Lee wrote: >>> Not a bug in IE (this time), which is correctly parsing the file as html. >> ... which is obviously not the correct thing to do when it's XHTML. > > It isn't though; it's HTML with a XHTML DOCTYPE Not the page I look at (i.e. the li

logger module : Question about log message format

2009-09-04 Thread jorma kala
Hi, I've created a logger like this: LOG_FILENAME = 'test.txt' fh=logging.FileHandler(LOG_FILENAME,'w') logger1 = logging.getLogger('myLogger1') logger1.addHandler(fh) logger1.setLevel(logging.INFO) logger1.info('message from logger1') and was hoping to get log messages in this format in my log

Re: Usage of main()

2009-09-04 Thread Mel
Manuel Graune wrote: [ ... ] > thanks for your answer. What you are explaining is exactly why I tried > it in the first place. I'm just wondering why (this is my impression, > not necessaryly the reallity) none of the recommended texts on python > put this in the first chapters. Instead - if it is

Invitation to connect on LinkedIn

2009-09-04 Thread Navneet Khanna
LinkedIn Navneet Khanna requested to add you as a connection on LinkedIn: -- Jaime, I'd like to add you to my professional network on LinkedIn. - Navneet Accept invitation from Navneet Khanna http://www.linkedin.com/e/I2LlXdLlWUhFABKmxVOlgGL

Python SSH interface

2009-09-04 Thread Mag Gam
Is there something similar to NetSSH (http://search.cpan.org/dist/Net-SSH-Perl/) for python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python SSH interface

2009-09-04 Thread Avell Diroll
Mag Gam wrote: Is there something similar to NetSSH (http://search.cpan.org/dist/Net-SSH-Perl/) for python? I don't know much about perl modules functionalities, but paramiko might be what you are searching for. http://www.lag.net/paramiko/ Cheers Ju -- Those who do not understand Unix are

Re: Python SSH interface

2009-09-04 Thread Diez B. Roggisch
Mag Gam wrote: > Is there something similar to NetSSH > (http://search.cpan.org/dist/Net-SSH-Perl/) for python? Google dead today? From the > 3.000.000 answers for python + ssh, I suggest paramiko, but there are more options. Diez -- http://mail.python.org/mailman/listinfo/python-list

File Handling Problem

2009-09-04 Thread joy99
Dear Group, I have a file. The file has multiple lines. I want to get the line number of any one of the strings. Once I get that I like to increment the line number and see the string of the immediate next line or any following line as output. The problem as I see is nicely handled in list, like

Re: recursive decorator

2009-09-04 Thread Michele Simionato
On Sep 3, 6:41 pm, Ethan Furman wrote: > > The original thread by Bearophile: >    http://mail.python.org/pipermail/python-list/2009-May/711848.html I have read the thread. What Bearophile wants can be implemented with a bytecode hack, no need for the decorator module. Let me call 'recur' the sel

Re: Usage of main()

2009-09-04 Thread Ben Finney
"Jan Kaliszewski" writes: > I understand you name global scope as 'main'. But (independently of > using the __main__ idiom and so on) it is still good idea not to place > to much code in the global scope but to place your app-logic code in > functions -- because, as we noted: > > * in practice it

Re: possible attribute-oriented class

2009-09-04 Thread Jan Kaliszewski
[originally from python-list@python.org, crossposted to python-id...@python.org] 04-09-2009 o 00:46:01 Ken Newton wrote: I have created the following class definition with the idea of making a clean syntax for non-programmers to created structured data within a python environment. I would ap

Re: cross platform distribution

2009-09-04 Thread Philip Semanchuk
On Sep 4, 2009, at 4:44 AM, vpr wrote: Hi All After a couple of experiments, searching around and reading Steve Holden's lament about bundling and ship python code, I thought I'd direct this to to the group. I'm using Python 2.6 btw. I've build a commercial application that I'd like to bundle

Re: Usage of main()

2009-09-04 Thread Albert Hopkins
On Fri, 2009-09-04 at 22:55 +1000, Ben Finney wrote: > * having a module that can be imported without side effects helps > select > pieces of the module's functionality > > * any module should be importable without side effects to make it > easier > to run unit tests for that module > +1 --

Re: cross platform distribution

2009-09-04 Thread vpr
On Sep 4, 3:19 pm, Philip Semanchuk wrote: > On Sep 4, 2009, at 4:44 AM, vpr wrote: > > > > > Hi All > > > After a couple of experiments, searching around and reading Steve > > Holden's lament about bundling and ship python code, I thought I'd > > direct this to to the group. I'm using Python 2.6

Re: Video?

2009-09-04 Thread David C . Ullrich
On Thu, 03 Sep 2009 23:04:45 +0200, Avell Diroll wrote: >David C Ullrich wrote: >... >> Is that correct? If so is there some other standard Python >> windowing kit that does include some sort of video functionality? >> >> (Talking Ubuntu Linux if it matters.) > >I don't know about video and wxpy

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-04 Thread Sverker Nilsson
On Thu, 2009-09-03 at 10:05 +0100, Chris Withers wrote: > Raymond Hettinger wrote: > > In the first case, you would write: > >sets.extend(h.load(f)) > > yes, what I had was: > > for s in iter(h.load(f)): sets.append(s) > > ...which I mistakenly thought was working, but in in fact boils down

Re: Video?

2009-09-04 Thread David C . Ullrich
On Thu, 3 Sep 2009 16:24:44 -0700 (PDT), Che M wrote: >On Sep 3, 4:11 pm, David C Ullrich wrote: >> Not at all important, just for fun (at least for me): >> >> It seems to me, looking at various docs, that wxWidgets >> includes a "media control" that can play video files, but >> it's not include

Re: cross platform distribution

2009-09-04 Thread Philip Semanchuk
On Sep 4, 2009, at 9:24 AM, vpr wrote: On Sep 4, 3:19 pm, Philip Semanchuk wrote: On Sep 4, 2009, at 4:44 AM, vpr wrote: Hi All After a couple of experiments, searching around and reading Steve Holden's lament about bundling and ship python code, I thought I'd direct this to to the gro

Re: using queue

2009-09-04 Thread MRAB
Tim Arnold wrote: "Jan Kaliszewski" wrote in message news:mailman.895.1251958800.2854.python-l...@python.org... 06:49:13 Scott David Daniels wrote: Tim Arnold wrote: (1) what's wrong with having each chapter in a separate thread? Too much going on for a single processor? Many more threads

Re: [Guppy-pe-list] An iteration idiom (Was: Re: loading files containing multiple dumps)

2009-09-04 Thread Sverker Nilsson
On Fri, 2009-09-04 at 15:25 +0200, Sverker Nilsson wrote: > > However, I am aware of the extra initial overhead to do h=hpy(). I > discussed this in my thesis. "Section 4.7.8 Why not importing Use > directly?" page 36, > > http://guppy-pe.sourceforge.net/heapy-thesis.pdf Actually it is describ

Re: The future of Python immutability

2009-09-04 Thread Adam Skutt
On Sep 3, 2:03 pm, John Nagle wrote: >      Suppose, for discussion purposes, we had general "immutable objects". > Objects inherited from "immutableobject" instead of "object" would be > unchangeable once "__init__" had returned.  Where does this take us? You can create this in various ways thro

Re: python daemon - compress data and load data into MySQL by pyodbc

2009-09-04 Thread MacRules
Dennis Lee Bieber wrote: On Thu, 03 Sep 2009 14:43:40 -0400, MacRules declaimed the following in gmane.comp.python.general: Oracle DB in data center 1 (LA, west coast) MSSQL DB in data center 2 (DC, east coast) Note that your thread subject line states MySQL... There is a big differe

How to access ODBC databases ?

2009-09-04 Thread Timothy Madden
Hello I would like to use a database through ODCB in my python application. I have Slackware Linux, but I would not mind a portable solution, since python runs on both Unixes and Windows. I would like a free/open-source solution and the python module for ODBC access that I have found is *pyo

Re: File Handling Problem

2009-09-04 Thread Lucas Prado Melo
On Fri, Sep 4, 2009 at 9:50 AM, joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as outp

Re: possible attribute-oriented class

2009-09-04 Thread Colin J. Williams
Jan Kaliszewski wrote: [originally from python-list@python.org, crossposted to python-id...@python.org] 04-09-2009 o 00:46:01 Ken Newton wrote: I have created the following class definition with the idea of making a clean syntax for non-programmers to created structured data within a python

Re: The future of Python immutability

2009-09-04 Thread Scott David Daniels
John Nagle wrote: ... Suppose, for discussion purposes, we had general "immutable objects". Objects inherited from "immutableobject" instead of "object" would be unchangeable once "__init__" had returned. Where does this take us? Traditionally in Python we make that, "once __new__ had returned

Re: What python can NOT do?

2009-09-04 Thread Mike Coleman
On Aug 28, 5:37 pm, qwe rty wrote: > i know that an interpreted language like python can't be used to make > an operating system or system drivers. > > what else can NOT be done in python? what are the limitations of the > language? Neither of those is strictly true. It is true, though, that Pyt

Re: possible attribute-oriented class

2009-09-04 Thread Scott David Daniels
Ken Newton wrote: ... I would appreciate comments on this code. First, is something like this already done? Second, are there reasons for not doing this? ... class AttrClass(object): ... def __repr__(self): return "%s(%s)" % (self.__class__.__name__, self.__dict__.__repr__()

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? On Fri, 04 Sep 2009 07:46:42 -0700, Stephen Fairchild wrote: joy99 wrote: Dear Group, I have a file. The file has multiple lines. I want to get the line numb

Re: How to access ODBC databases ?

2009-09-04 Thread Martin P. Hellwig
Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverConnectW)') Not sure (i.e. wild guess) but that l

Re: File Handling Problem

2009-09-04 Thread Tim Golden
Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? No: readlines () retains the "\n"s; splitlines () loses them TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problem

2009-09-04 Thread Stephen Fairchild
joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as output. The > problem as I see is ni

Re: What python can NOT do?

2009-09-04 Thread MRAB
Mike Coleman wrote: On Aug 28, 5:37 pm, qwe rty wrote: i know that an interpreted language like python can't be used to make an operating system or system drivers. what else can NOT be done in python? what are the limitations of the language? Neither of those is strictly true. It is true, t

Re: Usage of main()

2009-09-04 Thread Scott David Daniels
Carl Banks wrote: On Sep 3, 11:39 pm, Simon Brunning wrote: 2009/9/4 Manuel Graune : How come the main()-idiom is not "the standard way" of writing a python-program (like e.g. in C)? Speaking for myself, it *is* the standard way to structure a script. I find it more readable, since I can put

retrieving real time quotes from yahoo

2009-09-04 Thread ss
Hello, ive started using python for a few weeks now, and came across a problem that i would appreciate help solving. im trying to create code which can grab real time quotes from yahoo (yes ive created an account for yahoo finance). But im not sure how to generate an authenticated login and how t

multiprocessing: Correct usage of pool & queue?

2009-09-04 Thread Allen Fowler
Hello, I have a list of tasks/items that I want handed off to threads/processes to complete. (I would like to stick with process if I could, since there is some CPU work here. ) Each task involves some calculations and a call to a remote server over urllib2/HTTP. The time to complete each ta

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-04 Thread Scott David Daniels
The Music Guy wrote: I have a peculiar problem that involves multiple inheritance and method calling. I have a bunch of classes, one of which is called MyMixin and doesn't inherit from anything. MyMixin expects that it will be inherited along with one of several other classes that each define ce

Re: Why does this group have so much spam?

2009-09-04 Thread Ethan Furman
Steven D'Aprano wrote: On Thu, 03 Sep 2009 16:01:26 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 12:19:48 -0700, Ethan Furman wrote: Steven D'Aprano wrote: On Thu, 03 Sep 2009 04:01:54 -0400, Terry Reedy wrote: ISP's price residential service based on ave

[ANN] Athens Python User Group - Meeting September 9, 2009, 19:00.

2009-09-04 Thread Orestis Markou
== Announcing the 1st meeting of the Athens Python User Group == If you live near Athens, Greece and are interested in meeting fellow Python programmers, meet us for a friendly chat at the Eleftheroudakis Bookstore café, on Wednesday 9 September, 7:00pm. If you plan to attend, please add a

Support for Windows 7 ?

2009-09-04 Thread Pascale Mourier
Hello, I don't know how to report presumed "bugs" to the Python development team.. in the past, the very few bugs I found were always fixed by a more recent version. On of my students has installed Windows 7 RTM on his cherished computer, and claims that Python 2.6.2 doesn't support it. The

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
No: readlines () retains the "\n"s; splitlines () loses them Ah, thank you for the clarification! On Fri, 04 Sep 2009 08:39:37 -0700, Tim Golden wrote: Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the

Re: possible attribute-oriented class

2009-09-04 Thread Ken Newton
I like this version very much. I'm ready to put this into practice to see how it works in practice. A minor point: I envision this to be used in a context where all key values are strings (legal attribute identifiers). But constructing an AttrClass from a dict or setting values directly with the

Re: recursive decorator

2009-09-04 Thread Ethan Furman
Michele Simionato wrote: On Sep 3, 6:41 pm, Ethan Furman wrote: The original thread by Bearophile: http://mail.python.org/pipermail/python-list/2009-May/711848.html I have read the thread. What Bearophile wants can be implemented with a bytecode hack, no need for the decorator module. Let

Re: logger module : Question about log message format

2009-09-04 Thread Kev Dwyer
On Fri, 04 Sep 2009 12:34:32 +0100, jorma kala wrote: > Hi, > I've created a logger like this: > > > LOG_FILENAME = 'test.txt' > fh=logging.FileHandler(LOG_FILENAME,'w') logger1 = > logging.getLogger('myLogger1') logger1.addHandler(fh) > logger1.setLevel(logging.INFO) > logger1.info('message fro

Running Sum script

2009-09-04 Thread Jul
hello, I have a .txt file that is in this format -- 12625 17000 12000 14500 17000 12000 17000 14500 14500 12000 ...and so on... i need to create a python script that will open this file and have a running sum until the end of file. it sounds really simple its just for some reason i am having pr

Re: Support for Windows 7 ?

2009-09-04 Thread Martin v. Löwis
> On of my students has installed Windows 7 RTM on his cherished computer, > and claims that Python 2.6.2 doesn't support it. > The sample program had a problem with the library function > os.listdir(dirarg) always returning the same result for different values > of dirarg. > > DO YOU KNOW HOW FAR

Re: Running Sum script

2009-09-04 Thread David Smith
Jul wrote: > hello, > > I have a .txt file that is in this format -- > > 12625 > 17000 > 12000 > 14500 > 17000 > 12000 > 17000 > 14500 > 14500 > 12000 > ...and so on... > > i need to create a python script that will open this file and have a > running sum until the end of file. > > it sounds re

Re: Support for Windows 7 ?

2009-09-04 Thread Pascale Mourier
Martin v. Löwis a écrit : If there is a specific problem, we would need a specific test case, to be reported to bugs.python.org. Tks for the name above. I asked my student to prepare the bug demo package, but I didn't know how to send it! Given that the problem is with reading the file syst

Re: Running Sum script

2009-09-04 Thread Stephen Fairchild
Jul wrote: > hello, > > I have a .txt file that is in this format -- > > 12625 > 17000 > 12000 > 14500 > 17000 > 12000 > 17000 > 14500 > 14500 > 12000 > ...and so on... > > i need to create a python script that will open this file and have a > running sum until the end of file. Untested: with

Re: Support for Windows 7 ?

2009-09-04 Thread Martin v. Löwis
> Given that the problem is with reading the file system, it is likely to > be w/ sth else > > than Windows 7, maybe some weird HD partition combination? Without having seen any details, I refuse to guess. Most likely, it is a user mistake. Regards, Martin -- http://mail.python.org/mailman/lis

Re: Running Sum script

2009-09-04 Thread Jul
On Sep 4, 2:21 pm, Stephen Fairchild wrote: > Jul wrote: > > hello, > > > I have a .txt file that is in this format -- > > > 12625 > > 17000 > > 12000 > > 14500 > > 17000 > > 12000 > > 17000 > > 14500 > > 14500 > > 12000 > > ...and so on... > > > i need to create a python script that will open thi

Application-global "switches"?

2009-09-04 Thread kj
I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a program, and broadly affects its operation

Re: Running Sum script

2009-09-04 Thread David Smith
Jul wrote: > On Sep 4, 2:21 pm, Stephen Fairchild wrote: >> Jul wrote: >>> hello, >>> I have a .txt file that is in this format -- >>> 12625 >>> 17000 >>> 12000 >>> 14500 >>> 17000 >>> 12000 >>> 17000 >>> 14500 >>> 14500 >>> 12000 >>> ...and so on... >>> i need to create a python script that will

Re: Application-global "switches"?

2009-09-04 Thread Terry Reedy
kj wrote: I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a program, and broadly affects it

Re: Running Sum script

2009-09-04 Thread Rami Chowdhury
Could you let us know what kind of error you are getting? I don't know if this is your error, but this line won't run: readData = formisanoOpen.readLines() Since Python is case-sensitive, you would need a lower-case 'l' in 'readlines()' -- perhaps that would solve your problem? On Fri, 04

Re: Application-global "switches"?

2009-09-04 Thread ici
On Sep 4, 9:29 pm, kj wrote: > I'm looking for the "best-practice" way to define application-global > read-only switches, settable from the command line.  The best > example I can think of of such global switch is the built-in variable > __debug__.  This variable is visible everywhere in a program

Re: How to access ODBC databases ?

2009-09-04 Thread Timothy Madden
Martin P. Hellwig wrote: Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverConnectW)') Not sure (i

Re: Running Sum script

2009-09-04 Thread Juli Dolzhenko
On Sep 4, 2:52 pm, "Rami Chowdhury" wrote: > Could you let us know what kind of error you are getting? > > I don't know if this is your error, but this line won't run: > > > readData = formisanoOpen.readLines() > > Since Python is case-sensitive, you would need a lower-case 'l' in > 'readlines()'

Re: cross platform distribution

2009-09-04 Thread vpr
On Sep 4, 3:33 pm, Philip Semanchuk wrote: > On Sep 4, 2009, at 9:24 AM, vpr wrote: > > > > > On Sep 4, 3:19 pm, Philip Semanchuk wrote: > >> On Sep 4, 2009, at 4:44 AM, vpr wrote: > > >>> Hi All > > >>> After a couple of experiments, searching around and reading Steve > >>> Holden's lament about

Re: cross platform distribution

2009-09-04 Thread ianaré
These are all good suggestions. I just wanted to add that you can distribute pre-built Linux packages for the most popular distros like one for RHEL/Centos/Fedora as RPM and one for Debian/Ubuntu as DEB. Any C code in them would be compiled. On Sep 4, 9:33 am, Philip Semanchuk wrote: > On Sep 4,

Re: possible attribute-oriented class

2009-09-04 Thread Jan Kaliszewski
04-09-2009 Ken Newton wrote: I like this version very much. I'm ready to put this into practice to see how it works in practice. [snip] Not only you (Ken) and me. :-) It appears that the idea is quite old. Nick Coghlan replied at python-id...@python.org: Jan Kaliszewski wrote: What do you

Re: Running Sum script

2009-09-04 Thread Tobiah
> in the terminal i get a very strange "permission denied" error that might > not have anything to do with the code. I checked permissions for the file > and they are set to "read and write" so, again, I am really not sure what > going wrong. Try: python myfile Or chmod +x myf

Re: Running Sum script

2009-09-04 Thread Maggie
On Sep 4, 4:37 pm, Tobiah wrote: > > in the terminal i get a very strange "permission denied" error that might > > not have anything to do with the code. I checked permissions for the file > > and they are set to "read and write" so, again, I am really not sure what > > going wrong. > > Try: > >

Re: Application-global "switches"?

2009-09-04 Thread Ethan Furman
ici wrote: On Sep 4, 9:29 pm, kj wrote: I'm looking for the "best-practice" way to define application-global read-only switches, settable from the command line. The best example I can think of of such global switch is the built-in variable __debug__. This variable is visible everywhere in a

Re: Running Sum script

2009-09-04 Thread Rami Chowdhury
try it where? code or terminal? Please try these in the terminal -- the permission denied error may be due to your shell not being able to execute the Python script, instead of your Python script not being able to open the data file. On Fri, 04 Sep 2009 13:37:10 -0700, Maggie wrote: On

Re: How to access ODBC databases ?

2009-09-04 Thread Martin P. Hellwig
Timothy Madden wrote: Martin P. Hellwig wrote: Timothy Madden wrote: >>> conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};Servername=127.0.0.1;UID=pikantBlue;Database=pikantBlue') Traceback (most recent call last): File "", line 1, in pyodbc.Error: ('0', '[0] [nxDC (202) (SQLDriverCo

Re: Running Sum script

2009-09-04 Thread <><><><>
On Sep 4, 4:37 pm, Maggie wrote: > On Sep 4, 4:37 pm, Tobiah wrote: > > > > in the terminal i get a very strange "permission denied" error that might > > > not have anything to do with the code. I checked permissions for the file > > > and they are set to "read and write" so, again, I am really n

Re: Support for Windows 7 ?

2009-09-04 Thread Martin P. Hellwig
Michel Claveau - MVP wrote: Du coup, j'ai envie de déduire : - Que certains étudiants d'écoles de commerce françaises préfèrent travailler avec "l'étranger" plutôt qu'avec "le français". - Il faudra dire à d'autres étudiants d'écoles de commerce françaises que le fait de ne pas arriver/sav

Re: Problem w/ mysqldump

2009-09-04 Thread Victor Subervi
I got essentially the same printout. There were the following, among many others: mysqldump.exe mysqldump.pdb What's a *.pdb file? Don't know it matters. If there were just some darn way to know where that daggone database is, I could copy it and move it to another machine. TIA, V On Thu, Sep 3, 2

Re: [Python-ideas] possible attribute-oriented class

2009-09-04 Thread George Sakkis
On Fri, Sep 4, 2009 at 4:37 PM, Jan Kaliszewski wrote: > 04-09-2009 Ken Newton wrote: > >> I like this version very much. I'm ready to put this into practice to see >> how it works in practice. > > [snip] > > Not only you (Ken) and me. :-) It appears that the idea is quite old. Nick > Coghlan repl

Re: Running Sum script

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 1:49 PM, <><><><> wrote: > On Sep 4, 4:37 pm, Maggie wrote: >> On Sep 4, 4:37 pm, Tobiah wrote: >> >> > > in the terminal i get a very strange "permission denied" error that might >> > > not have anything to do with the code. I checked permissions for the file >> > > and th

Re: obscure problem using elementtree to make xhtml website

2009-09-04 Thread Nobody
On Fri, 04 Sep 2009 13:21:54 +0200, Stefan Behnel wrote: Not a bug in IE (this time), which is correctly parsing the file as html. >>> ... which is obviously not the correct thing to do when it's XHTML. >> >> It isn't though; it's HTML with a XHTML DOCTYPE > > Not the page I look at (i.e. t

Re: Subclassing list and splicing

2009-09-04 Thread Nobody
On Thu, 03 Sep 2009 17:10:12 +, Kreso wrote: > I would prefer that resulting object m belonged to myclist class. > How to obtain such behaviour? Must I somehow implement __getslice__ > method myself? Yes; you should also implement __getitem__(), as this is used for extended slices. -- http:

Compiler.ast helper function "literal_eval" in python 2.4

2009-09-04 Thread Sean Talts
Hi, I'm trying to parse some python with the compiler module, select a subset of the AST returned, and then evaluate that subset, all in python 2.4. It seems like in python 2.6 the compiler.ast.literal_eval function may be what I'm looking for, but unfortunately for my project we are restricted t

How to download directly to a file?

2009-09-04 Thread kj
I want to send a POST request and have the returned content put directly into a file. Is there a way to do this easily in Python? I've been looking at the documentation for urllib2, but I can't see a direct way to do this, other than saving the returned contents to an in-memory variable and wri

Re: How to download directly to a file?

2009-09-04 Thread Diez B. Roggisch
kj schrieb: I want to send a POST request and have the returned content put directly into a file. Is there a way to do this easily in Python? I've been looking at the documentation for urllib2, but I can't see a direct way to do this, other than saving the returned contents to an in-memory varia

incorrect DeprecationWarning?

2009-09-04 Thread Alan G Isaac
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. class MyError(Exception): ... def __init__(self, message): ... Exception.__init__(self) ... self.message = message ...

Problems with hex-conversion functions

2009-09-04 Thread Arnon Yaari
Hello everyone. Perhaps I'm missing something, but I see several problems with the two hex-conversion function pairs that Python offers: 1. binascii.hexlify and binascii.unhexlify 2. bytes.fromhex and bytes.hex Problem #1: bytes.hex is not implemented, although it was specified in PEP 358. This me

Re: incorrect DeprecationWarning?

2009-09-04 Thread Terry Reedy
Alan G Isaac wrote: Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. class MyError(Exception): ... def __init__(self, message): ... Exception.__init__(self) ... self.

  1   2   >