Webware for Python 0.9 released

2005-11-14 Thread Christoph Zwerschke
Webware 0.9 has been released. Webware for Python is a suite of Python packages and tools for developing object-oriented, web-based applications. The suite uses well known design patterns and includes a fast Application Server, Servlets, Python Server Pages (PSP), Object-Relational Mapping,

ANN: PySizer 0.1

2005-11-14 Thread Nick Smallbone
I'd like to announce the first release of PySizer, a memory usage profiler for Python code. PySizer was written as part of Google's Summer of Code. The source, documentation and so on are at http://pysizer.8325.org. The current release is at http://pysizer.8325.org/dist/sizer-0.1.tar.gz. The code

SnakeCard GPL products

2005-11-14 Thread Philippe C. Martin
Dear all, I have decided to focus my activities on development and support. I have released SnakeCard's produt line source code under the GPL licence www.snakecard.com) It includes: SCF: SnakeCard Framework (software=Python) SCFB: SnaleCard Framework Bundle (software=Python, applets BasicCard

Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
MackS wrote: This program is meant to process relatively long strings (10-20 MB) by selectively modifying small chunks one at a time. ... Can I get over this performance problem without reimplementing the whole thing using a barebones list object? Is that a problem? Are you using string

Re: modifying small chunks from long string

2005-11-14 Thread Steven D'Aprano
Replying to myself... the first sign of madness *wink* Steven D'Aprano wrote: size = 1024*1024*20 # 20 MB original = A * size copy = [None] * size for i in range(size): copy[i] = original[i].lower() copy = ''.join(copy) Do you notice the premature optimization? Rather than

Re: Addressing the last element of a list

2005-11-14 Thread Antoon Pardon
Op 2005-11-10, Mike Meyer schreef [EMAIL PROTECTED]: [Context recovered from top posting.] [EMAIL PROTECTED] [EMAIL PROTECTED] writes: Daniel Crespo wrote: Well, I hope that newcomers to Python don't confuse himselves :) This mutable/immutable object and name/variable is confusing. Only if

Re: Addressing the last element of a list

2005-11-14 Thread Paul Rubin
Antoon Pardon [EMAIL PROTECTED] writes: We could then have something like the following. a = 5 b = a a @= 7 b == would result in 7. Ouch! :-((( Can't you live with a = [5] b = a a[0] = 7 so b[0] is now 7. -- http://mail.python.org/mailman/listinfo/python-list

Re: PySizer 0.1

2005-11-14 Thread Nick Smallbone
Claudio Grondi wrote: A small hint about the Web-site: At least to me, the links to the documentation as e.g. http://pysizer.8325.org/doc/auto/home/nick/sizer-trunk/doc/auto/scanner.html are broken (no big thing, because the distro has it anyway). Oops. That should be fixed now. --

Clone an object

2005-11-14 Thread Yves Glodt
Hello, how can I clone a class instance? I have trouble finding that in the documentation... thanks and best regards, Yves -- http://mail.python.org/mailman/listinfo/python-list

Re: Clone an object

2005-11-14 Thread [EMAIL PROTECTED]
http://docs.python.org/lib/module-copy.html I would assume you want deep/shallow copy. Yves Glodt wrote: Hello, how can I clone a class instance? I have trouble finding that in the documentation... thanks and best regards, Yves -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy/decimal interoperation

2005-11-14 Thread Nick Craig-Wood
Alex Martelli [EMAIL PROTECTED] wrote: As things stand now (gmpy 1.01), an instance d of decimal.Decimal cannot transparently become an instance of any of gmpy.{mpz, mpq, mpf}, nor vice versa (the conversions are all possible, but a bit laborious, e.g. by explicitly going through

HTTP Keep-Alive with urllib2

2005-11-14 Thread David Rasmussen
Someone once asked about this an got no answer: http://groups.google.dk/group/comp.lang.python/browse_frm/thread/c3cc0b8d7e9cbc2/ff11efce3b1776cf?lnk=stq=python+http+%22keep+alive%22rnum=84hl=da#ff11efce3b1776cf Maybe I am luckier :) Does anyone know how to do Keep-Alive with urllib2, that is,

Re: How to avoid f.close (no parens) bug?

2005-11-14 Thread Nick Craig-Wood
Peter [EMAIL PROTECTED] wrote: First off, please explain what you are talking about better next time. Second, What on earth are you talking about? f is a file object, correct? Are you trying to close a file by typing f.close or is the file closing when you type f.close? I would

Re: generate HTML

2005-11-14 Thread Richie Hindle
[ss2003] I am stuck at above after doing a lot of f.write for every line of HTML . Any betterways to do this in python? See the Templating Engines section of http://wiki.python.org/moin/WebProgramming - I hope you have a few hours to spare! 8-) -- Richie Hindle [EMAIL PROTECTED] --

generate HTML

2005-11-14 Thread s99999999s2003
hi i have fucntion that generates a HTML page def genpage(arg1,arg2): print ''' div align=rightfont size=-1BLAH BLAH.%s %s ''' % (arg1, arg2) print ''' table blah blah... %s %s /table''' % (arg1,arg2)' The func is something like that, alot of open''' and

Re: HOW do you stop a print???

2005-11-14 Thread Fredrik Lundh
john boy [EMAIL PROTECTED] wrote: ok...I am running the following program: def printMultiples (n): i = 1 while i = 6: print n*i, ' \t ', i = i + 1 i = 1 while i = 6: printMultiples(i) i = i + 1 this is supposed to return a simple multiplication

Re: circle and point

2005-11-14 Thread Ben Bush
is there any python code doing this: there are two line segments (2x+y-1=0 with the coordinates of two ending points are (1,-1) and (-1,3); x+y+6=0 with the coordinates of two ending points are (-3,-3) and (-4,-2);). They extend and when they meet each other, stop extending. how can i use python

Re: D foreach

2005-11-14 Thread Daniel Dittmar
[EMAIL PROTECTED] wrote: The Digital Mars D compiler is a kind of improved c++, it contains a foreach statement: http://www.digitalmars.com/d/statement.html#foreach Usage example: foreach(int i, inout int p; v1) p = i; Is equal to Python: for i in xrange(len(v)): v[i] = i [...] So the

extend

2005-11-14 Thread Ben Bush
is there any python code doing this: there are two line segments (2x+y-1=0 with the coordinates of two ending points are (1,-1) and (-1,3); x+y+6=0 with the coordinates of two ending points are (-3,-3) and (-4,-2);). They extend and when they meet each other, stop extending. how can i use python

Re: Addressing the last element of a list

2005-11-14 Thread Antoon Pardon
Op 2005-11-14, Paul Rubin schreef http: Antoon Pardon [EMAIL PROTECTED] writes: We could then have something like the following. a = 5 b = a a @= 7 b == would result in 7. Ouch! :-((( Can't you live with a = [5] b = a a[0] = 7 so b[0] is now 7. And what do I have to do, in case

Re: Dictionary of tuples from query question

2005-11-14 Thread Fredrik Lundh
David Pratt wrote: My code so far. I guess my problem is how to generate a tuple dynamically when it is immutable? you can use tuple() to convert lists to tuples. x = [] x.append(1) x.append(2) x.append(3) tuple(x) (1, 2, 3) but doesn't fetchall already returns

multiple inharitance super() question

2005-11-14 Thread Alex Greif
Hi, Before 2.2 I could initialize multiple super classes like this: class B(A,AA): def __init__(self, args): A.__init__(self,args) AA.__init__(self,args) Tutorials say that since python 2.2 superclasses should be initialized with the super() construct. class A(object):

Re: SciPy python 2.4 wintel binaries

2005-11-14 Thread jelle
Hi Peter, I'm aware of the Enthought distribution, which really is my preferred 2.3 Python distribution. Problem is that many programs I'm working on would require both 2.4 SciPy What kind of puzzles me is that SciPy.core is available for wintel 2.4, is that an indication a full SciPy

problem with from win32com.client import Dispatch

2005-11-14 Thread muttu2244
Hi all Am trying to read an html page using win32com in the following way. from win32com.client import Dispatch ie = Dispatch(InternetExplorer.Application) ie.Navigate(https://secure.authorize.net/;) doc =ie.Document print doc.body.innerHTML with this code am easily able to read the

compare list

2005-11-14 Thread Ben Bush
I have four lists: lisA=[1,2,3,4,5,6,9] lisB=[1,6,5] lisC=[5,6,3] lisD=[11,14,12,15]how can I write a function to compare lisB, lisC and lisD with lisA, if they share two continuous elements (the order does not matter), then return 1, otherwise return 0. For example, lisA, lisB and lisC have 5,6

problem with from win32com.client import Dispatch

2005-11-14 Thread Shivayogimath D.
Hi all Am trying to read an html page using win32com in the following way. from win32com.client import Dispatch ie = Dispatch(InternetExplorer.Application) ie.Navigate(https://secure.authorize.net/) doc =ie.Document print doc.body.innerHTML with this code am easily able to read

Re: Python obfuscation

2005-11-14 Thread Ben Sizer
Mike Meyer wrote: I have considered distributing my program as open source but with encrypted data. Unfortunately anyone can just read the source to determine the decryption method and password. Maybe I could put that into an extension module, but that just moves the weak link along the

Re: multiple inharitance super() question

2005-11-14 Thread Peter Otten
Alex Greif wrote: BUT what happens if B extends from A and AA like: class A(object): def __init__(self, args): ... class AA(object): def __init__(self, args): ... class B(A,AA): def __init__(self, args): super(B, self).__init__(args) How can I tell that B.__init__() should

Re: gmpy/decimal interoperation

2005-11-14 Thread Raymond L. Buvel
Alex Martelli wrote: As things stand now (gmpy 1.01), an instance d of decimal.Decimal cannot transparently become an instance of any of gmpy.{mpz, mpq, mpf}, nor vice versa (the conversions are all possible, but a bit laborious, e.g. by explicitly going through string-forms). I'm thinking

Re: want some python ide

2005-11-14 Thread alex . greif
Hi, look for SciTE http://www.scintilla.org/SciTE.html it is small, fast and lightweight Alex Greif http://www.fotobuch-xxl.de/ D H wrote: [EMAIL PROTECTED] wrote: i want some python ide use pygtk eric3 is good for me ,but i like gtk,so i want some

Re: mod_python web-dav management system

2005-11-14 Thread Damjan
Zope has WebDAV support and is written in Python. You could use Zope or perhaps use parts of it (since it is open source). I wouldn't use Zope as file storage. The ZODB is inefficient for storing big files. -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: extend

2005-11-14 Thread Chris Mellon
On 11/14/05, Ben Bush [EMAIL PROTECTED] wrote: is there any python code doing this: there are two line segments (2x+y-1=0 with the coordinates of two ending points are (1,-1) and (-1,3); x+y+6=0 with the coordinates of two ending points are (-3,-3) and (-4,-2);). They extend and when they

Re: SciPy python 2.4 wintel binaries

2005-11-14 Thread Claudio Grondi
Is http://heanet.dl.sourceforge.net/sourceforge/scipy/scipy-0.4.3.win32-py2.4.exe not what are you looking for? Claudio jelle [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi Peter, I'm aware of the Enthought distribution, which really is my preferred 2.3 Python

Re: Dictionary of tuples from query question

2005-11-14 Thread David Pratt
Hi Fredrik. Many thanks for your reply and for the tuple tip. The cursor.fetchall returns a list of lists in this instance with each list in the main list containing the field values. With the tip, I simplified my code to: vlist_dict = {} record_count = 0 for record in cursor.fetchall():

Re: Dictionary of tuples from query question

2005-11-14 Thread Ben Sizer
David Pratt wrote: With the tip, I simplified my code to: vlist_dict = {} record_count = 0 for record in cursor.fetchall(): record_count += 1 vlist_dict[record_count] = tuple(record) print vlist_dict I missed your original post, so forgive me if I'm missing the point here.

Re: Inserting Records into SQL Server - is there a faster interface than ADO

2005-11-14 Thread geskerrett
The utility is designed to run in the background and maintain/update a parallel copy of a production system database. We are using the stored procedure to do a If Exist, update, else Insert processing for each record. The originating database is a series of keyed ISAM files. So we need to read

Re: Python Book

2005-11-14 Thread Larry Bates
The ones that were best for me: -Python 2.1 Bible (Dave Brueck and Stephen Tanner) (dated but good to learn) -Python Cookbook (Alex Martelli, Anna Martelli Ravenscroft David Ascher) If you write for Windows: Python Programming on Win32 (Mark Hammond Andy Robinson) Larry Bates David

Re: gmpy/decimal interoperation

2005-11-14 Thread Alex Martelli
Raymond L. Buvel [EMAIL PROTECTED] wrote: ... This is a bit off topic but I would like to know how you would go about doing an implicit operation with an mpz and Decimal becoming a Decimal. I would tweak Decimal.__new__ to accept an mpz and perform an int() on it before proceeding as it does

Pregunta sobre python

2005-11-14 Thread Andres de la Cuadra
Hola, me llamo Andres de la cuadra, soy un usuario de python en chile y me gustaría saber como puedo cerrer un programa a través de python. Yo se que con la librería os puedo ejecutar programas, pero no e encontrado una librería para poder cerrarlos Gracias --

Re: Addressing the last element of a list

2005-11-14 Thread Mike Meyer
Antoon Pardon [EMAIL PROTECTED] writes: Op 2005-11-10, Mike Meyer schreef [EMAIL PROTECTED]: [Context recovered from top posting.] [EMAIL PROTECTED] [EMAIL PROTECTED] writes: Daniel Crespo wrote: Well, I hope that newcomers to Python don't confuse himselves :) This mutable/immutable object

Re: Inserting Records into SQL Server - is there a faster interface than ADO

2005-11-14 Thread Oren Tirosh
We are using the stored procedure to do a If Exist, update, else Insert processing for each record. Consider loading the data in batches into a temporary table and then use a single insert statement to insert new records and a single update statement to update existing ones. This way, you are

Re: Pregunta sobre python

2005-11-14 Thread Yves Glodt
Andres de la Cuadra wrote: Hola, me llamo Andres de la cuadra, soy un usuario de python en chile y me gustaría saber como puedo cerrer un programa a través de python. Yo se que con la librería os puedo ejecutar programas, pero no e encontrado una librería para poder cerrarlos Hola Andres,

Re: Addressing the last element of a list

2005-11-14 Thread Bengt Richter
On 14 Nov 2005 11:20:53 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: Op 2005-11-14, Paul Rubin schreef http: Antoon Pardon [EMAIL PROTECTED] writes: We could then have something like the following. a = 5 b = a a @= 7 b == would result in 7. Ouch! :-((( Can't you live with a = [5] b

Re: problem with from win32com.client import Dispatch

2005-11-14 Thread [EMAIL PROTECTED]
Hello, If you want some goood examples of reading Web pages and automating this process I have a class that wraps all these functions. http://pamie.sourceforge.net But for your problem: You are trying to read the page before it is completely loaded either add a wait function or a simple sleep

DB API specification of .rowcount and/or execute

2005-11-14 Thread andychambers2002
Hi, Should execute() be allowed to execute multiple operations? e.g. from dbi import * conn = connect(database=test) curs = conn.cursor() curs.execute( INSERT INTO test_table VALUES (1, 'one'); INSERT INTO test_table VALUES(2, 'two');

Re: Pregunta sobre python

2005-11-14 Thread Kevin Walzer
Yves Glodt wrote: puedes cerrer un programa con os.kill, pero depende de tu plataforma, por ejemplo en linux (no se para windows): os.kill(pid_del_proceso, 9) Y tambien, algunas platformas necesita el mandato sudo, como esto: os.system('echo su_contraseña | sudo -S kill pid') --

Re: Python Book

2005-11-14 Thread sjmsoft
David Rasmussen wrote: What is the best book for Python newbies (seasoned programmer in other languages)? /David A couple of years ago I was in the same boat you're in now. I learned from _Python in a Nutshell_ by Alex Martelli and still use it as my main reference. (It only covers up to

Re: CherryPy not playing nicely with win32com?

2005-11-14 Thread infidel
Just an idea: because in CherryPy it is running in multithreading mode? If you are using threads together with COM stuff, you will have to add pythoncom.CoInitialize() and pythoncom.CoUninitialize() calls in your code -- for each thread. That worked perfectly. Thanks a million! I used to

Re: DB API specification of .rowcount and/or execute

2005-11-14 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: Hi, Should execute() be allowed to execute multiple operations? [...] You best ask such questions on the DB-SIG. I say no and I think most people there will agree. Most DB-API modules will accept multiple statements, but that's an implementation artifact, and not

Re: generate HTML

2005-11-14 Thread Jeffrey Schwab
[EMAIL PROTECTED] wrote: hi i have fucntion that generates a HTML page def genpage(arg1,arg2): print ''' div align=rightfont size=-1BLAH BLAH.%s %s ''' % (arg1, arg2) print ''' table blah blah... %s %s /table''' % (arg1,arg2)' The func is something

RE: py2exe and pyGTK (was Error)

2005-11-14 Thread Jimmy Retzlaff
danger wrote: hi everybody, i have a problem with py2exe that gives me this error: ImportError: could not import pango ImportError: could not import pango Traceback (most recent call last): File acqua.py, line 40, in ? File gtk\__init__.pyc, line 113, in ? AttributeError: 'module'

Re: modifying small chunks from long string

2005-11-14 Thread Bengt Richter
On 13 Nov 2005 22:57:50 -0800, MackS [EMAIL PROTECTED] wrote: Hello everyone I am faced with the following problem. For the first time I've asked myself might this actually be easier to code in C rather than in python?, and I am not looking at device drivers. : ) This program is meant to

screen capture

2005-11-14 Thread py
I need to take a screen shot of the computer screen. I am trying to use PIL and I saw there is ImageGrab...however it only works on Windows. Is there a platform-independent ability to work around this? thanks -- http://mail.python.org/mailman/listinfo/python-list

ANN: rest2web 0.4.0alpha

2005-11-14 Thread Fuzzyman
rest2web 0.4.0 alpha is now available. http://www.voidspace.org.uk/python/rest2web/ What's New ? == See http://www.voidspace.org.uk/python/rest2web/reference/changelog.html#version-0-4-0-alpha-2005-11-11 Lots of bugfixes and new features since the 0.3.0 release. Includes a new gallery

Re: Proposal for adding symbols within Python

2005-11-14 Thread Pierre Barbier de Reuille
Ben Finney a écrit : Michael [EMAIL PROTECTED] wrote: Ben Finney wrote: I've yet to see a convincing argument against simply assigning values to names, then using those names. If you have a name, you can redefine a name, therefore the value a name refers to is mutable. Since there are

Re: Dictionary of tuples from query question

2005-11-14 Thread Fredrik Lundh
David Pratt wrote: Hi Fredrik. Many thanks for your reply and for the tuple tip. The cursor.fetchall returns a list of lists in this instance with each list in the main list containing the field values. With the tip, I simplified my code to: vlist_dict = {} record_count = 0 for record in

newbie help needed

2005-11-14 Thread john boy
I am running the following program: def print Multiples (n, high): i = 1 while i = high: print n*i, ' \t' , i = i + 1 print def printMultTable (high): i = 1 while i = high: print Multiples (i, high) i = i + 1 printMultiples(8,8) printMultTable(8) Basically this program prints the

How to write an API for a Python application?

2005-11-14 Thread Gary Kshepitzki
Hello I would like to create an API for a piece of Python code. The API is for use by non Python code. It should support interaction in both directions, both accessing functions on the API and the ability for the API to raise events on its clients. What is the best way to do that? I though

Webware for Python 0.9 released

2005-11-14 Thread Christoph Zwerschke
Webware 0.9 has been released. Webware for Python is a suite of Python packages and tools for developing object-oriented, web-based applications. The suite uses well known design patterns and includes a fast Application Server, Servlets, Python Server Pages (PSP), Object-Relational Mapping,

Re: Addressing the last element of a list

2005-11-14 Thread [EMAIL PROTECTED]
Bengt Richter wrote: You may be interested in reviewing http://groups.google.com/group/comp.lang.python/browse_thread/thread/f96b496b6ef14e2/32d3539e928986b3 before continuing this topic ;-) Interesting indeed, I mean the argument of why python does it this way. I see the equivalent

Re: newbie help needed

2005-11-14 Thread Fredrik Lundh
john boy [EMAIL PROTECTED] wrote: I am running the following program: def print Multiples (n, high): i = 1 while i = high: print n*i, ' \t' , i = i + 1 print def printMultTable (high): i = 1 while i = high: print Multiples (i, high)

mp3 wav editing in python

2005-11-14 Thread yb
Hi, Is there a python based tool to cut mp3 and wav file at a start and end time? I'm looking for a python script that can output a new wav or mp3 file based on star and endpoint. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Book

2005-11-14 Thread Magnus Lycka
David Rasmussen wrote: What is the best book for Python newbies (seasoned programmer in other languages)? I think most of the best books have been mentioned, but I thought that I'd add some comments. After all, different people have different ways of learning, and like different book styles.

Not enough arguments for format string

2005-11-14 Thread Kevin Walzer
I'm getting an error in a Python script I'm writing: not enough arguments for format string. The error comes at the end of the os.system command, referenced below. Any ideas? --- import EasyDialogs import os import sys password = EasyDialogs.AskPassword(To launch Ethereal, please enter your

Re: Not enough arguments for format string

2005-11-14 Thread johnnie pittman
Hey Kevin, I think I see your issue. So from http://docs.python.org/lib/typesseq-strings.html: If format requires a single argument, values may be a single non-tuple object. Otherwise, values must be a tuple with exactly the number of items specified by the format string, or a single mapping

Re: Not enough arguments for format string

2005-11-14 Thread James
Missing a comma there :) On 14/11/05, johnnie pittman [EMAIL PROTECTED] wrote: So the line above should be: os.system('open -a X11.app; cd ~/; printenv; DISPLAY=:0.0; export DISPLAY; echo %s | sudo -S %s; sudo -k' % (password binpath)) try that. os.system('open -a X11.app; cd ~/;

Re: Not enough arguments for format string

2005-11-14 Thread Pierre Barbier de Reuille
Kevin Walzer a écrit : I'm getting an error in a Python script I'm writing: not enough arguments for format string. The error comes at the end of the os.system command, referenced below. Any ideas? --- import EasyDialogs import os import sys password = EasyDialogs.AskPassword(To

replacing multiple instances of commas beginning at specific position

2005-11-14 Thread striker
I have a comma delimited text file that has multiple instances of multiple commas. Each file will contain approximatley 300 lines. For example: one, two, threefour,fivesix one, two, three,four,,eighteen, and so on. There is one time when multiple commas are allowed. Just

how do i use tkinter.createfilehandler with a regular c program?

2005-11-14 Thread Jo Schambach
I am trying to write a GUI with tkinter that displays the stdout from a regular C/C++ program in a text widget. The idea i was trying to use was as follows: 1) use popen to execute the C/C++ program 2) then use tkinter.createfilehandler to create a callback that would be called when the C/C++

SnakeCard products source code

2005-11-14 Thread Philippe C. Martin
Dear all, The source code is available in the download section: www.snakecard.com Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: modifying small chunks from long string

2005-11-14 Thread Tony Nelson
In article [EMAIL PROTECTED], MackS [EMAIL PROTECTED] wrote: Hello everyone I am faced with the following problem. For the first time I've asked myself might this actually be easier to code in C rather than in python?, and I am not looking at device drivers. : ) This program is meant to

Re: mp3 wav editing in python

2005-11-14 Thread Daniel Schüle
yb wrote: Hi, Is there a python based tool to cut mp3 and wav file at a start and end time? I'm looking for a python script that can output a new wav or mp3 file based on star and endpoint. Thank you there is a wave module import wave dir(wave) ['Chunk', 'Error',

Re: Addressing the last element of a list

2005-11-14 Thread Bengt Richter
On Mon, 14 Nov 2005 09:53:34 -0500, Mike Meyer [EMAIL PROTECTED] wrote: Antoon Pardon [EMAIL PROTECTED] writes: Op 2005-11-10, Mike Meyer schreef [EMAIL PROTECTED]: [Context recovered from top posting.] [EMAIL PROTECTED] [EMAIL PROTECTED] writes: Daniel Crespo wrote: Well, I hope that

Re: replacing multiple instances of commas beginning at specific position

2005-11-14 Thread Micah Elliott
On Nov 14, striker wrote: I have a comma delimited text file that has multiple instances of multiple commas. Each file will contain approximatley 300 lines. For example: one, two, threefour,fivesix one, two, three,four,,eighteen, and so on. There is one time when

Re: replacing multiple instances of commas beginning at specific position

2005-11-14 Thread bruno at modulix
striker wrote: I have a comma delimited text file that has multiple instances of multiple commas. Each file will contain approximatley 300 lines. For example: one, two, threefour,fivesix one, two, three,four,,eighteen, and so on. There is one time when multiple commas

Re: generate HTML

2005-11-14 Thread Scott David Daniels
Jeffrey Schwab wrote: [EMAIL PROTECTED] wrote: ... def genpage(arg1,arg2): print ''' div align=rightfont size=-1BLAH BLAH.%s %s ''' % (arg1, arg2) ... i wish to print all these into a HTML output file so that when i click on it, it shows me the html page. How can i do

Re: Dictionary of tuples from query question

2005-11-14 Thread David Pratt
Thanks Fredrik for your help. Really short and efficient - very nice! Regards, David On Monday, November 14, 2005, at 12:12 PM, Fredrik Lundh wrote: I meant to write d = {} for index, record in enumerate(cursor.fetchall()): d[index+1] = tuple(record) which can be shorted

Re: Proposal for adding symbols within Python

2005-11-14 Thread Rocco Moretti
Pierre Barbier de Reuille wrote: Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). I still don't see why you can't just use strings. The only two issues I see you might have with them are a) two identical strings might not be

more newbie help needed

2005-11-14 Thread john boy
using the following program: fruit = "banana" index = 0 while index len (fruit): letter = fruit[index-1] print letter index= index -1 this program is supposed to spell "banana" backwards and in a vertical patern...it does thisbut after spelling "banana" it gives an error message:

Making a persistent HTTP connection

2005-11-14 Thread David Rasmussen
I use urllib2 to do some simple HTTP communication with a web server. In one session, I do maybe 10-15 requests. It seems that urllib2 opens op a connection every time I do a request. Can I somehow make it use _one_ persistent connection where I can do multiple GET-receive data passes before

Tix BUG? Where to submit?

2005-11-14 Thread Ron
I've been developing a piece of software using Tix. In particular, I'm using the HList widget. I was attempting to use the info_bbox() mentod of that class to get the bounding box of a list entry. I'm using the release version Python 2.4.2. When I look in Tix.py I see that info_bbox() is

Re: more newbie help needed

2005-11-14 Thread Steve Holden
john boy wrote: using the following program: fruit = banana index = 0 while index len (fruit): letter = fruit[index-1] print letter index= index -1 this program is supposed to spell banana backwards and in a vertical patern...it does thisbut after spelling

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
john boy [EMAIL PROTECTED] wrote: using the following program: fruit = banana index = 0 while index len (fruit): letter = fruit[index-1] print letter index= index -1 after spelling banana it gives an error message: refering to line 4: letter = fruit[index-1] states

Re: more newbie help needed

2005-11-14 Thread Craig Marshall
Note, however, that there are more pythonic ways to perform this task. You might try: for index in range(len(fruit)): letter = fruit[-index-1] print letter Or, if you're *really* just trying to reverse the string, then the following might read more easily (although it's probably

Re: Python obfuscation

2005-11-14 Thread Mike Meyer
Ben Sizer [EMAIL PROTECTED] writes: It is? Is the Python disassembler so much advanced over the state of the art of binary disassemblers, then? Or maybe it's the Python decompilers that are so advanced? Decompyle (http://www.crazy-compilers.com/decompyle/ ) claims to be pretty advanced. I

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Steve Holden wrote: Note, however, that there are more pythonic ways to perform this task. You might try: for index in range(len(fruit)): letter = fruit[-index-1] print letter as one example. I'm sure other readers will have their own ways to do this, many of them more elegant.

Re: SnakeCard products source code

2005-11-14 Thread Kris
Thanks for sharing it. I am interested in the GINA part. Philippe C. Martin wrote: Dear all, The source code is available in the download section: www.snakecard.com Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: how do i use tkinter.createfilehandler with a regular c program?

2005-11-14 Thread jepler
Compared to your program, I * Made sure that the slave program actually flushed its stdout buffers * didn't call read(), which will by default continue reading until it reaches EOF, not merely read the available data #!/usr/bin/env python import sys, time, Tkinter, itertools, _tkinter, os

Re: Tix BUG? Where to submit?

2005-11-14 Thread jepler
Since this is a bug in Python (Tix.py), it should be submitted to the Python Patch tracker at sf.net/projects/python You need a free sourceforge account to submit an item to the bug or patch tracker. Jeff pgp1zmMFcYHrz.pgp Description: PGP signature --

q: console widgets for *nix and windows?

2005-11-14 Thread aum
Hi, Can anyone please recommend a widget library for text console, that works not only on *nix systems but windows /as well/? I'm looking for something a bit higher-level than pure curses, preferably with a gui-like set of widgets, event loop, handler methods etc. Thanks in advance for your

Re: q: console widgets for *nix and windows?

2005-11-14 Thread Grant Edwards
On 2005-11-14, aum [EMAIL PROTECTED] wrote: Can anyone please recommend a widget library for text console, that works not only on *nix systems but windows /as well/? I'm looking for something a bit higher-level than pure curses, preferably with a gui-like set of widgets, event loop, handler

Re: Proposal for adding symbols within Python

2005-11-14 Thread Reinhold Birkenfeld
Rocco Moretti wrote: Pierre Barbier de Reuille wrote: Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). I still don't see why you can't just use strings. As does Guido. Reinhold --

Re: how do i use tkinter.createfilehandler with a regular c program?

2005-11-14 Thread Jim Segrave
In article [EMAIL PROTECTED], Jo Schambach [EMAIL PROTECTED] wrote: I am trying to write a GUI with tkinter that displays the stdout from a regular C/C++ program in a text widget. The idea i was trying to use was as follows: 1) use popen to execute the C/C++ program 2) then use

Re: Proposal for adding symbols within Python

2005-11-14 Thread Ben Finney
Pierre Barbier de Reuille [EMAIL PROTECTED] wrote: The problem is not about having something constant ! The main point with symbols is to get human-readable values. Let say you have a symbol opened and a symbol closed. The state of a file may be one of the two. from some_enum_module

Re: how do i use tkinter.createfilehandler with a regular c program?

2005-11-14 Thread Jo Schambach
Thanks, that seems to work. maybe one more question on this subject: how can i use the callback function to the createfilehandler call from within a class? in other words, what would be the signature of the callback function, if I made it a member of a class? The documentation says that the

Re: Making a persistent HTTP connection

2005-11-14 Thread Diez B. Roggisch
David Rasmussen wrote: I use urllib2 to do some simple HTTP communication with a web server. In one session, I do maybe 10-15 requests. It seems that urllib2 opens op a connection every time I do a request. Can I somehow make it use _one_ persistent connection where I can do multiple

Re: Making a persistent HTTP connection

2005-11-14 Thread Benjamin Niemann
Diez B. Roggisch wrote: David Rasmussen wrote: I use urllib2 to do some simple HTTP communication with a web server. In one session, I do maybe 10-15 requests. It seems that urllib2 opens op a connection every time I do a request. Can I somehow make it use _one_ persistent connection where I

Parse file into array

2005-11-14 Thread amfr
I was wondering how i could parse the contents of a file into an array. the file would look something like this: gif:image/gif html:text/html jpg:image/jpeg ... As you can see, it contains the mime type and the file extension seperated by commas, 1 per line. I was wondering if it was possible

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Craig Marshall wrote: Or, if you're *really* just trying to reverse the string, then the following might read more easily (although it's probably longer): fruit = list(fruit) fruit.reverse() fruit = ''.join(fruit) same thing, on one line: fruit = .join(reversed(fruit)) same thing, in

Re: Proposal for adding symbols within Python

2005-11-14 Thread Steven D'Aprano
On Mon, 14 Nov 2005 17:15:04 +0100, Pierre Barbier de Reuille wrote: The problem is not about having something constant ! The main point with symbols is to get human-readable values. Let say you have a symbol opened and a symbol closed. The state of a file may be one of the two. If you

  1   2   >