Re: sum up numbers in a list

2008-08-26 Thread Fredrik Lundh
sharon kim wrote: i have a list, for example; L=[] L.append('10') L.append('15') L.append('20') len(L) 3 print L ['10', '15', '20'] is there a way to sum up all the numbers in a list? the number of objects in the list is vary, around 50 to 60. all objects are 1 to 3 digit

Re: Reading from text file

2008-08-26 Thread Fredrik Lundh
A. Joseph wrote: I want to read from text file, 25 lines each time i press enter key, just like the python documentation. you can use pydoc's pager from your program: import pydoc text = open(filename).read() pydoc.pager(text) /F --

Re: sum up numbers in a list

2008-08-26 Thread c james
L=['10','15','20'] sum(int(x) for x in L) 45 or sum(map(int,L)) 45 sharon kim wrote: hi all, i have a list, for example; L=[] L.append('10') L.append('15') L.append('20') len(L) 3 print L ['10', '15', '20'] is there a way to sum up all the numbers in a list? the number of

Re: sum up numbers in a list

2008-08-26 Thread sharon kim
brilliant, thank you both of you, i will try that out later. :) On Wed, Aug 27, 2008 at 1:34 AM, c james [EMAIL PROTECTED] wrote: L=['10','15','20'] sum(int(x) for x in L) 45 or sum(map(int,L)) 45 sharon kim wrote: hi all, i have a list, for example; L=[] L.append('10')

Re: swig or ctypes , under the gun and need help

2008-08-26 Thread norseman
Diez B. Roggisch wrote: Sells, Fred schrieb: Diez wrote... I don't know swig, but if all you have is a real C-API, try use ctypes. It's much easier to create bindings for, keeps you fully in the warm and cozy womb of python programming and doesn't need no compilation to create the actual

Re: GUI programming with python

2008-08-26 Thread John Fabiani
Alan Franzoni wrote: zamil was kind enough to say: [cut] If your needs are very basic, you can stick with the tk module that comes with python. It's not really feature-packed, but it's maintained and pretty cross-platform. Otherwise, you can pick any supported widget set you like and

problem with Tix in Python2.5

2008-08-26 Thread gordon
hi i have been using some Tix widgets in my gui code in Python2.5 and they used to work without any problems.Now all of a sudden i am getting error messages like couldn't read file E:/Python25/tcl/tix8.4/ChkList.tcl: no such file or directory ... This probably means that Tix wasn't installed

Re: problem with Tix in Python2.5

2008-08-26 Thread Fredrik Lundh
gordon wrote: i have been using some Tix widgets in my gui code in Python2.5 and they used to work without any problems.Now all of a sudden i am getting error messages like couldn't read file E:/Python25/tcl/tix8.4/ChkList.tcl: no such file or directory ... This probably means that Tix

Re: Newbie needs help

2008-08-26 Thread frankrentef
On Aug 26, 11:46 am, frankrentef [EMAIL PROTECTED] wrote: Greetings all, I'm wanting to maintain what values in one file and call them in another.  The purpose being to keep a single location where url's, login's and passwords can be maintained, then called as needed from another file. In

Renaming Excel Spreadsheets

2008-08-26 Thread Greg Lindstrom
Hello, I am working with Python to create Excel spreadsheets and have run into a couple of problems I hope you can help me with. First...are there any bindings/libraries into Open Office? Now, back to Excel. -- Does anyone know a way to create N worksheets? By default, 3 are created, but I

Re: Unexpected global variable behaviour

2008-08-26 Thread RgeeK
Thanks a lot Fredrik, A big wave of deja vu came over me as I read your note. That bit me once before, and was my only previous run-in with the 'global' directive which clearly didn't stick with me. :( Thanks for the concise, helpful reply. The universe makes sense again. -Ross. Fredrik

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread James Matthews
ctypes and swig for me On Tue, Aug 26, 2008 at 9:04 AM, Ulrich Eckhardt [EMAIL PROTECTED]wrote: 一首诗 wrote: I read this interesting post comparing Boost.Python with Pyd: http://pyd.dsource.org/vsboost.html What's your opinion about it? What's your first choice when you have write a

Re: GUI programming with python

2008-08-26 Thread James Matthews
wxPython is a very rich toolkit it includes a nice GUI bulider and you can also try an IDE called Boa On Tue, Aug 26, 2008 at 10:49 AM, John Fabiani [EMAIL PROTECTED] wrote: Alan Franzoni wrote: zamil was kind enough to say: [cut] If your needs are very basic, you can stick with the

Re: problem with Tix in Python2.5

2008-08-26 Thread gordon
On Aug 26, 11:24 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: assuming that you installed Python 2.5 on E:, it sure looks as if your Python installation is broken. reinstalling should fix that. /F thanks i couldn't find any binary distribution of tix8.4.So i think i have to reinstall python.

logging - how to use in a library?

2008-08-26 Thread Thomas Heller
I'm using the logging module in my comtypes library to log 'interesting' things that happen. In other words, the idea is if the user of the library is interested in the details that happen in the package internally, he (she?) would configure a logging level and handlers that write the log

JSON from Python mysqldb

2008-08-26 Thread jpuopolo
All: I am using Python to read some records from the MySQL database. I am using the mysqldb library, and things are working well. Now, I would like to pass back the results of the query to a Web-based front end, and I would like to use JSON. Is there a library/example of creating a JSON array

Re: Are dictionaries the same as hashtables?

2008-08-26 Thread Cameron Laird
In article [EMAIL PROTECTED], Diez B. Roggisch [EMAIL PROTECTED] wrote: Cameron Laird wrote: In article [EMAIL PROTECTED], Diez B. Roggisch [EMAIL PROTECTED] wrote: Martin Marcher wrote: On 2008-08-26 00:32:20, cnb wrote: Are dictionaries the same as hashtables? . . . Python does not have

Re: JSON from Python mysqldb

2008-08-26 Thread Larry Bates
jpuopolo wrote: All: I am using Python to read some records from the MySQL database. I am using the mysqldb library, and things are working well. Now, I would like to pass back the results of the query to a Web-based front end, and I would like to use JSON. Is there a library/example of

Re: Renaming Excel Spreadsheets

2008-08-26 Thread Emile van Sebille
Greg Lindstrom wrote: Hello, I am working with Python to create Excel spreadsheets and have run into a couple of problems I hope you can help me with. First...are there any bindings/libraries into Open Office? Now, back to Excel. -- Does anyone know a way to create N worksheets? By

RE: Renaming Excel Spreadsheets

2008-08-26 Thread Reedick, Andrew
Excel object model: http://msdn.microsoft.com/en-us/library/bb149081.aspx I think the Sheets object is where you add more sheets to a workbook. You can google for code examples on how to use COM with Excel. You don't have to limit yourself to Python code examples since

struct.Struct random access

2008-08-26 Thread castironpi
I'd like to seriously nominate this idea and get a considered opinion on it. struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the structure. What do you think of random access to the

Re: dynamically adding some of one module's functions to another

2008-08-26 Thread Bruno Desthuilliers
Gabriel Rossetti a écrit : Hello everyone, I'm trying to import some modules into another's namespace (network_utils) network_utils.py: import utils import constants as main_const from services import constants as srv_const from plugins import constants as plg_const # # Import all the

Re: Programmatically exit the REPL

2008-08-26 Thread Matthew Fitzgibbons
Almar Klein wrote: Hi, If you insist on writing your own shell, you can also consider running the commands in another python process. I took the source code of Pype as an example, which uses a wx.Process. I've tried the subprocess module as well, but could not get it to work. Almar

Re: What is class method?

2008-08-26 Thread Bruno Desthuilliers
Hussein B a écrit : Hi, I'm familiar with static method concept, Which is more often than not useless in Python - we have true functions and modules. but what is the class method? Short answer : It's a method that can be looked up upon both the class or an instance of it, and takes the

Re: Books about Python.

2008-08-26 Thread Mike Driscoll
On Aug 24, 10:32 pm, [EMAIL PROTECTED] wrote: I'm up to write a 20-30 research paper for my computer science course, and I was considering choosing to do mine on Python.  I was curious if anybody knows of any good books about python they could recommend that have more of a technical view

Using Python to shared memory resources between Linux and Windows

2008-08-26 Thread Blubaugh, David A.
To All, I was wondering if it was possible to utilize python to share a memory resource between a linux and windows system?? It should be stated that both the Linux (CENTOS 5) and windows are physically located on the same computer. Is any of this possible? Thanks, David Blubaugh

Re: Decorators using instance variables

2008-08-26 Thread Bruno Desthuilliers
robert2821 a écrit : Hi, I'm new; greetings all! Hello. Since you're new here, first a couple advises: 1/ the python mailing list is relayed to the comp.lang.python usenet newsgroup (from where I'm reading your post and answering it), so please avoid attachments. Either put the full code

RE: The Importance of Terminology's Quality

2008-08-26 Thread Phil Runciman
Apologies: By the time my posts have been added the discussion has moved on a lot. I have to make a correction too. It was not a System 4 machine but an ICL 2900 series (Once known as the New Range Series). Hey it was a long time ago and I have moved countries 4 times since then and anno domini

Re: Programmatically exit the REPL

2008-08-26 Thread Matthew Fitzgibbons
Matthew Fitzgibbons wrote: I've got a pretty complex interactive command line program. Instead of writing my own REPL, I'm using the Python interpreter (an infinitely better solution). This program has two threads, a background thread and the REPL thread. When you call quit() or sys.exit() in

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread John Machin
On Aug 27, 3:04 am, norseman [EMAIL PROTECTED] wrote: frankentux wrote: Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import

Re: Decorators using instance variables

2008-08-26 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : robert2821 a écrit : (snip - sorry, hit the 'send' button too soon) def getdec(f): dec = decorator(f) return dec.docall class decorator: def __init__ (self, f): self.f = f def docall (self, *a): return self.f(*a) class test:

Re: Using Python to shared memory resources between Linux and Windows

2008-08-26 Thread Diez B. Roggisch
Blubaugh, David A. schrieb: To All, To whom else if I may ask? I was wondering if it was possible to utilize python to share a memory resource between a linux and windows system?? It should be stated that both the Linux (CENTOS 5) and windows are physically located on the same computer. Is

floating point arithmetic

2008-08-26 Thread fred8865
Hi all, I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? thank you regards xtd -- http://mail.python.org/mailman/listinfo/python-list

RE: libxml2dom - parsing maligned html

2008-08-26 Thread bruce
hi paul... so you're the guy behind the libxml2dom ehh..!! glad to say hey! so this really is an issue with libxml2dom. ok, good, at least i know where the issue is. and yeah, i know the real issue is the fact that the html isn't valid!! shouldn't have multiple html trees... from what i can

Re: floating point arithmetic

2008-08-26 Thread Rob Clewley
I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. No, that's not the reason you get 1, it's because the current version of python does integer division by default. Try doing 180.0/100 or including from

Re: floating point arithmetic

2008-08-26 Thread Mensanator
On Aug 26, 4:11 pm, fred8865 [EMAIL PROTECTED] wrote: Hi all, I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? Try actually using

Re: floating point arithmetic

2008-08-26 Thread John Machin
On Aug 27, 7:11 am, fred8865 [EMAIL PROTECTED] wrote: I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. It's not hence. What you are seeing is truncating integer division. How can I tackle this

Adding Icons to my Programs

2008-08-26 Thread Kevin McKinley
I've been turn my script into executible programs with Py2exe. Is there a way to change the icon for the main exe file? Thank you, Kevin McKinley -- http://mail.python.org/mailman/listinfo/python-list

Python and database unittests

2008-08-26 Thread Daniel
Hello, I'm writing an application that interacts with a database. As I think about how to write the unittests, I want them to be able to run without actually having to access a live database. The pattern that best describes this is here: http://martinfowler.com/eaaCatalog/serviceStub.html I

RE: Using Python to shared memory resources between Linux and Windows

2008-08-26 Thread Blubaugh, David A.
Diez, What you have said is extremely concerning. I am now using VMware. With Linux as the Master and windows as the guest operating system. I was wondering if you have ever had to develop a share memory resource between Linux and windows within a Vmware setup? Thanks for the help. I

FW: Using Python to shared memory resources between Linux and Windows

2008-08-26 Thread Blubaugh, David A.
Diez, What you have said is extremely concerning. I am now using VMware. With Linux as the Master and windows as the guest operating system. I was wondering if you have ever had to develop a share memory resource between Linux and windows within a Vmware setup? Thanks for the help. It

Identifying the start of good data in a list

2008-08-26 Thread tkpmep
I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at least 4 consecutive non-zero data items (i.e. a week's worth of non-zero data). For example, if my

Re: What is class method?

2008-08-26 Thread Medardo Rodriguez (Merchise Group)
On Tue, Aug 26, 2008 at 4:10 PM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: In Python, there's *no* relationship between classmethods and metaclasses. In OOP the concept of meta-class has everything to do with class methods, regardless if is in Python, SmallTalk or CLOSS. classmethod decorator

Re: FW: Using Python to shared memory resources between Linux and Windows

2008-08-26 Thread Emile van Sebille
Blubaugh, David A. wrote: Diez, What you have said is extremely concerning. I am now using VMware. With Linux as the Master and windows as the guest operating system. I was wondering if you have ever had to develop a share memory resource between Linux and windows within a Vmware setup?

Re: Decorators using instance variables

2008-08-26 Thread Robert Kaplan
Bruno Desthuilliers a écrit : ... 2/ don't bother reading anything from someone named 'castironpi', it's one of our currently active resident troll, and he is worse than clueless. Actually, I found his response to the point, his sample code helpful, and his solution similar to yours.

Re: What is class method?

2008-08-26 Thread Raymond Hettinger
On Aug 24, 5:32 am, Hussein B [EMAIL PROTECTED] wrote: Hi, I'm familiar with static method concept, but what is the class method? how it does differ from static method? when to use it? I use them when I need alternative constructors for a class. class Angle(object): def __init__(self,

RE: Adding Icons to my Programs

2008-08-26 Thread Support Desk
-Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my script into executible programs with Py2exe. Is there a way to change the icon for the main exe

RE: Adding Icons to my Programs

2008-08-26 Thread Support Desk
Sincerely, Michael H. -Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my script into executible programs with Py2exe. Is there a way to change the

RE: Adding Icons to my Programs

2008-08-26 Thread Support Desk
Take a look at this: http://www.velocityreviews.com/forums/t332696-setting-icon-using-py2exe.html -Original Message- From: Kevin McKinley [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 4:37 PM To: python-list@python.org Subject: Adding Icons to my Programs I've been turn my

Re: Read dbf file as read only

2008-08-26 Thread Ricardo Aráoz
ajak_yahoo wrote: Hi, How can I access a foxpro dbf file from my python program. I just want to read it as a read only file. Regards, Check Paul McNett's article in FoxTalk Exploring Python from a Visual Foxpro Perspective and check the code in :

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread Christian Heimes
一首诗 wrote: Hi all, I read this interesting post comparing Boost.Python with Pyd: http://pyd.dsource.org/vsboost.html What's your opinion about it? What's your first choice when you have write a C/C++ module for Python? I'm using handwritten C code or Cython/Pyrex to create Python C

Re: Python and database unittests

2008-08-26 Thread gordyt
Daniel I don't know if it would work for your situation or not, but if you are using Python 2.5, you could use the now built-in sqlite3 module. If you didn't even want to create a temporary database file you could use the special memory-only syntax like this: import sqlite3 conn

Re: File copying from a menu

2008-08-26 Thread Brandon
Turns out I was missing a few lines of code here-and-there, but now it's visible and working. Thanks to anyone who was looking into this for me. Fredrik Lundh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Brandon wrote: I'm attempting to have a file copied from a menu

Creating environment variables.

2008-08-26 Thread aditya shukla
Hello folks, I am writing a program(prog 1) in python , which requires to know the path of another program(prog 2) in order to execute.I can get my prog1 to work when i hard code the path of the existing program(prog2).But since the path of prog could be anywhere on the file system , thus i

Re: smart quotes

2008-08-26 Thread Adrian Smith
On Aug 26, 4:13 pm, Peter Otten [EMAIL PROTECTED] wrote: Adrian Smith wrote: Can anyone tell me how to get rid of smart quotes in html using Python? I've tried variations on stuff = string.replace(stuff, \“, \), but to no avail, presumably because they're not standard ASCII. Convert the

Re: Identifying the start of good data in a list

2008-08-26 Thread bearophileHUGS
First solutions I have found, not much tested beside the few doctests: from itertools import islice def start_good1(alist, good_ones=4): Maybe more efficient for Python start_good = start_good1 start_good([0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 4 start_good([])

Re: logging - how to use in a library?

2008-08-26 Thread Ben Finney
Thomas Heller [EMAIL PROTECTED] writes: If the script using the library does NOT configure logging, and somewhere the library calls logger.error(...) or logger.critical(...) then he gets a message on stderr saying: No handlers could be found for logger foo Right. So, part of the

Re: Identifying the start of good data in a list

2008-08-26 Thread bearophileHUGS
Sorry, in the Psyco version replace this line: for i, el in enumerate(alist): With: for i in xrange(len(alist)): because Psyco doesn't digest enumerate well. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and database unittests

2008-08-26 Thread Daniel
Hey gordy, Thanks for the reply. I am actually using sqlite in part of my application and I don't feel the need to stub that. Even though I don't use the in memory option, it is still zero configuration so I build up my database in each test then delete it. However, the way I interact with the

SQL package

2008-08-26 Thread Juan
Hi I am trying to write a little a script that can be configurable. This script should access to a database, that can be of any type (MySQL, Postgres, SQLite, MS, etc).It has only to perform 2 or 3 simple plain SQL queries. Hi have tested SQLAlchemy, and it is great, but too much for my

Re: Identifying the start of good data in a list

2008-08-26 Thread Matthew Fitzgibbons
[EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at least 4 consecutive non-zero data items (i.e. a week's worth of non-zero

Re: Python LDAP

2008-08-26 Thread Juan
On 26 ago, 13:42, Michael Ströder [EMAIL PROTECTED] wrote: Juan wrote:     self.conn = ldap.initialize(self.host, self.port)   [..] LDAPError: (2, 'No such file or directory') You have to pass in a LDAP URI as documented

Re: floating point arithmetic

2008-08-26 Thread fred8865
thanks guys fred8865 wrote: Hi all, I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. How can I tackle this problem of inaccurate floating point numbers? thank you regards xtd --

Re: What is class method?

2008-08-26 Thread Matthew Fitzgibbons
Medardo Rodriguez (Merchise Group) wrote: On Tue, Aug 26, 2008 at 4:10 PM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: In Python, there's *no* relationship between classmethods and metaclasses. In OOP the concept of meta-class has everything to do with class methods, regardless if is in

Re: Identifying the start of good data in a list

2008-08-26 Thread Mensanator
On Aug 26, 4:49 pm, [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at  which the data turns good to be the first index with a non-zero entry that is followed by at least 4 consecutive non-zero data items (i.e. a

Re: Identifying the start of good data in a list

2008-08-26 Thread Emile van Sebille
[EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at least 4 consecutive non-zero data items (i.e. a week's worth of non-zero

Re: extract text from ods TableCell using odfpy

2008-08-26 Thread norseman
Ciaran Farrell wrote: 2008/8/26 norseman [EMAIL PROTECTED]: frankentux wrote: Ok. Sorted it out, but only after taking a round trip over xml.minidom. Here's the working code: #!/usr/bin/python from odf.opendocument import Spreadsheet from odf.opendocument import load from odf.table import

Re: Identifying the start of good data in a list

2008-08-26 Thread tdmj
On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at least 4 consecutive non-zero data items (i.e. a

've collected huge source codes collection of any kinds

2008-08-26 Thread Albertos
Hello, I've collected huge source codes collection of any kinds : work with text files, database, GUI etc. You can download it here http://freactor.com/get.php?file=Python+source+code -- http://mail.python.org/mailman/listinfo/python-list

Free huge source codes collection

2008-08-26 Thread Albertos
Hello, I've collected huge source codes collection of any kinds : work with text files, database, GUI etc. You can download it here http://freactor.com/get.php?file=Python -- http://mail.python.org/mailman/listinfo/python-list

Re: Return a string result with out breaking loop

2008-08-26 Thread Andrew
mmk guess I will have to look for alternate solutions for this project. Thank you all for your help cheers Andrew! Fredrik Lundh wrote: Andrew wrote: Yield returns the result I am looking for... however it does not continue looping. It does the same thing as return would the XML-RPC

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson
[EMAIL PROTECTED] wrote: check out Pyfdate: http://www.ferg.org/pyfdate from pyfdate import * t = Time().add(hours=14) print It is now, t.wdt datestring1 = 2005/10/05 #year,month,day datestring2 = 2002/09/22 #year,month,day datestring3 = 2007/11/11 #year,month,day year,month,day =

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread Terry Reedy
Lie wrote: Anyway, there is two obvious choice when dealing with dictionary looping: return the keys and return the key and value. The python designer thought... The issue of whether there should be a default iterator and if so, which of the two obvious choices should be picked, was

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread John Machin
On Aug 27, 10:21 am, W. eWatson [EMAIL PROTECTED] wrote: I'm using IDLE for Python 2.4, and put pfydate distribution in C:\Python24\Lib\site-packages\pfydate, as required by the ttp://www.ferg.org/pyfdate/download.html page. How to install pyfdate. Save pyfdate.py into your

Re: Micro-threading PEP proposal announcement

2008-08-26 Thread Terry Reedy
Pau Freixes wrote: When can I read this PEP ? I'm interesting I wanted to make everybody aware that I've posted a (rather long and involved) PEP proposal for adding micro-threading to Python on python-ideas for feedback and review. Python-ideas is another mailing list at

Re: Return a string result with out breaking loop

2008-08-26 Thread castironpi
On Aug 26, 11:46 am, Andrew [EMAIL PROTECTED] wrote: ...          results = change_handle          for action, files in results:              full_filename = os.path.join(path_to_watch, files)              theact = ACTIONS.get(action, Unknown)              out2 = str(full_filename) +   +

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson
John Machin wrote: On Aug 27, 10:21 am, W. eWatson [EMAIL PROTECTED] wrote: I'm using IDLE for Python 2.4, and put pfydate distribution in C:\Python24\Lib\site-packages\pfydate, as required by the ttp://www.ferg.org/pyfdate/download.html page. How to install pyfdate. Save pyfdate.py into

Environment variables

2008-08-26 Thread aditya shukla
Hello folks, How can i create environment variables using python? Aditya -- http://mail.python.org/mailman/listinfo/python-list

Re: Enhanced property decorator

2008-08-26 Thread Benjamin
On Aug 25, 9:00 pm, Daniel [EMAIL PROTECTED] wrote: On 25 Aug, 21:52, Benjamin [EMAIL PROTECTED] wrote: ... I think Python 2.6 may have want you want: class A(object):     @property     def my_prop(): return self._prop     @my_prop.setter     def my_prop(prop): self._prop = prop

Re: iterparse and unicode

2008-08-26 Thread George Sakkis
On Aug 25, 4:45 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: George Sakkis wrote: It depends on what you mean by compatible; e.g. you can't safely do [s.decode('utf8') for s in strings] if you have byte strings mixed with unicode. why would you want to decode strings given to you by a

Re: Python Strinh Immutability Broken!

2008-08-26 Thread Terry Reedy
Hendrik van Rooyen wrote: Terry Reedy: Which essentially is the bytearray type of 3.0. How does it differ from plain old array.array(b,”The quick brown fox”)? The typecode must be quoted as 'b'. In 3.0, strings become unicode, so an added b prefix is needed. import array a =

Memory Leak?

2008-08-26 Thread Kevin McKinley
So i've complete my first program with a GUI interface. I've noticed that everytime i click a tab or button the amount of memory the program takes up goes up by 50-200 kb. The program will start off at 4.5mb and by the time i'm done it can get up over 10 or 15 mb. The program will start

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread Benjamin Kaplan
On Tue, Aug 26, 2008 at 9:24 PM, W. eWatson [EMAIL PROTECTED] wrote: John Machin wrote: On Aug 27, 10:21 am, W. eWatson [EMAIL PROTECTED] wrote: I'm using IDLE for Python 2.4, and put pfydate distribution in C:\Python24\Lib\site-packages\pfydate, as required by the

Re: sum up numbers in a list

2008-08-26 Thread Terry Reedy
sharon kim wrote: is there a way to sum up all the numbers in a list? help(sum) sum(...) sum(iterable[, start]) - value Returns the sum of an iterable of numbers (NOT strings) plus the value of parameter 'start' (which defaults to 0). When the iterable is empty, returns

Re: Identifying the start of good data in a list

2008-08-26 Thread tkpmep
On Aug 26, 7:23 pm, Emile van Sebille [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at  which the data turns good to be the first index with a non-zero entry that is followed by at least

Re: floating point arithmetic

2008-08-26 Thread Terry Reedy
John Machin wrote: On Aug 27, 7:11 am, fred8865 [EMAIL PROTECTED] wrote: I understand that due to different arithmetic used in floating points they are just approximations. Hence, 180/100=1 in my python interpreter. It's not hence. What you are seeing is truncating integer division. How

Utah Open Source Conference, August 28-30

2008-08-26 Thread jazbees
Apologies if this is too regional and not of interest to the broader Python community, but I felt I should pass along the link to an event I stumbled across today: http://2008.utosc.com/pages/home/ Some talks on the schedule are either directly about Python (Vim and Python, Using Lasers,

Re: JSON from Python mysqldb

2008-08-26 Thread jpuopolo
On Aug 26, 3:15 pm, Larry Bates [EMAIL PROTECTED] wrote: jpuopolo wrote: All: I am using Python to read some records from the MySQL database. I am using the mysqldb library, and things are working well. Now, I would like to pass back the results of the query to a Web-based front end,

Re: Identifying the start of good data in a list

2008-08-26 Thread Terry Reedy
Matthew Fitzgibbons wrote: [EMAIL PROTECTED] wrote: reHist = [0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] count = 0 for i, d in enumerate(reHist): if d == 0: count = 0 else: count += 1 if count == 5: break else: raise Exception(No data found) reHist =

Re: Python and database unittests

2008-08-26 Thread alex23
Daniel [EMAIL PROTECTED] wrote: Does anyone know about a module that acts as a database stub for python unittests? It's not database-specific, but the Mock module should help you here: http://python-mock.sourceforge.net/ There's even an example on that page for mocking a database. --

Python + Mac Help

2008-08-26 Thread William Purcell
I am new to the Mac/OS X world. I am trying to get Python set up with Numpy, Scipy, Matplotlib, and wxPython. It seems that everything is working fine except Scipy. To explain my problem, it is probably best to see the following Simply trying to import Scipy...

Re: Python + Mac Help

2008-08-26 Thread William Purcell
FYI...I found the site that I installed from besides MacScience. I think that I have installed just about everything on this site. http://www.pythonmac.org/packages/py25-fat/index.html On Tue, Aug 26, 2008 at 10:05 PM, William Purcell [EMAIL PROTECTED] wrote: I am new to the Mac/OS X world. I

Re: Need help with extension modules built in debug mode

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 01:11:10 -0300, [EMAIL PROTECTED] escribi�: I've come to the conclusion that posting about Embedded Python on the Python forums is a complete waste of time. I hope I can get some useful insights here. I'm looking for some help with extension modules built using Visual

Re: Non-evil multithreaded WSGI server?

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 03:20:53 -0300, Gerhard Häring [EMAIL PROTECTED] escribi�: In a recent experiment I've done this: from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from wsgiref.simple_server import make_server, demo_app from SocketServer import ThreadingMixIn # Let's make a

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread Carl Banks
On Aug 26, 8:19 am, 一首诗 [EMAIL PROTECTED] wrote: What's your first choice when you have write a C/C++ module for Python? 1. Plain C code 2. Implement my own C extension code generator in Python 3. ctypes ... ... Infinity. SWIG Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python + Mac Help

2008-08-26 Thread Benjamin Kaplan
On Tue, Aug 26, 2008 at 11:07 PM, William Purcell [EMAIL PROTECTED] wrote: FYI...I found the site that I installed from besides MacScience. I think that I have installed just about everything on this site. http://www.pythonmac.org/packages/py25-fat/index.html On Tue, Aug 26, 2008 at 10:05

Re: Retrieve Win32 domain name

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 05:39:55 -0300, Salim Fadhley [EMAIL PROTECTED] escribi�: I'm looking for a method to retrieve a Windows Domain name (not a DNS Domain name). I know this can be done by simply reading an environment variable, however on the machines I need to work with sometimes the

Extracting path of a program from a list.

2008-08-26 Thread aditya shukla
Hello folks, I wanna know how can i extract path of a program whose path i have added to the PATH variable. This is what i have done import os x=os.getenv(PATH) print x %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Microsoft SQL

Re: Ctypes module - looking for a way to dynamically call exported function from a set of dlls

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 07:42:50 -0300, [EMAIL PROTECTED] escribi�: Hi, I'm using the ctypes module to load my dlls. I have some 10 dlls the names of those are passed to a fucntion which then loads the passed dll. Now every dll has a getversion function. eg: A.dll, B.dll, C.dll are the dlls and

Re: Setting my Locale

2008-08-26 Thread Gabriel Genellina
En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins [EMAIL PROTECTED] escribi�: I'm running python 2.5 on a Debian based system and I'm looking for your advice on how to set the locale for my application. I've read through the locale module documentation

<    1   2   3   >