Re: how to format a python source file with tools?

2009-11-26 Thread cmptrwhz
On Nov 27, 12:40 am, 李白,字一日 wrote: > or is it possible for large source files? are you trying to format the file with the proper indentations? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to format a python source file with tools?

2009-11-26 Thread Ben Finney
李白,字一日 writes: > or is it possible for large source files? Is what possible? What do you want the tool to do? -- \ “I do not believe in forgiveness as it is preached by the | `\church. We do not need the forgiveness of God, but of each | _o__)other and

how to format a python source file with tools?

2009-11-26 Thread 李白,字一日
or is it possible for large source files? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-26 Thread n00m
On Nov 27, 5:24 am, astral orange <457r0...@gmail.com> wrote: [skip] How about the next problem: you are given string "s" (len(s) <= ~1), in the string only letters 'a'..'z' Task: to count the number of all *different* substrings of "s" Example: s = 'abbaz' Its different substrings are: a b z

extending optionparser to accept multiple comma delimited input for one arg

2009-11-26 Thread cmptrwhz
I have read the manual first of all :). on using optionparser for the input of command line arguments and inputs. I understand everything there was in the manual except how to extend the parser to accept a multiple list of input that is comma delimited for example: ./convertContacts3.py -i

Re: Python Programming Challenges for beginners?

2009-11-26 Thread alex23
On Nov 27, 1:24 pm, astral orange <457r0...@gmail.com> wrote: > I would like to test out what I know so far by solving programming > challenges. Project Euler can be a lot of fun: http://projecteuler.net/ -- http://mail.python.org/mailman/listinfo/python-list

Python Programming Challenges for beginners?

2009-11-26 Thread astral orange
Hi- I am reading the online tutorial along with a book I bought on Python. I would like to test out what I know so far by solving programming challenges. Similar to what O'Reilly Learning Perl has. I really enjoyed the challenges at the end of the chapter and it really help me test out if I was tr

Re: Using struct to read binary files

2009-11-26 Thread Tim Chase
f = open("/tmp/mbrcontent", "rb") contents = f.read() f.close() firstSectorAddress = contents[454:458] numSectors = contents[458:462]

Re: Using struct to read binary files

2009-11-26 Thread Gabriel Genellina
En Thu, 26 Nov 2009 22:59:29 -0300, mercado escribió: Hello, I am writing a Python program to read the Master Boot Record (MBR), and I'm having trouble because I have no previous experience reading binary files. First off, I've written a binary file containing the MBR to disk using the foll

Re: High-performance Python websites

2009-11-26 Thread Luis M . González
On Nov 25, 4:24 pm, Nick Mellor wrote: > Hi all, > > I'm contemplating setting up a Python-powered website for the tourist > industry, which will involve a web service, a good deal of XML > processing, and a Django-powered front-end. If the project works, it > could get a lot of traffic. I'm sure

Re: Feature request: String-inferred names

2009-11-26 Thread Gabriel Genellina
En Thu, 26 Nov 2009 20:43:04 -0300, The Music Guy escribió: Nonetheless, the fact remains that the feature I'm proposing closely resembles one that has already been rejected... Well, it's been a few years since then. Maybe its about time for another PEP to be proposed? You'll have to wait a

Re: High-performance Python websites

2009-11-26 Thread Nick Mellor
On Nov 27, 3:26 am, Bruno Desthuilliers wrote: > Nick Mellor a écrit : > > > Hi all, > > > I'm contemplating setting up a Python-powered website for the tourist > > industry, which will involve a web service, a good deal of XML > > processing, and a Django-powered front-end. If the project works,

Using struct to read binary files

2009-11-26 Thread mercado
Hello, I am writing a Python program to read the Master Boot Record (MBR), and I'm having trouble because I have no previous experience reading binary files. First off, I've written a binary file containing the MBR to disk using the following command: sudo dd if=/dev/sda of=/tmp/mbrcontent bs=1 c

Re: Feature request: String-inferred names

2009-11-26 Thread Gregory Ewing
The Music Guy wrote: As for it not being useful enough to justify new syntax, well, I think Ben showed pretty well that it actually is. Approximately 600 uses of the get*r functions were used in the Python 2.5 standard library alone. The standard library isn't necessarily representative of Pyt

Re: Feature request: String-inferred names

2009-11-26 Thread Cameron Simpson
On 25Nov2009 21:45, Brad wrote: | On Nov 25, 10:49 pm, Chris Rebert wrote: | > On Wed, Nov 25, 2009 at 6:35 PM, The Music Guy | > wrote: | > > I just posted to my blog about a feature that I'd like to see added to | > > Python. Before I go through the trouble of learning how to write a PEP or |

Re: Feature request: String-inferred names

2009-11-26 Thread Ben Finney
The Music Guy writes: > Nonetheless, the fact remains that the feature I'm proposing closely > resembles one that has already been rejected... Well, it's been a few > years since then. The passage of time is insufficient. The idea also needs to have greater merit now than before. You haven't dem

Re: Feature request: String-inferred names

2009-11-26 Thread John Machin
On Nov 27, 10:43 am, The Music Guy wrote: [snip] > Nonetheless, the fact remains that the feature I'm proposing closely > resembles one that has already been rejected... Well, it's been a few > years since then. Maybe its about time for another PEP to be proposed? Judging by the response you've

Re: Feature request: String-inferred names

2009-11-26 Thread The Music Guy
On Nov 26, 12:30 am, "Gabriel Genellina" wrote: > En Wed, 25 Nov 2009 23:35:06 -0300, The Music Guy   > escribió: > > > I just posted to my blog about a feature that I'd like to see added to > > Python. Before I go through the trouble of learning how to write a PEP or > > how to extend the Python

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 2:12 PM, MRAB wrote: > Victor Subervi wrote: > >> On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi >> > victorsube...@gmail.com>> wrote: >> >>On Thu, Nov 26, 2009 at 11:52 AM, MRAB >> wrote: >> >>Victor Subervi wrote: >> >

Re: string payload expected: error

2009-11-26 Thread Lie Ryan
Ramdas wrote: Dear all, I believe this is an error which was fixed in Python 2.3 itself. But I am running Python 2,5.2 and error keeps on cropping up. Here is my code to construct emails . It works perfectly when I dont have any attachments. Please find my code at http://dpaste.com/hold/125574

ANN: StreamHarvester-0.1 Beta

2009-11-26 Thread Godson Gera
StreamHarvester is built using python. StreamHarvester is a cross-platform internet radio and TV recoder.StreamHarverster works with Shoutcast and Icecast streams. You can record multiple streams simultaneously, also you can relay a stream locally while recording it. So that you can listen to the

win32com calling IE: OLE error 0x800704a6

2009-11-26 Thread KvS
Dear all, I have written a Python script that runs on Windows XP with Python 2.5 and uses Internet Explorer to 'pretty print' some HTML output. This has been working perfectly fine for a few years until recently IE was upgraded to version 8. Now occasionally Python throws an error that originates

Re: string payload expected: error

2009-11-26 Thread Ramdas
On Nov 27, 1:33 am, MRAB wrote: > Ramdas wrote: > > Dear all, > > > I believe this is an error which was fixed in Python 2.3 itself. But I > > am running Python 2,5.2 and error keeps on cropping up. > > > Here is my code to construct emails . It works perfectly when I dont > > have any attachments

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread MRAB
Grant Edwards wrote: On 2009-11-26, Jean-Michel Pichavant wrote: Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code

Re: string payload expected: error

2009-11-26 Thread MRAB
Ramdas wrote: Dear all, I believe this is an error which was fixed in Python 2.3 itself. But I am running Python 2,5.2 and error keeps on cropping up. Here is my code to construct emails . It works perfectly when I dont have any attachments. Please find my code at http://dpaste.com/hold/125574

string payload expected: error

2009-11-26 Thread Ramdas
Dear all, I believe this is an error which was fixed in Python 2.3 itself. But I am running Python 2,5.2 and error keeps on cropping up. Here is my code to construct emails . It works perfectly when I dont have any attachments. Please find my code at http://dpaste.com/hold/125574/ However when

Re: Buffered streaming

2009-11-26 Thread Dave Angel
Ken Seehart wrote: I need to create a pipe where I have one thread (or maybe a generator) writing data to the tail while another python object is reading from the head. This will run in real time, so the data must be deallocated after it is consumed. Reading should block until data is writt

Re: python bijection

2009-11-26 Thread Joshua Bronson
On Nov 24, 10:28 pm, Joshua Bronson wrote: > bidict it is! now available at http://bitbucket.org/jab/toys/src/tip/bidict.py and now featuring new shiny namedbidict goodness! as always, feedback welcome. josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Encode Pic

2009-11-26 Thread MRAB
Victor Subervi wrote: On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi > wrote: On Thu, Nov 26, 2009 at 11:52 AM, MRAB mailto:pyt...@mrabarnett.plus.com>> wrote: Victor Subervi wrote: On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Grant Edwards
On 2009-11-26, Jean-Michel Pichavant wrote: > Peng Yu wrote: >> There are some assertion code (testing if a condition is false, if it >> is false, raise an Error object) in my python, which is useful when I >> test my package. But such case would never occur when in the produce >> code. If I keep

Re: Can't Encode Pic

2009-11-26 Thread Carsten Haese
Victor Subervi wrote: > Hang on. Not done yet. The line of code I gave you was just a test case. > The real ones, and the error they threw, follows: > [...] >73 cursor.execute(sql, (MySQLdb.Binary(pics[id]),)) > [...] > > TypeError: list indices must be integers > args = ('list i

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi wrote: > On Thu, Nov 26, 2009 at 11:52 AM, MRAB wrote: > >> Victor Subervi wrote: >> >>> On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese >>> >> carsten.ha...@gmail.com>> wrote: >>> >>>cursor.execute('update products set pic1=%s where ID=1', >>>

Re: Buffered streaming

2009-11-26 Thread Terry Reedy
Ken Seehart wrote: I need to create a pipe where I have one thread (or maybe a generator) writing data to the tail while another python object is reading from the head. This will run in real time, so the data must be deallocated after it is consumed. CPython does that when last reference di

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Lie Ryan
Jean-Michel Pichavant wrote: Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code. If I keep them in if statement, it w

Re: Feature request: String-inferred names

2009-11-26 Thread Terry Reedy
Gregory Ewing wrote: On Wed, 25 Nov 2009 20:44:36 -0600, The Music Guy declaimed the following in gmane.comp.python.general: I just posted to my blog about a feature that I'd like to see added to Python. http://alphaios.blogspot.com/2009/11/python-string-inferred-names-working.html I don'

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 11:52 AM, MRAB wrote: > Victor Subervi wrote: > >> On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese >> > carsten.ha...@gmail.com>> wrote: >> >>cursor.execute('update products set pic1=%s where ID=1', >>(MySQLdb.Binary(pic1),)) >> >>[That comma between the two c

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Jean-Michel Pichavant
Peng Yu wrote: There are some assertion code (testing if a condition is false, if it is false, raise an Error object) in my python, which is useful when I test my package. But such case would never occur when in the produce code. If I keep them in if statement, it will take some runtime. I'm won

Buffered streaming

2009-11-26 Thread Ken Seehart
I need to create a pipe where I have one thread (or maybe a generator) writing data to the tail while another python object is reading from the head. This will run in real time, so the data must be deallocated after it is consumed. Reading should block until data is written, and writing shoul

Re: JTAG/Debugging

2009-11-26 Thread pepe
On Nov 26, 4:32 pm, Dietmar Schwertberger wrote: > Dietmar Schwertberger schrieb:> pepe schrieb: > >> is there any python package which potentially can support JTAG (BDM or > >> others) debugging interface for embedded system development? > >> Is there any other packages supporting debugging, moni

Re: JTAG/Debugging

2009-11-26 Thread pepe
On Nov 26, 5:56 pm, Grant Edwards wrote: > On 2009-11-26, pepe wrote: > > > is there any python package which potentially can support JTAG > > (BDM or others) debugging interface for embedded system > > development? > > Yes. > > > Is there any other packages supporting debugging, monitoring, > >

Re: Anything equivalent to cassert in C++?

2009-11-26 Thread Aahz
In article , Peng Yu wrote: > >There are some assertion code (testing if a condition is false, if it >is false, raise an Error object) in my python, which is useful when I >test my package. But such case would never occur when in the produce >code. If I keep them in if statement, it will take so

Re: How do I correctly download Wikipedia pages?

2009-11-26 Thread Cousin Stanley
> I'm trying to scrape a Wikipedia page from Python. > On occasion I use a program under Debian Linux called wikipedia2text that is very handy for downloading wikipedia pages as plain text files Description: displays Wikipedia articles on the command line This scrip

Re: reposition a column

2009-11-26 Thread MRAB
Francesco Pietra wrote: Hi: script now used: # Sample line # Slice indexes cut to the left of the corresponding item index # 1 2 3 4 5 6 # 012345678901234567890123456789012345678901234567890123456789012345 ... # ATOM 1 W W 1

Re: JTAG/Debugging

2009-11-26 Thread Grant Edwards
On 2009-11-26, pepe wrote: > is there any python package which potentially can support JTAG > (BDM or others) debugging interface for embedded system > development? Yes. > Is there any other packages supporting debugging, monitoring, > data logging, flash programming of embedded systems? Yes.

Re: Can't Encode Pic

2009-11-26 Thread MRAB
Victor Subervi wrote: On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese > wrote: cursor.execute('update products set pic1=%s where ID=1', (MySQLdb.Binary(pic1),)) [That comma between the two closing parentheses is not a typo. Do not leave it out!]

Re: Can "self" crush itself?

2009-11-26 Thread Aahz
In article <7ace3de0-4588-4b7d-9848-d97298717...@z41g2000yqz.googlegroups.com>, n00m wrote: >> Or just raise an exception in __init__(),.. > >Then we are forced to handle this exception outside of class code. Absolutely! That's the whole point. If you can't construct the class, you *should* ra

Re: High-performance Python websites

2009-11-26 Thread Bruno Desthuilliers
Nick Mellor a écrit : Hi all, I'm contemplating setting up a Python-powered website for the tourist industry, which will involve a web service, a good deal of XML processing, and a Django-powered front-end. If the project works, it could get a lot of traffic. I'm sure it can be done, but I'm loo

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese wrote: > cursor.execute('update products set pic1=%s where ID=1', > (MySQLdb.Binary(pic1),)) > > [That comma between the two closing parentheses is not a typo. Do not > leave it out!] > A problem occurred in a Python script. Here is the sequence of

Re: JTAG/Debugging

2009-11-26 Thread Dietmar Schwertberger
Dietmar Schwertberger schrieb: pepe schrieb: is there any python package which potentially can support JTAG (BDM or others) debugging interface for embedded system development? Is there any other packages supporting debugging, monitoring, data logging, flash programming of embedded systems? Do

Re: JTAG/Debugging

2009-11-26 Thread Dietmar Schwertberger
pepe schrieb: is there any python package which potentially can support JTAG (BDM or others) debugging interface for embedded system development? Is there any other packages supporting debugging, monitoring, data logging, flash programming of embedded systems? Don't know about JTAG, but I've su

Re: Can't Encode Pic

2009-11-26 Thread Carsten Haese
Victor Subervi wrote: > Hi; > I have the following code: > > import cgitb; cgitb.enable() > import cgi > import MySQLdb > from login import login > user, passwd, db, host = login() > db = MySQLdb.connect(host, user, passwd, db) > cursor= db.cursor() > form = cgi.FieldStorage() > pic1 = form.getfir

JTAG/Debugging

2009-11-26 Thread pepe
Hello all, is there any python package which potentially can support JTAG (BDM or others) debugging interface for embedded system development? Is there any other packages supporting debugging, monitoring, data logging, flash programming of embedded systems? I am not looking for python implementati

Can't Encode Pic

2009-11-26 Thread Victor Subervi
Hi; I have the following code: import cgitb; cgitb.enable() import cgi import MySQLdb from login import login user, passwd, db, host = login() db = MySQLdb.connect(host, user, passwd, db) cursor= db.cursor() form = cgi.FieldStorage() pic1 = form.getfirst('pic1') cursor.execute('update products set

Re: vpython installation problem

2009-11-26 Thread Daniel Fetchinson
> I am trying to install Vpython. > > configure worked well [snip] > but make fails: [snip] > what I can do? I'd suggest asking for help on vpython's mailing list: https://lists.sourceforge.net/lists/listinfo/visualpython-users HTH, Daniel -- Psss, psss, put it down! - http://www.cafepress

Re: Python Statements/Keyword Localization

2009-11-26 Thread Marco Mariani
Emanuele D'Arrigo wrote: In this context it seems to be the case that the executable would have to be able to optionally accept -a list- of dictionaries to internally translate to English the keywords found in the input code and at most - one- dictionary to internally translate from English outp

Re: Can "self" crush itself?

2009-11-26 Thread Lie Ryan
n00m wrote: Ok ok Of course, it's a local name; -- just my silly slip. And seems it belongs to no dict[]... Just an internal volatile elf Local names are not implemented as dict, but rather as sort of an array in the compiler. The name resolution of locals is compile time and doesn't use dict

vpython installation problem

2009-11-26 Thread rudra
Hello friends, I am trying to install Vpython. configure worked well $ PYTHON=/usr/bin/python ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for

Re: pointless musings on performance

2009-11-26 Thread Paul Boddie
On 25 Nov, 13:11, Antoine Pitrou wrote: > > When you say "executing each kind of bytecode instruction", are you > talking about the overhead of bytecode dispatch and operand gathering, or > the total cost including doing the useful work? Strip away any overhead (dispatch, operand gathering) and j

Re: IDE+hg

2009-11-26 Thread NiklasRTZ
On Nov 24, 4:09 pm, rustom wrote: > On Nov 24, 8:13 pm, Richard Riley wrote: > > > > > Gerhard Häring writes: > > > Rhodri James wrote: > > >> On Mon, 23 Nov 2009 19:20:27 -, NiklasRTZ wrote: > > > >>> Dear experts, > > >>> Since no py IDE I found has easy hg access. IDEs PIDA and Eric clai

Re: IDE+hg

2009-11-26 Thread NiklasRTZ
On Nov 24, 5:47 pm, "Günther Dietrich" wrote: > NiklasRTZ wrote: > >Since no py IDE I found has easy hg access. > > Obviously, you didn't try Eclipse with PyDev () > and Mercurial Eclipse () > plugins. > This combination is also ava

Re: IDE+hg

2009-11-26 Thread NiklasRTZ
On Nov 25, 7:28 am, alex23 wrote: > NiklasRTZ wrote: > > no py IDE I found has easy hg access. > > ActiveState's Komodo IDE has support for CVS, Perforce, subversion, > bazaar, git and mercurial. unavailable via synaptic ubuntu karmic repos, presuming its commercially bound like wing. Boa constr

Re: Can "self" crush itself?

2009-11-26 Thread Francesco Guerrieri
On Thu, Nov 26, 2009 at 8:04 AM, Gregory Ewing wrote: > n00m wrote: > > I can't understand why we can get __name__, but not __dict__, >> on the module level? >> > > For much the same reason that you can see your own > feet but (unless you look in a mirror) you can't > see your own eyes. > +1 QO

Re: a question about python

2009-11-26 Thread 李白,字一日
thanks. On Nov 26, 5:45 pm, Steven D'Aprano wrote: > On Thu, 26 Nov 2009 01:21:39 -0800, 李白,字一日 wrote: > > hi, > > i have a question on python programming. > > > let file a.py has a class named a, > >   class a(): > >     __G__ = "" > > Methods with double leading and trailing underscores are

Re: a question about python

2009-11-26 Thread Steven D'Aprano
On Thu, 26 Nov 2009 01:21:39 -0800, 李白,字一日 wrote: > hi, > i have a question on python programming. > > let file a.py has a class named a, > class a(): > __G__ = "" Methods with double leading and trailing underscores are reserved for Python's special use. You should find a different

a question about python

2009-11-26 Thread 李白,字一日
hi, i have a question on python programming. let file a.py has a class named a, class a(): __G__ = "" in file b.py i need to insert an attribute __C__ to class a it would be as if class a defined in file a.py like this: class a(): __G__ = "" __C__ = "2" how this be d