Caching objects in a C extension

2010-01-08 Thread casevh
I'm working with a C extension that needs to rapidly create and delete objects. I came up with an approach to cache objects that are being deleted and resurrect them instead of creating new objects. It appears to work well but I'm afraid I may be missing something (besides heeding the warning in th

Re: Ask how to use HTMLParser

2010-01-08 Thread h0uk
On 8 янв, 11:44, Water Lin wrote: > h0uk writes: > > On 8 янв, 08:44, Water Lin wrote: > >> I am a new guy to use Python, but I want to parse a html page now. I > >> tried to use HTMLParse. Here is my sample code: > >> -- > >> from HTMLParser import HTMLParser > >> from urlli

Re: C Structure rebuild with ctypes

2010-01-08 Thread Georg
Hi Mark, > Are you passing in these values, or are they being returned? To me the > depth of the pointer references implies numVars, varNames, and varTypes > are out parameters. I'll assume that for now. If they are in/out > parameters let me know. If these parameters were in parameters. Wha

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Wed, Jan 6, 2010 at 2:19 PM, Victor Subervi wrote: > On Wed, Jan 6, 2010 at 3:09 PM, Carsten Haese wrote: > >> Victor Subervi wrote: >> > I have an automatically generated HTML form from which I need to extract >> > data to the script which this form calls (to which the information is >> > sent

multiprocessing and remote objects

2010-01-08 Thread Frank Millman
Hi all I am experimenting with the multiprocessing module, to get a feel of what is possible and what is not. I have got a situation that does not behave as expected. I can work around it, but I would like to find out the underlying reason, to get a more solid understanding. I am trying to cre

Standardized interpreter speed evaluation tool

2010-01-08 Thread alexru
Is there any standardized interpreter speed evaluation tool? Say I made few changes in interpreter code and want to know if those changes made python any better, which test should I use? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ask how to use HTMLParser

2010-01-08 Thread Dave Angel
Water Lin wrote: h0uk writes: On 8 янв, 08:44, Water Lin wrote: I am a new guy to use Python, but I want to parse a html page now. I tried to use HTMLParse. Here is my sample code: -- from HTMLParser import HTMLParser from urllib2 import urlopen class MyParser(HT

Re: How do I access what's in this module?

2010-01-08 Thread Fencer
On 2010-01-08 05:01, John Machin wrote: Error message should appear after line starting with "File". Above excerpt taken from google groups; identical to what shows in http://news.gmane.org/gmane.comp.python.general ... what are you looking at? With Windows XP and Python 2.5.4 I get: Traceback

Re: Standardized interpreter speed evaluation tool

2010-01-08 Thread Diez B. Roggisch
alexru schrieb: Is there any standardized interpreter speed evaluation tool? Say I made few changes in interpreter code and want to know if those changes made python any better, which test should I use? Pybench I guess. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Caching objects in a C extension

2010-01-08 Thread Diez B. Roggisch
casevh schrieb: I'm working with a C extension that needs to rapidly create and delete objects. I came up with an approach to cache objects that are being deleted and resurrect them instead of creating new objects. It appears to work well but I'm afraid I may be missing something (besides heeding

Re: Standardized interpreter speed evaluation tool

2010-01-08 Thread Dave Angel
alexru wrote: Is there any standardized interpreter speed evaluation tool? Say I made few changes in interpreter code and want to know if those changes made python any better, which test should I use? Not trying to be a smart-aleck, but the test you use should reflect your definition of the

Re: PyQt QThreadPool error

2010-01-08 Thread Phil Thompson
On Thu, 7 Jan 2010 15:07:10 -0800 (PST), h0uk wrote: ... > Phil you right about app.exec_(). But situation is sligthly different. > > I want to have more than one Job. I add these Jobs into QThreadPool > trough cycle. And I also want these Jobs to run sequentially. > > The following code illu

Transforming a List of elements into a List of lists of elements

2010-01-08 Thread tiago almeida
Hello all, I'd like to ask how you'd implement a function *f* that transforms a list of elements into a list of lists of elements by grouping contiguous elements together. Examples: a=[1,2,3,4,5] print( f(a, 2) ) # -> [ [1, 2], [3, 4], [5] ] print( f(a, 3) ) # -> [ [1, 2, 3], [4, 5] ] print(

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jan Kaliszewski
08-01-2010 tiago almeida wrote: Hello all, I'd like to ask how you'd implement a function *f* that transforms a list of elements into a list of lists of elements by grouping contiguous elements together. Examples: a=[1,2,3,4,5] print( f(a, 2) ) # -> [ [1, 2], [3, 4], [5] ] print( f(a, 3)

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jean-Michel Pichavant
tiago almeida wrote: Hello all, I'd like to ask how you'd implement a function /f/ that transforms a list of elements into a list of lists of elements by grouping contiguous elements together. Examples: a=[1,2,3,4,5] print( f(a, 2) ) # -> [ [1, 2], [3, 4], [5] ] print( f(a, 3) ) # -> [ [

Re: Transforming a List of elements into a List of lists of elements

2010-01-08 Thread Jan Kaliszewski
PS. Sorry, I wrote: >>> zip(*[iter(s)]*3) # or simpler: zip(s) :-) But should be >>> zip(*[iter(s)]*1) # or simpler: zip(s) :-) *j -- http://mail.python.org/mailman/listinfo/python-list

SQLObject 0.11.3

2010-01-08 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.11.3, a minor bugfix release of 0.11 branch of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

SQLObject 0.12.1

2010-01-08 Thread Oleg Broytman
Hello! I'm pleased to announce version 0.12.1, a bugfix release of branch 0.12 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to u

dtd validation on python 3.1 on Windows.

2010-01-08 Thread VYAS ASHISH M-NTB837
What is the best way to validate xmls against my dtd in python? I dont see minodom doing this. Sax has dtd validation, but does not complain on dtd violations. (it does access the dtd, if it does not find dtd it complains me.) I am using python 3.1 on Win32 machine. I was planning to try

Re: Need help to pass self.count to other classes.

2010-01-08 Thread Steve Holden
Steven D'Aprano wrote: [... points out my misapprehension ...] > kbi = kbInterface() sys.ps1 = kbi.prompt1 > 0xb7cbd52c>>print "Hello" > Hello > 0xb7cbd52c>> > Right, this is expert mode ... regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon is coming!

Re: How to execute a script from another script and other script does not do busy wait.

2010-01-08 Thread Jorgen Grahn
On Thu, 2010-01-07, danmcle...@yahoo.com wrote: > On Jan 7, 9:18 am, Jorgen Grahn wrote: >> On Thu, 2010-01-07, Rajat wrote: >> > I want to run a python script( aka script2) from another python script >> > (aka script1). While script1 executes script2 it waits for script2 to >> > complete and in d

Re: getfirst and re

2010-01-08 Thread Carsten Haese
Victor Subervi wrote: > Code snippet: > [...] > > Error: > [...] > What do? After eliminating the pieces of your post that have been copied or quoted from elsewhere, I am left with a total of five words of your own to ask this question, which seems to be approximately the same amount of effort yo

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 10:11 AM, Carsten Haese wrote: > Victor Subervi wrote: > > Code snippet: > > [...] > > > > Error: > > [...] > > What do? > > After eliminating the pieces of your post that have been copied or > quoted from elsewhere, I am left with a total of five words of your own > to ask

Re: Do I have to use threads?

2010-01-08 Thread Jorgen Grahn
On Wed, 2010-01-06, Gary Herron wrote: > aditya shukla wrote: >> Hello people, >> >> I have 5 directories corresponding 5 different urls .I want to >> download images from those urls and place them in the respective >> directories.I have to extract the contents and download them >> simultaneous

Re: Do I have to use threads?

2010-01-08 Thread r0g
Marco Salden wrote: > On Jan 6, 5:36 am, Philip Semanchuk wrote: >> On Jan 5, 2010, at 11:26 PM, aditya shukla wrote: >> >>> Hello people, >>> I have 5 directories corresponding 5 different urls .I want to >>> download >>> images from those urls and place them in the respective >>> directorie

Re: PIL show() not working for 2nd pic

2010-01-08 Thread McColgst
Do you get any errors or warnings? Could we see the code you ran to get this problem? Thanks Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: getfirst and re

2010-01-08 Thread Steve Holden
Victor Subervi wrote: > On Fri, Jan 8, 2010 at 10:11 AM, Carsten Haese > wrote: > > Victor Subervi wrote: > > Code snippet: > > [...] > > > > Error: > > [...] > > What do? > > After eliminating the pieces of your post that have been

Scripting (was Re: Python books, literature etc)

2010-01-08 Thread Jorgen Grahn
On Thu, 2010-01-07, Peter wrote: > [...] depending on your > application domain, I liked: > > 1) Hans Petter Langtangen: Python Scripting for Computational Science > A truly excellent book, not only with respect to Python Scripting , but > also on how to avoid paying license fees by using opens

Re: getfirst and re

2010-01-08 Thread Steve Holden
Victor Subervi wrote: [...] > TypeError: unsubscriptable object > args = ('unsubscriptable object',) > > Why is the value undefined? What is an unsubscriptable object? > TIA, > beno > Sorry, that wasn't very helpful. Here's some more advice: Google is you friend. Try Googling for component

C Module's '1.#INF' changes to 'inf' at Python

2010-01-08 Thread CELEN Erman
Hi All, My problem is that I've noticed a strange behavior in Python while handling FPEs on Windows after switching compilers (msvc8 to msvc9) and I am trying to find out how Python handles INF values to figure out where the problem might be. The problem appeared when we noticed that be

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Gabriel Genellina
En Thu, 07 Jan 2010 19:47:13 -0300, Mitchell L Model escribió: def dofile(filename): ldict = {'result': None} with open(filename) as file: exec(file.read(), globals(), ldict) print('Result for {}: {}'.format(filename, ldict['result'])) Next I call dof

Re: Recommended "new" way for config files

2010-01-08 Thread Jorgen Grahn
On Thu, 2010-01-07, Jean-Michel Pichavant wrote: > Peter wrote: >> Hi >> There seems to be several strategies to enhance the old ini-style >> config files with real python code, for example: ... >> Is there a strategy that should be prefered for new projects ? ... > The .ini file is the simpliest

Re: getfirst and re

2010-01-08 Thread Carsten Haese
Victor Subervi wrote: > First I get scolded for not including enough information. Now I get > scolded for including too much. Seems I can't win. I *am* putting effort > into understanding this. I'm sorry I'm not as sharp as you are in these > matters. I didn't scold you for including too much info

Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread J
On Fri, Jan 8, 2010 at 09:37, Jorgen Grahn wrote: > Regarding the book's title: is it just me, or are Python programmers > in general put off when people call it "scripting"? > > I won't attempt a strict definition of the term "scripting language", > but it seems like non-programmers use it to mea

Re: Recommended "new" way for config files

2010-01-08 Thread r0g
Chris Rebert wrote: > On Thu, Jan 7, 2010 at 10:19 AM, Peter wrote: > >>> The .ini file is the simpliest solution, at least from the user point of >>> view, no need to learn any python syntax. >> I am speaking from the point of view of a python programmer, and I find the >> .ini restrictions not

Re: Accessing python from a network share in windows 7

2010-01-08 Thread r0g
aj wrote: > On Jan 7, 3:51 pm, MRAB wrote: >> aj wrote: > It works without any issue on win7 if I copy python to my local drive. > Also, accessing python from the same network share works fine on win > XP. So I am suspecting some security policy of win7 that is causing > problem while accessing it

Re: C Module's '1.#INF' changes to 'inf' at Python

2010-01-08 Thread Robert Kern
On 2010-01-08 07:48 AM, CELEN Erman wrote: Hi All, My problem is that I’ve noticed a strange behavior in Python while handling FPEs on Windows after switching compilers (msvc8 to msvc9) and I am trying to find out how Python handles INF values to figure out where the problem might be. The probl

Re: getfirst and re

2010-01-08 Thread MRAB
Victor Subervi wrote: [snip] Code snippet: def cgiFieldStorageToDict(fieldStorage): params = {} for key in fieldStorage.keys(): params[key] = cgi.FieldStorage[key].value ^ This is your problem. return params [snip] -- http://mail.python.or

Manipulating pointers in C using ctypes

2010-01-08 Thread Daniel Platz
Hello! I have to ask a newbie question about manipulating pointers in C using ctypes. I have a C dll with two functions. The first one creates a pointer and returns it to python. The second one takes a pointer as an argument shows its address and the value at which it is pointing. This I have impl

Advanced Python Programming - March 8-12, 2010

2010-01-08 Thread Chander Ganesan
Looking to make the most of Python's advanced features? Then this is the class for you! The Open Technology Group's Advanced Python Programming course focuses on topics of interest to experienced Python programmers, and teaches you how to leverage advanced features and functionality of Python

restructuredText editor ?

2010-01-08 Thread Peter
What editor do people out there use to edit .rst files for sphinx-python documentation ? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: please help shrink this each_with_index() implementation

2010-01-08 Thread Roel Schroeven
Phlip schreef: > Nobody wrote: >> Writing robust software from the outset puts you at a competitive >> disadvantage to those who understand how the system works. > > And I, not my language, should pick and chose how to be rigorous. The > language > should not make the decision for me. You can a

Re: File transfer with python

2010-01-08 Thread Kamill Sokol
On Jan 6, 7:00 pm, Valentin de Pablo Fouce wrote: > Hi there, > > My intention is to transfer files from one > computer to another. > Hi Valentin, take a look at dropbox! Clients are available for mac, linux and windows. Up and running in just 2 minutes. http://dropbox.com Regards Kamill -- h

Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread MRAB
Jorgen Grahn wrote: On Thu, 2010-01-07, Peter wrote: [...] depending on your application domain, I liked: 1) Hans Petter Langtangen: Python Scripting for Computational Science A truly excellent book, not only with respect to Python Scripting , but also on how to avoid paying license fees by

Re: restructuredText editor ?

2010-01-08 Thread Diez B. Roggisch
Peter schrieb: What editor do people out there use to edit .rst files for sphinx-python documentation ? Emacs has a RST-mode (which unfortunately has some runtime-issues, the longer the text & the edit, the slower it gets), and together with flymake & rst2xml, you get nice error-notification

Re: Caching objects in a C extension

2010-01-08 Thread casevh
On Jan 8, 2:59 am, "Diez B. Roggisch" wrote: > casevh schrieb: > > > > > > > I'm working with a C extension that needs to rapidly create and delete > > objects. I came up with an approach to cache objects that are being > > deleted and resurrect them instead of creating new objects. It appears > >

Re: Caching objects in a C extension

2010-01-08 Thread Antoine Pitrou
Le Fri, 08 Jan 2010 08:39:17 -0800, casevh a écrit : > > Thanks for the reply. I realized that I missed one detail. The objects > are created by the extension but are deleted by Python. I don't know > that an object is no longer needed until its tp_dealloc is called. At > that point, its reference

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 7, 2010, at 10:45 PM, Steven D'Aprano > wrote an extensive answer to my questions about one function calling another in the same file being exec'd. His suggestion about printing out locals() and globals() in the various possible places provided the clues to explain what was going on.

Re: One function calling another defined in the same file being exec'd

2010-01-08 Thread Mitchell L Model
On Jan 8, 2010, at 9:55 AM, "Gabriel Genellina" p...@yahoo.com.ar> wrote: Ok - short answer or long answer? Short answer: Emulate how modules work. Make globals() same as locals(). (BTW, are you sure you want the file to run with the *same* globals as the caller? It sees the dofile() fun

Re: PyQt QThreadPool error

2010-01-08 Thread h0uk
On 8 янв, 16:27, Phil Thompson wrote: > On Thu, 7 Jan 2010 15:07:10 -0800 (PST), h0uk > wrote: > > ... > > > > > Phil you right about app.exec_(). But situation is sligthly different. > > > I want to have more than one Job. I add these Jobs into QThreadPool > > trough cycle. And I also want these

Re: Caching objects in a C extension

2010-01-08 Thread Diez B. Roggisch
casevh schrieb: On Jan 8, 2:59 am, "Diez B. Roggisch" wrote: casevh schrieb: I'm working with a C extension that needs to rapidly create and delete objects. I came up with an approach to cache objects that are being deleted and resurrect them instead of creating new objects. It appears to

Re: getfirst and re

2010-01-08 Thread Steve Holden
MRAB wrote: > Victor Subervi wrote: > [snip] >> >> Code snippet: >> >> def cgiFieldStorageToDict(fieldStorage): Further hint ... >> params = {} >> for key in fieldStorage.keys(): >> params[key] = cgi.FieldStorage[key].value > ^^

Re: Caching objects in a C extension

2010-01-08 Thread casevh
On Jan 8, 9:19 am, "Diez B. Roggisch" wrote: > casevh schrieb: > > > > > > > On Jan 8, 2:59 am, "Diez B. Roggisch" wrote: > >> casevh schrieb: > > >>> I'm working with a C extension that needs to rapidly create and delete > >>> objects. I came up with an approach to cache objects that are being >

monitor reading file with thread

2010-01-08 Thread wiso
I'm reading and processing a huge file, so during the execution I want to now the state of the processing: how many lines are already processed, and so on. The first approach is: f = open(filename) n = 0 for l in f: if n % 1000 = 0: print "Reading %d lines" %n do_something(l) but I want

table from csv file

2010-01-08 Thread marlowe
I am trying to create a table in python from a csv file where I input which columns I would like to see, and the table only shows those columns. I have attached an example of the csv file i am using, and some of the code I have written. I am having trouble converting variables between lists, dictio

Re: Need help to pass self.count to other classes.

2010-01-08 Thread Peter Otten
Steve Holden wrote: > Steven D'Aprano wrote: > [... points out my misapprehension ...] >> > kbi = kbInterface() > sys.ps1 = kbi.prompt1 >> > 0xb7cbd52c>>print "Hello" >> Hello >> > 0xb7cbd52c>> >> > Right, this is expert mode ... Here's a way to turn expert mode into something less adva

Re: Dynamic text color

2010-01-08 Thread Dave McCormick
On Wed, Jan 6, 2010 at 9:18 AM, John Posner wrote: > On Tue, 05 Jan 2010 16:54:44 -0500, Dave McCormick > wrote: > > But it is not what I am wanting. I first thought to make it look for a >> space but that would not work when a single character like "#" is to be >> colored if there is a "string

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden wrote: > MRAB wrote: > > Victor Subervi wrote: > > [snip] > >> > >> Code snippet: > >> > >> def cgiFieldStorageToDict(fieldStorage): > > Further hint ... > > >> params = {} > >> for key in fieldStorage.keys

Re: getfirst and re

2010-01-08 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > wrote: MRAB wrote: > Victor Subervi wrote: > [snip] >> >> Code snippet: >> >> def cgiFieldStorageToDict(fieldStorage): Fur

Re: Recommended "new" way for config files

2010-01-08 Thread Vinay Sajip
On Jan 7, 8:12 pm, Peter wrote: > > > > >> So what is the "worshipped" approach, when you need more than name=value > >> pairs ? > > > JSON is one option:http://docs.python.org/library/json.html > > Thanks, didn't think about that, although most of the apps I know don't > seem to use this approac

Re: table from csv file

2010-01-08 Thread Jon Clements
On Jan 8, 5:59 pm, marlowe wrote: > I am trying to create a table in python from a csv file where I input > which columns I would like to see, and the table only shows those > columns. I have attached an example of the csv file i am using, and > some of the code I have written. I am having trouble

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >>MRAB wrote: >>> Victor Subervi wrote: >>> [snip] >>>> >>>> Code snippet: >>>>

Re: Manipulating pointers in C using ctypes

2010-01-08 Thread Jason Scheirer
On Jan 8, 7:37 am, Daniel Platz wrote: > Hello! > > I have to ask a newbie question about manipulating pointers in C using > ctypes. I have a C dll with two functions. The first one creates a > pointer and returns it to python. The second one takes a pointer as an > argument shows its address and

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >>MRAB wrote: >>> Victor Subervi wrote: >>> [snip] >>>> >>>> Code snippet: >>>>

Mencoder not working from a python script

2010-01-08 Thread aditya shukla
Hello guys, I am trying to create a python script which uses mencoder to create videos from a set of images.When I am using the command(windows 7) i am able to generate the video properly.But when used within a python script i am ggetting error.Below is the code and error.any help is appreciated.

lightweight encryption of text file

2010-01-08 Thread Daniel Fetchinson
I have a plain text file which I would like to protect in a very simple minded, yet for my purposes sufficient, way. I'd like to encrypt/convert it into a binary file in such a way that possession of a password allows anyone to convert it back into the original text file while not possessing the pa

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:09 PM, Victor Subervi wrote: > > > On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant < > jeanmic...@sequans.com> wrote: > >> Victor Subervi wrote: >> >> On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden >> st...@holdenweb.com>> wrote: >>> >>>MRAB wrote: >>>> Victor

Re: getfirst and re

2010-01-08 Thread MRAB
Victor Subervi wrote: On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > wrote: MRAB wrote: > Victor Subervi wrote: > [snip] >> >> Code snippet: >> >> def cgiFieldStorageToDict(fieldStorage):

Re: Scripting (was Re: Python books, literature etc)

2010-01-08 Thread Peter
Sounds good. Regarding the book's title: is it just me, or are Python programmers in general put off when people call it "scripting"? I won't attempt a strict definition of the term "scripting language", but it seems like non-programmers use it to mean "less scary than what you might think of

Re: Dynamic text color

2010-01-08 Thread MRAB
Dave McCormick wrote: On Wed, Jan 6, 2010 at 9:18 AM, John Posner > wrote: On Tue, 05 Jan 2010 16:54:44 -0500, Dave McCormick mailto:mackrac...@gmail.com>> wrote: But it is not what I am wanting. I first thought to make it look for a space

Re: Recommended "new" way for config files

2010-01-08 Thread Peter
On 01/08/2010 03:57 PM, r0g wrote: Chris Rebert wrote: On Thu, Jan 7, 2010 at 10:19 AM, Peter wrote: The .ini file is the simpliest solution, at least from the user point of view, no need to learn any python syntax. I am speaking from the point of view of a python program

Another Screwy Problem

2010-01-08 Thread Victor Subervi
Hi; I have this line of code: sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid) which prints to this: select Name, Price from productsPackages where ID=1; which when I enter it into the MySQL interpreter gives me this: mysql> select Name, Price from productsPackages where ID=

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:21 PM, MRAB wrote: > Victor Subervi wrote: > > On Fri, Jan 8, 2010 at 1:26 PM, Steve Holden > st...@holdenweb.com>> wrote: >> >>MRAB wrote: >> > Victor Subervi wrote: >> > [snip] >> >> >> >> Code snippet: >> >> >> >> def cgiFieldStorageToDict(

Re: getfirst and re

2010-01-08 Thread MRAB
Victor Subervi wrote: On Fri, Jan 8, 2010 at 3:09 PM, Victor Subervi > wrote: On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant mailto:jeanmic...@sequans.com>> wrote: Victor Subervi wrote: On Fri, Jan 8, 2010 at 1:26 PM, Steve H

Re: lightweight encryption of text file

2010-01-08 Thread Robert Kern
On 2010-01-08 13:14 PM, Daniel Fetchinson wrote: I have a plain text file which I would like to protect in a very simple minded, yet for my purposes sufficient, way. I'd like to encrypt/convert it into a binary file in such a way that possession of a password allows anyone to convert it back into

Re: Dynamic text color

2010-01-08 Thread Dave McCormick
On Fri, Jan 8, 2010 at 12:28 PM, MRAB wrote: > Dave McCormick wrote: > >> >> >> On Wed, Jan 6, 2010 at 9:18 AM, John Posner > jjpos...@optimum.net>> wrote: >> >>On Tue, 05 Jan 2010 16:54:44 -0500, Dave McCormick >>mailto:mackrac...@gmail.com>> wrote: >> >>But it is not what I am w

Re: getfirst and re

2010-01-08 Thread Victor Subervi
On Fri, Jan 8, 2010 at 3:37 PM, MRAB wrote: > Victor Subervi wrote: > >> On Fri, Jan 8, 2010 at 3:09 PM, Victor Subervi >> > victorsube...@gmail.com>> wrote: >> >> >> >>On Fri, Jan 8, 2010 at 2:52 PM, Jean-Michel Pichavant >>mailto:jeanmic...@sequans.com>> wrote: >> >>Victor Sube

Re: asyncore based port splitter code questions

2010-01-08 Thread Giampaolo Rodola'
On 4 Gen, 18:58, George Trojan wrote: > asyncore based code is supposed to be simple, > but I need while loops and a lot of try/except clauses. First of all: you DON'T have to use while loops or anything which is blocking where by "blocking" I mean anything like time.sleep(). asyncore, just like

Re: PIL show() not working for 2nd pic

2010-01-08 Thread suresh.amritapuri
On Jan 8, 6:32 am, McColgst wrote: > Do you get any errors or warnings? > Could we see the code you ran to get this problem? > > Thanks > Sean I used to get no such file or directory showing some files in /tmp directory. But today I am getting a different type of message, which appeared yesterday

Re: table from csv file

2010-01-08 Thread J
On Fri, Jan 8, 2010 at 13:55, Jon Clements wrote: > On Jan 8, 5:59 pm, marlowe wrote: >> I am trying to create a table in python from a csv file where I input >> which columns I would like to see, and the table only shows those >> columns. I have attached an example of the csv file i am using, an

Re: Another Screwy Problem

2010-01-08 Thread Carsten Haese
Victor Subervi wrote: > Hi; > I have this line of code: > sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid) > which prints to this: > select Name, Price from productsPackages where ID=1; > which when I enter it into the MySQL interpreter gives me this: > mysql> select Name, P

24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
hi; I am trying to read 24bit signed WAV format (little endian) data from a WAV file and convert it to 32 bit little endian integer format ... can anybody please tell me how to do the conversion from 24 bit to 32 bit with a snippet of Python code ??? Thanks so much Robert Somerville -- http:/

Re: Threading change, 2.5.4 -> 2.6.1

2010-01-08 Thread Hans Mulder
anon wrote: Gib Bogle wrote: The code below runs with Python 2.5.4, but gives the following error messages with Python 2.6.1. What needs to be done to make it work? Thanks. C:\Summer09\Tutorials>python url_queue.pyw Traceback (most recent call last): File "url_queue.pyw", line 3, in import

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
On 2010-01-08, Robert Somerville wrote: > I am trying to read 24bit signed WAV format (little endian) data from a > WAV file and convert it to 32 bit little endian integer format ... can > anybody please tell me how to do the conversion from 24 bit to 32 bit > with a snippet of Python code ???

Re: Dynamic text color

2010-01-08 Thread John Posner
On Fri, 08 Jan 2010 14:28:57 -0500, MRAB wrote: Dave McCormick wrote: On Wed, Jan 6, 2010 at 9:18 AM, John Posner > wrote: On Tue, 05 Jan 2010 16:54:44 -0500, Dave McCormick mailto:mackrac...@gmail.com>> wrote: But it is not what I am wanting.

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Irmen de Jong
On 8-1-2010 22:12, Robert Somerville wrote: hi; I am trying to read 24bit signed WAV format (little endian) data from a WAV file and convert it to 32 bit little endian integer format ... can anybody please tell me how to do the conversion from 24 bit to 32 bit with a snippet of Python code ??? T

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
On 2010-01-08, Grant Edwards wrote: > On 2010-01-08, Robert Somerville wrote: > >> I am trying to read 24bit signed WAV format (little endian) data from a >> WAV file and convert it to 32 bit little endian integer format ... can >> anybody please tell me how to do the conversion from 24 bit to

Re: lightweight encryption of text file

2010-01-08 Thread Daniel Fetchinson
>> I have a plain text file which I would like to protect in a very >> simple minded, yet for my purposes sufficient, way. I'd like to >> encrypt/convert it into a binary file in such a way that possession of >> a password allows anyone to convert it back into the original text >> file while not po

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
On 2010-01-08, Irmen de Jong wrote: > On 8-1-2010 22:12, Robert Somerville wrote: >> hi; >> I am trying to read 24bit signed WAV format (little endian) data from a >> WAV file and convert it to 32 bit little endian integer format ... can >> anybody please tell me how to do the conversion from 24 b

PIL how to display multiple images side by side

2010-01-08 Thread suresh.amritapuri
Hi, In PIL, how to display multiple images in say m rows and n colums when I have m*n images. suresh -- http://mail.python.org/mailman/listinfo/python-list

Re: lightweight encryption of text file

2010-01-08 Thread Daniel Fetchinson
>>> I have a plain text file which I would like to protect in a very >>> simple minded, yet for my purposes sufficient, way. I'd like to >>> encrypt/convert it into a binary file in such a way that possession of >>> a password allows anyone to convert it back into the original text >>> file while n

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Irmen de Jong
On 8-1-2010 22:37, Grant Edwards wrote: On 2010-01-08, Irmen de Jong wrote: Are you using the standard wave module? I guess that will produce a string of 3-byte audio frames with readframes(). Won't it work to chop this up in individual 3-byte frames, then appending a '\0' char to every frame,

Re: Another Screwy Problem

2010-01-08 Thread J. Clifford Dyer
Victor Subervi wrote: > Hi; > I have this line of code: > sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid) > which prints to this: > select Name, Price from productsPackages where ID=1; > which when I enter it into the MySQL interpreter gives me this: > mysql> select Name, P

Re: Another Screwy Problem

2010-01-08 Thread J. Clifford Dyer
On Fri, Jan 08, 2010 at 03:32:34PM -0400, Victor Subervi wrote regarding Another Screwy Problem: > Date: Fri, 8 Jan 2010 15:32:34 -0400 > From: Victor Subervi > To: python-list > Subject: Another Screwy Problem > >Hi; >I have this line of code: > sql = 'select Name, Price from %sPac

Re: lightweight encryption of text file

2010-01-08 Thread Irmen de Jong
On 8-1-2010 22:39, Daniel Fetchinson wrote: http://www.nightsong.com/phr/crypto/p3.py Thanks a lot, currently I'm having trouble using this code on python 2.6 but probably some small tweaking will fix it. If you keep having issues with this module, maybe you can try this: http://www.fre

Re: lightweight encryption of text file

2010-01-08 Thread Robert Kern
On 2010-01-08 15:47 PM, Daniel Fetchinson wrote: I have a plain text file which I would like to protect in a very simple minded, yet for my purposes sufficient, way. I'd like to encrypt/convert it into a binary file in such a way that possession of a password allows anyone to convert it back into

24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
thanks Grant, your sext24 function does the trick (this Python newbie thanks you a lot ...) so i loop on d=wave.readframes(1)   call dd=sext24(d) on the frame read , then   unpack(dd)  the output of sext24 into a 32bit integer (seems to do the trick correctly for signed 24 bit integers ..

Re: Dynamic text color

2010-01-08 Thread Dave McCormick
John Posner wrote: On Fri, 08 Jan 2010 14:28:57 -0500, MRAB wrote: The regex r'\bgreenList_regexp\b' will match the string 'greenList_regexp' if it's a whole word. What you mean is "any of these words, provided that they're whole words". You'll need to group the alternatives within "(?:...

Re: lightweight encryption of text file

2010-01-08 Thread Chris Colbert
PyCrypto is already pretty easy to use by itself. I dont know why you want a wrapper on top of it. On Fri, Jan 8, 2010 at 11:02 PM, Irmen de Jong wrote: > On 8-1-2010 22:39, Daniel Fetchinson wrote: > >> >>>http://www.nightsong.com/phr/crypto/p3.py >>> >> >> Thanks a lot, currently I'm having

24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
thanks Grant, your sext24 function does the trick (this Python newbie thanks you a lot ...) so i loop on d=wave.readframes(1) call dd=sext24(d) on the frame read , then ddd=struct.unpack("<%ul" % 1 ,dd) unpack(dd) the output of sext24 into a 32bit integer (seems to do the trick correctly f

  1   2   >