Re: Problems with sys.stout.flush()

2009-05-22 Thread Carl Banks
On May 22, 10:33 pm, Joel Ross wrote: > Hi all, > > I'm using python 2.5 and trying to flush the sys.stout buffer with > sys.stout.flush(), but doesn't seem to work. Each time a line is printed >    it appends the one before it I need to clear the output and write a > new output without appending

Problems with sys.stout.flush()

2009-05-22 Thread Joel Ross
Hi all, I'm using python 2.5 and trying to flush the sys.stout buffer with sys.stout.flush(), but doesn't seem to work. Each time a line is printed it appends the one before it I need to clear the output and write a new output without appending the previous one. I have tried the -u (unbuffe

Re: Disabling Logging Handler for a Second

2009-05-22 Thread Gabriel Genellina
En Sat, 23 May 2009 00:56:43 -0300, Gabriel Genellina escribió: - Filters: You can install a filter onto the stream handler (using handler.addFilter) that rejects any record whose msg starts with 'Email:' (or whatever you consider apropiate) s/apropiate/appropriate/ -- Gabriel Genellina

Re: While Statement

2009-05-22 Thread Mike Kazantsev
On Fri, 22 May 2009 21:33:05 +1000 Joel Ross wrote: > changed it to "float(number)/total*100" and it worked thanks for all > your help appreciated I believe operator.truediv function also deserves a mention here, since line "op.truediv(number, total) * 100" somehow seem to make more sense to me

Re: Disabling Logging Handler for a Second

2009-05-22 Thread Gabriel Genellina
En Fri, 22 May 2009 08:26:49 -0300, VenkataRamaKrishna Boddu escribió: Is there any way, I can disable one logging Handler, while other Log Handler are still available for servicing. import logging; import sys; thelog = logging.getLogger('app.scsi.cdb'); strmHdlr = logging.StreamHand

Re: Ambiguous locale.strxfrm

2009-05-22 Thread Gabriel Genellina
En Fri, 22 May 2009 06:32:40 -0300, Tuomas Vesterinen escribió: This was fixed once in Python 2.5, but in Python 3.0 the bug celebrates its comeback. The tail of the strxfrm result is ambiguous. Python 3.0.1 (r301:69556, Apr 14 2009, 14:30:31) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on lin

Re: Looking for module for shrinking a list with n-point means

2009-05-22 Thread Yash Ganthe
Thanks John, The code u provided works for me. Indeed it is a simple requirement and I am a complete novice to Python. -Yash -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 hundred quadrillonth?

2009-05-22 Thread Steven D'Aprano
On Fri, 22 May 2009 13:05:59 -0700, Mark Dickinson wrote: >> > With a sigh of relief, >> >> Yay! We now will have lots of subtle floating point bugs that people >> can't see! Ignorance is bliss and what you don't know about floating >> point can't hurt you! > > Why do you think this change will g

Re: UDP reading on multiple sockets

2009-05-22 Thread Lawrence D'Oliveiro
In message <27bd949f-80b5-44c9-8e3b- c12b49c7e...@r34g2000vbi.googlegroups.com>, thomas.vo...@likeabird.de wrote: > The only honest answer would be that I'm totaly unfamiliar with select > and also the documentation I found wasn't able to clear the picture. > So are there examples of using select

Re: What's the use of the else in try/except/else?

2009-05-22 Thread Lawrence D'Oliveiro
In message <8dc983db-b8c4-4897- a58b-969ca5f8e...@g20g2000vba.googlegroups.com>, Beni Cherniavsky wrote: > And yes, it's icky - not because of the ``else`` but because > aquisition-release done correctly is always an icky pattern. Only in the presence of exceptions. -- http://mail.python.org/ma

Background subprocess help?

2009-05-22 Thread danshumaker
Hi, I'm trying to do something as simple as this: "sleep 10; mail -s "test" dans < communicate_with_process &" which executes immediately because it is backgrounded with "&". or more generically in english: "do some long process in the background; send me mail when it's done; allow me to quit

Re: reseting an iterator

2009-05-22 Thread J. Clifford Dyer
On Fri, 2009-05-22 at 10:54 -0700, Jan wrote: > This produces an error because by definition of for-loops > it is executed the same way as: > > temp_iterator = iter(y) # temp_iterator is y > while True: > try: > print(next(temp_iterator)) # temp_iterator does not support > __next__() >

Re: defaultdict's bug or feature?

2009-05-22 Thread Red Forks
On Sat, May 23, 2009 at 2:03 AM, Rhodri James wrote: > I asked you not to top-post. Please put your replies *below* the > messages you're quoting, not above. It's much easier to understand > the conversation that we're having if you do that, and much more > aggravating if you don't. > I misunder

Re: package questions

2009-05-22 Thread Scott David Daniels
Daniel wrote: Thanks for doing the experiment. I'll begin to consider testing with python 2.6 for a possible upgrade. I hope you know you can have different minor versions installed simultaneously. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-

Re: pushback iterator

2009-05-22 Thread Simon Forman
On May 17, 10:39 am, Matus wrote: > Hallo pylist, > > I searches web and python documentation for implementation of pushback > iterator but found none in stdlib. > > problem: > > when you parse a file, often you have to read a line from parsed file > before you can decide if you want that

Re: dbfpy - cannot store new record

2009-05-22 Thread John Machin
On 23/05/2009 12:32 AM, Laszlo Nagy wrote: dbfpy is very old code. Try setting up a CHAR(1) field and filling it with "Y" or "N" or "T" or "F".. indicating yes,no,true or false... Unfortunately, my task is to import records into a database that is used by an old foxpro program. I'm not

Re: package questions

2009-05-22 Thread Daniel
On May 22, 3:37 pm, Scott David Daniels wrote: > Daniel wrote: > > I'm on WinXP using Python 2.5  Sorry I didn't mention that at first. > > Generally, you want the full version number (my 2.5 is 2.5.4). > However, I set up your demo setup, and found that 2.6.2 worked, and > 2.5.4 failed in the sam

Re: Your Favorite Python Book

2009-05-22 Thread News123
Evan Kroske wrote: > Sam Tregar wrote: >> Greetings. I'm working on learning Python and I'm looking for good >> books to read. I'm almost done with Dive into Python and I liked it a >> lot. I found Programming Python a little dry the last time I looked at >> it, but I'm more motivated now so I migh

Re: package questions

2009-05-22 Thread Scott David Daniels
Daniel wrote: I'm on WinXP using Python 2.5 Sorry I didn't mention that at first. Generally, you want the full version number (my 2.5 is 2.5.4). However, I set up your demo setup, and found that 2.6.2 worked, and 2.5.4 failed in the same way you see. I also see that even inside the effects dir

Re: define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
On 5/22/2009 1:44 PM s...@pobox.com apparently wrote: Note that the glossary page is on the wiki. Feel free to make corrections. Well, ok, I've done so: http://wiki.python.org/moin/PythonGlossary But I'm just a user. Someone should check it. Thanks, Alan Isaac -- http://mail.python.org/mai

Re: reseting an iterator

2009-05-22 Thread J. Cliff Dyer
On Fri, 2009-05-22 at 10:54 -0700, Jan wrote: > On May 22, 9:46 am, "J. Cliff Dyer" wrote: > > > You don't need a reset method. There is no hard and fast rule that > > __iter__ must return the object itself. It just needs to return an > > iterator. > > I disagree. > If ITRATOR is a true ite

Re: ffmpeg and python big problem

2009-05-22 Thread Emile van Sebille
On 5/22/2009 11:38 AM Rhodri James said... On Fri, 22 May 2009 13:54:26 +0100, TerabyteST wrote: @Emile: if I can access MEncoder from python and give it the images one by one, using a stream like i'm doing in ffmpeg, or telling it a sequence to make a video from, I could try it. Here's t

Re: 4 hundred quadrillonth?

2009-05-22 Thread Mark Dickinson
On May 22, 3:28 pm, Steven D'Aprano wrote: > On Thu, 21 May 2009 18:30:17 -0700, Gary Herron wrote: > >> In py3k Eric Smith and Mark Dickinson have implemented Gay's floating > >> point algorithm for Python so that the shortest repr that will round > >> trip correctly is what is used as the floati

Re: Looking for module for shrinking a list with n-point means

2009-05-22 Thread Robert Kern
On 2009-05-22 08:50, Scott David Daniels wrote: Yash Ganthe wrote: I would like to shrink a large list in the following way: If the List has 1000 integers, we need only 100 averages such that the 1000 points are average for every 10 consecutive values. So p0 to p9 will be averaged to obtain t0.

Curses Subwin Resizing

2009-05-22 Thread Damian Johnson
Hi, I've been trying to make a curses application that's resilient to having the terminal resized (like 'top'). I've managed to make it capable of adjusting when the screen's width is changed (using getmaxyx) but changing the height is proving a little trickier. I'm using subwindows so I can select

Re: ffmpeg and python big problem

2009-05-22 Thread Rhodri James
On Fri, 22 May 2009 13:54:26 +0100, TerabyteST wrote: Could you give me a link to a version that "works"? Not with any confidence. The ffmpeg website (http://www.ffmpeg.org) has a link to this page (http://ffmpeg.arrozcru.org/) which seems to have binaries on it, but I don't use Windows so I

Re: package questions

2009-05-22 Thread Daniel
On May 22, 11:29 am, Scott David Daniels wrote: > Daniel wrote: > > Hello, > > > I've posted about this before, but after reading the docs, I have a > > few more questions > > here are the docs:http://docs.python.org/tutorial/modules.html#packages > > here is my previous post: > >http://groups.goo

Re: When does the escape character work within raw strings?

2009-05-22 Thread Rhodri James
On Fri, 22 May 2009 15:47:49 +0100, walterbyrd wrote: On May 21, 9:44 pm, "Rhodri James" wrote: Escaping the delimiting quote is the *one* time backslashes have a special meaning in raw string literals. If that were true, then wouldn't r'\b' be treated as two characters? It is. len(r

Re: defaultdict's bug or feature?

2009-05-22 Thread Rhodri James
I asked you not to top-post. Please put your replies *below* the messages you're quoting, not above. It's much easier to understand the conversation that we're having if you do that, and much more aggravating if you don't. On Fri, 22 May 2009 09:53:04 +0100, Red Forks wrote: Yes, you maybe r

Re: reseting an iterator

2009-05-22 Thread Jan
On May 22, 9:46 am, "J. Cliff Dyer" wrote: > You don't need a reset method.  There is no hard and fast rule that > __iter__ must return the object itself.  It just needs to return an > iterator.   I disagree. If ITRATOR is a true iterator, ITRATOR.__iter__() must return ITERATOR. If ITERABLE is

Re: define "generator" (glossary bug?)

2009-05-22 Thread skip
>>> I believe the glossary >>> http://wiki.python.org/moin/PythonGlossary >>> is missing the definition for 'generator' >>> and has used instead the definition for 'generator function', >>> which term is missing from the glossary. >>> >>> Standard usage as I understand

Re: Adding a Par construct to Python?

2009-05-22 Thread Rhodri James
On Fri, 22 May 2009 10:27:21 +0100, wrote: I think this depends on whether we think that Python is a language for people who we trust to know what they are doing (like Perl) or whether it is a language for people we don't trust to get things right(like Java). I suspect it probably lies somewh

Re: define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
On Fri, 22 May 2009 16:38:40 GMT, Alan G Isaac wrote: I believe the glossary http://wiki.python.org/moin/PythonGlossary is missing the definition for 'generator' and has used instead the definition for 'generator function', which term is missing from the glossary. Standard usage as I understand

Re: Cursor movement question

2009-05-22 Thread Aahz
In article , Jive Dadson wrote: > >Gosh, you guys are slow. :-) I figured it out. Perhaps you could post the solution for posterity's sake? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "A foolish consistency is the hobgoblin of little minds, adored by little

Re: package questions

2009-05-22 Thread Scott David Daniels
Daniel wrote: Hello, I've posted about this before, but after reading the docs, I have a few more questions here are the docs: http://docs.python.org/tutorial/modules.html#packages here is my previous post: http://groups.google.com/group/comp.lang.python/browse_thread/thread/3a352159f6828eb9/cda

Re: define "generator" (glossary bug?)

2009-05-22 Thread Jean-Paul Calderone
On Fri, 22 May 2009 16:38:40 GMT, Alan G Isaac wrote: I believe the glossary http://wiki.python.org/moin/PythonGlossary is missing the definition for 'generator' and has used instead the definition for 'generator function', which term is missing from the glossary. Standard usage as I understand

define "generator" (glossary bug?)

2009-05-22 Thread Alan G Isaac
I believe the glossary http://wiki.python.org/moin/PythonGlossary is missing the definition for 'generator' and has used instead the definition for 'generator function', which term is missing from the glossary. Standard usage as I understand it is found here: http://docs.python.org/3.0/reference/

package questions

2009-05-22 Thread Daniel
Hello, I've posted about this before, but after reading the docs, I have a few more questions here are the docs: http://docs.python.org/tutorial/modules.html#packages here is my previous post: http://groups.google.com/group/comp.lang.python/browse_thread/thread/3a352159f6828eb9/cda8395d36827d20 I

Re: Python Socket Issues with VirtualBox

2009-05-22 Thread Paul Boddie
On 22 Mai, 17:05, Alan Franzoni wrote: > > My first guess would be that you didn't specify the interface to bind to, > and the interface order changes once you install virtualbox since it > possibly adds a virtual interface of its own, but I can't tell unless you > tell something more. If a reque

Re: Question about locals()

2009-05-22 Thread David Robinow
On Fri, May 22, 2009 at 11:00 AM, Gökhan SEVER wrote: > Because in this case serialc is an numpy array. Since loadtxt returns a > numpy-array. Furthermore > > locals()['serialc_bin' + str(i+1)]  creates a dictionary key (that's what I > use the term "variable-like") serialc_bin1, serialc_bin2, ...

Re: Question about locals()

2009-05-22 Thread J. Cliff Dyer
Top-posting corrected. On Fri, 2009-05-22 at 10:00 -0500, Gökhan SEVER wrote: > On Fri, May 22, 2009 at 9:43 AM, David Robinow > wrote: > On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER > wrote: > ... > > serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T >

Re: When does the escape character work within raw strings?

2009-05-22 Thread MRAB
Steven D'Aprano wrote: [snip] But if you forget that Python uses backslash escapes in strings, and just write "\b", then the compiler creates the string chr(8) (BEL), which has no special meaning to the RE engine. "\b" or chr(8) is BS (backspace); "\a" or chr(7) is BEL (bell). -- http://mail.

Re: When does the escape character work within raw strings?

2009-05-22 Thread Steven D'Aprano
On Fri, 22 May 2009 15:29:16 +, Steven D'Aprano wrote: > But if you forget that Python uses backslash escapes in strings, and > just write "\b", then the compiler creates the string chr(8) (BEL), > which has no special meaning to the RE engine. Correction: \b is BACKSPACE, not BELL. \a is BEL

Re: When does the escape character work within raw strings?

2009-05-22 Thread Steven D'Aprano
On Fri, 22 May 2009 07:47:49 -0700, walterbyrd wrote: > On May 21, 9:44 pm, "Rhodri James" wrote: > >> Escaping the delimiting quote is the *one* time backslashes have a >> special meaning in raw string literals. > > If that were true, then wouldn't r'\b' be treated as two characters? It is.

Re: While Statement

2009-05-22 Thread J. Cliff Dyer
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote: > > Tim Wintle wrote: > > On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: > > > >> number/total = 998/999 = 0 > >> number/total*100 = 0*100 = 0 > >> float(number/total*100) = float(0) = 0.0 > >> > >> Change "float(number/total*100)" to

Re: python3 module for dbus ?

2009-05-22 Thread Aahz
In article <4a15b88c$0$90265$14726...@news.sunsite.dk>, Timothy Madden wrote: >Aahz wrote: >> In article <4a1281ef$0$90271$14726...@news.sunsite.dk>, >> Timothy Madden wrote: >[...] >>> Do you know if I can get dbus bindings for python3 and glib bindings for >>> python3 ? Or could I use them o

Re: Python Socket Issues with VirtualBox

2009-05-22 Thread Alan Franzoni
TechieInsights was kind enough to say: [cut] You're giving very few details on your issue, which is most probably not related to python itself. Which operating system? Which virtualbox version? Which kind of connection? Is the port open for listen? Does the code fail at listening or at connecting

Python Socket Issues with VirtualBox

2009-05-22 Thread TechieInsights
I have created a server and client that communicate via a TCP socket connection. Everything runs great on 6 of the 6 boxes. However, when I installed Sun's VirtualBox on one of the PC's I started getting: error: (10061, 'Connection refused') I tried restarting, stopping services, checking out a

Re: Question about locals()

2009-05-22 Thread Gökhan SEVER
Because in this case serialc is an numpy array. Since loadtxt returns a numpy-array. Furthermore locals()['serialc_bin' + str(i+1)] creates a dictionary key (that's what I use the term "variable-like") serialc_bin1, serialc_bin2, ... not serialc_bin[0] with indexes. Gökhan On Fri, May 22, 200

Re: When does the escape character work within raw strings?

2009-05-22 Thread walterbyrd
On May 21, 9:44 pm, "Rhodri James" wrote: > Escaping the delimiting quote is the *one* time backslashes have a > special meaning in raw string literals. If that were true, then wouldn't r'\b' be treated as two characters? > This calls re.sub with a pattern string object that contains two > char

Re: Question about locals()

2009-05-22 Thread David Robinow
On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER wrote: ... > serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T > for i in range(20): >     locals()['serialc_bin' + str(i+1)] = serialc[i+4] > > I don't know easier way than using locals() to construct variable-like > identities in my program. I

Re: dbfpy - cannot store new record

2009-05-22 Thread Laszlo Nagy
dbfpy is very old code. Try setting up a CHAR(1) field and filling it with "Y" or "N" or "T" or "F".. indicating yes,no,true or false... Unfortunately, my task is to import records into a database that is used by an old foxpro program. I'm not allowed to change the database structure i

Re: 4 hundred quadrillonth?

2009-05-22 Thread Steven D'Aprano
On Thu, 21 May 2009 18:56:08 -0700, AggieDan04 wrote: > The error in this example is roughly equivalent to the width of a red > blood cell compared to the distance between Earth and the sun. There > are very few applications that need more accuracy than that. Which is fine if the error *remains*

Re: 4 hundred quadrillonth?

2009-05-22 Thread Steven D'Aprano
On Thu, 21 May 2009 18:30:17 -0700, Gary Herron wrote: >> In py3k Eric Smith and Mark Dickinson have implemented Gay's floating >> point algorithm for Python so that the shortest repr that will round >> trip correctly is what is used as the floating point repr >> >> --David >> >> > Which

Re: While Statement

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote: > > Tim Wintle wrote: > > On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: > >> Change "float(number/total*100)" to "float(number)/total*100" and it > >> should work: > >> > > > > I'd use: > > > > (number * 100.)/total > > > > - wor

Re: Question about locals()

2009-05-22 Thread Gökhan SEVER
Hello, I use local() because I read a file which has many consecutive variables in it. Like shown below: (I use numpy's txt reading function) serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T for i in range(20): locals()['serialc_bin' + str(i+1)] = serialc[i+4] I don't know easier way t

Python-URL! - weekly Python news and links (May 22)

2009-05-22 Thread Gabriel Genellina
QOTW: "Floating point is sort of like quantum physics: the closer you look, the messier it gets." - Grant Edwards The circular relationship between object and type explained: http://comments.gmane.org/gmane.comp.python.general/623460 Floating point numbers don't behave exa

Re: While Statement

2009-05-22 Thread Joel Ross
Dave Angel wrote: Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change "float(number/total*100)" to "float(number)/total*100" and it should work: I'd use: (n

Re: While Statement

2009-05-22 Thread Dave Angel
Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change "float(number/total*100)" to "float(number)/total*100" and it should work: I'd use: (number * 100.)/tota

Re: reseting an iterator

2009-05-22 Thread J. Cliff Dyer
On Wed, 2009-05-20 at 11:35 -0700, Jan wrote: > Wouldn't it be easy for Python to implement generating functions so > that the iterators they return are equipped with a __reset__() method? > > Here is the context of this question. > > Python documentation defines a "iterator" as an object ITERAT

Re: Looking for module for shrinking a list with n-point means

2009-05-22 Thread Scott David Daniels
Yash Ganthe wrote: I would like to shrink a large list in the following way: If the List has 1000 integers, we need only 100 averages such that the 1000 points are average for every 10 consecutive values. So p0 to p9 will be averaged to obtain t0. p10 to p19 will be averaged to obtain t1 and so o

Re: How to get path.py ? http://www.jorendorff.com/ is down

2009-05-22 Thread ma
http://web.archive.org/web/20071105095205/www.jorendorff.com/articles/python/path/ On Thu, May 21, 2009 at 4:10 PM, Kay Schluehr wrote: > On 21 Mai, 21:43, Jorge Vargas wrote: > > Hello. > > > > Anyone knows what is the problem with this package? apparently the > > author's site is down which

Re: General: tutorial to all new python users

2009-05-22 Thread ashish
On May 22, 5:40 am, bvidinli wrote: > This is a good starting point i > think:http://pleac.sourceforge.net/pleac_python/index.html > > (Also a non-related subject:   for who want to do hosting freely on > linux:www.ehcp.net(hosting control panel), also contains an > experimental python backend)

Re: python question

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 05:51 -0700, Craig wrote: > I use python 2.6.2 and i useing ubuntu 9.04 not windows. What are you trying to install? is it available in Synaptic package manager? If it's a program written in python, then there may be a file called "setup.py". If there is then open a termin

Re: python question

2009-05-22 Thread Craig
I use python 2.6.2 and i useing ubuntu 9.04 not windows. --- On Thu, 5/21/09, Dave Angel wrote: > From: Dave Angel > Subject: Re: python question > To: "Craig" > Cc: python-list@python.org > Date: Thursday, May 21, 2009, 2:22 PM > Craig wrote: > > How do i install this.i never seen a python w

General: tutorial to all new python users

2009-05-22 Thread bvidinli
This is a good starting point i think: http://pleac.sourceforge.net/pleac_python/index.html (Also a non-related subject: for who want to do hosting freely on linux: www.ehcp.net (hosting control panel), also contains an experimental python backend) -- http://mail.python.org/mailman/listinfo/pyt

Re: While Statement

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: > number/total = 998/999 = 0 > number/total*100 = 0*100 = 0 > float(number/total*100) = float(0) = 0.0 > > Change "float(number/total*100)" to "float(number)/total*100" and it > should work: I'd use: (number * 100.)/total - works because

Re: While Statement

2009-05-22 Thread Joel Ross
Andre Engels wrote: On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote: Im using 2.6 python and when running this class progess(): def __init__(self, number, total, char): percentage = float(number/total*100) percentage = int(round(percentage)) char = char * percenta

Disabling Logging Handler for a Second

2009-05-22 Thread VenkataRamaKrishna Boddu
Hi All, Is there any way, I can disable one logging Handler, while other Log Handler are still available for servicing. Please see the below code. It explains my Problem better. I actually reduce the size of problem, to make it understandable faster

Re: Streaming pdf with URLLib

2009-05-22 Thread Joel Goldstick
I think you misspelled 'Content-Disposition' Aahz wrote: In article <04eacd56-5293-4553-bdb3-ad2e8266c...@z7g2000vbh.googlegroups.com>, Scooter wrote: #!/usr/bin/python import urllib u = urllib.urlopen('https://myinternal.server/pdfs/pdfstreamer.aspx') print 'Content-type: application/pdf\n

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote: > Im using 2.6 python and when running this > > class progess(): > >    def __init__(self, number, total,  char): > >        percentage = float(number/total*100) >        percentage = int(round(percentage)) >        char = char * percentage >    

Re: How to get path.py ? http://www.jorendorff.com/ is down

2009-05-22 Thread Kay Schluehr
On 21 Mai, 21:43, Jorge Vargas wrote: > Hello. > > Anyone knows what is the problem with this package? apparently the > author's site is down which prevents pip from installing it. I can > download the zip and go from there but It seems most of the docs are > gone with the site. The code comments

Cursor movement question

2009-05-22 Thread Jive Dadson
Howdy, folks. I am using wxPython 2.8 on Windoze XP Pro. I want my application to move the cursor and the mouse-point (the coordinates in the mouse-click events) to the left when the user presses the left-arrow key, up when they press the up-arrow key, etc.. I think I can figure out how to g

Re: What do you think of ShowMeDo

2009-05-22 Thread Gasto
Smart ass talking. Why don't you do a thing then. Following an analogy of what you write. Put youself in Kyran's and Ian's shoes. * You create a website to help people learn open source software and open source programming. You start off with a few dozen of videos. People start coming to the si

How to send a compsite key to window

2009-05-22 Thread zhouhaifeng
just like "ctrl + A", I want to select all the text in a window, now , I operate right menu to get it, but it can not work all the time. so I want to send "ctrl + a" to the window blow is my code thanks hWnd = win32gui.FindWindow(None, "“中华会计网校”财税法规库下载版V1.09-法 规阅读器") print hWnd if hWnd <> 0: p

How to send a compsite key to window

2009-05-22 Thread zhouhaifeng
just like "ctrl + A", I want to select all the text in a window, now , I operate right menu to get it, but it can not work all the time. so I want to send "ctrl + a" to the window blow is my code thanks hWnd = win32gui.FindWindow(None, "“中华会计网校”财税法规库下载版V1.09-法 规阅读器") print hWnd if hWnd <> 0: p

Re: Looking for module for shrinking a list with n-point means

2009-05-22 Thread John Machin
On May 22, 8:03 pm, Yash Ganthe wrote: > Hi, > > I would like to shrink a large list in the following way: > If the List has 1000 integers, we need only 100 averages such that the > 1000 points are average for every 10 consecutive values. So p0 to p9 > will be averaged to obtain t0. p10 to p19 wil

RE: While Statement

2009-05-22 Thread Andreas Tawn
> Im using 2.6 python and when running this > > class progess(): > > def __init__(self, number, total, char): > > percentage = float(number/total*100) > percentage = int(round(percentage)) > char = char * percentage > print char > > progess(1

Re: While Statement

2009-05-22 Thread Joel Ross
Andre Engels wrote: On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote: Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage > 0 : percentage = int(number/total*100)

Looking for module for shrinking a list with n-point means

2009-05-22 Thread Yash Ganthe
Hi, I would like to shrink a large list in the following way: If the List has 1000 integers, we need only 100 averages such that the 1000 points are average for every 10 consecutive values. So p0 to p9 will be averaged to obtain t0. p10 to p19 will be averaged to obtain t1 and so on. This is a 10-

Re: While Statement

2009-05-22 Thread Joel Ross
Joel Ross wrote: Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage > 0 : percentage = int(number/total*100) number-=1 char+="*" p

Ambiguous locale.strxfrm

2009-05-22 Thread Tuomas Vesterinen
This was fixed once in Python 2.5, but in Python 3.0 the bug celebrates its comeback. The tail of the strxfrm result is ambiguous. Python 3.0.1 (r301:69556, Apr 14 2009, 14:30:31) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "credits" or "license" for more informat

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote: > Hi all, > > I have this piece of code > > class progess(): > >    def __init__(self, number,  char): > >        total = number >        percentage = number >        while percentage > 0 : >            percentage = int(number/total*100) >        

Re: While Statement

2009-05-22 Thread Kushal Kumaran
On Fri, May 22, 2009 at 2:47 PM, Joel Ross wrote: > Hi all, > > I have this piece of code > > class progess(): > >    def __init__(self, number,  char): > >        total = number >        percentage = number >        while percentage > 0 : >            percentage = int(number/total*100) >        

Re: making a python program in windows

2009-05-22 Thread Dave Angel
Tim Roberts wrote: Dave Angel wrote: Anyway, now you can see two batch files you could use to make a particular version of Python active. The first one uses assoc and ftype to fix the asssociations. And the other changes the environment variable PATHEXT to make the extension optional. No

Re: Adding a Par construct to Python?

2009-05-22 Thread jeremy
On 22 May, 05:17, "Rhodri James" wrote: > On Wed, 20 May 2009 09:19:50 +0100,   > wrote: > > > On 20 May, 03:43, Steven D'Aprano > > wrote: > >> On Tue, 19 May 2009 03:57:43 -0700, jeremy wrote: > >> > As I wrote before, concurrency is one of the hardest things for > >> > professional programmer

While Statement

2009-05-22 Thread Joel Ross
Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage > 0 : percentage = int(number/total*100) number-=1 char+="*" print char progess

Re: Error in code send Email

2009-05-22 Thread Kushal Kumaran
On Fri, May 22, 2009 at 2:20 PM, Kalyan Chakravarthy wrote: > Google App Engine doesn't allow to use sockets directly Then what could be > the solution for this ? > > can any one Reply me > Did you try google? Searching for google app engine email immediately gives results. See also: http://cat

Re: defaultdict's bug or feature?

2009-05-22 Thread Red Forks
Yes, you maybe right. When use defaultdict, should not rely get() method anymore, d[] is just enough. When a function return a defaultdict, but people don't know it, so: d = load_map() # if she call d['a'], everything is OK but # when call d.get('a'), she is always get None. # Why she call d.get('

Re: Error in code send Email

2009-05-22 Thread Kalyan Chakravarthy
*Google App Engine doesn't allow to use sockets directly *Then what could be the solution for this ? can any one Reply me Regards Kalyan On Fri, May 22, 2009 at 1:05 PM, Gabriel Genellina wrote: > En Thu, 21 May 2009 02:31:02 -0300, Kalyan Chakravarthy < > kalyanchakravar...@hyit.com> escribió

Re: sqlite3, qmarks, and NULL values

2009-05-22 Thread Lawrence D'Oliveiro
In message , Mitchell L Model wrote: > However, COL2 might be NULL. I can't figure out a value for y that would > retrieve rows for which COL2 is NULL. It seems to me that I have to > perform an awkward test to determine whether to execute a query with one > question mark or two. In SQL, NULL is

Re: Question about locals()

2009-05-22 Thread Gabriel Genellina
En Tue, 19 May 2009 14:06:04 -0300, Gökhan SEVER escribió: I will make double sure myself while using locals() to end up with valid identifiers. I would ask myself why I'm using locals() in the first place. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating zipped or gzipped attachment with email package?

2009-05-22 Thread Gabriel Genellina
En Thu, 21 May 2009 10:34:09 -0300, escribió: I want to modify my script to automatically zip or gzip files which exceed some size threshold. Doing the zip/gzip dance is no problem. I'm concerned about how to specify that properly with the email package. For example, consider a large CSV

Re: making a python program in windows

2009-05-22 Thread Tim Golden
rustom wrote: Thanks for this (and all other) tips. Strangely now my m/c shows things exactly like so. A new .py file gets associated with python but two days ago it was with pythonw?! Any recos on where I could read up on this stuff? I by "all this stuff" you mean: Windows file associations, t

Re: from __future__ import absolute_import issue

2009-05-22 Thread Gabriel Genellina
En Wed, 20 May 2009 20:18:02 -0300, LittleGrasshopper escribió: New to the group, this is my first post... It appears that either absolute imports (or my brain) aren't working. Given a module string.py which is in the same directory as a.py: #File a.py from __future__ import absolute_import

Re: Error in code send Email

2009-05-22 Thread Gabriel Genellina
En Thu, 21 May 2009 02:31:02 -0300, Kalyan Chakravarthy escribió: I am using above code to send an Email, for this i am not installed any SMTP setup my local , I just given import smtplib and I am getting following error **Traceback (most recent call last): File "C:\Program Files\Google\g

Re: Cursor movement question

2009-05-22 Thread Lawrence D'Oliveiro
In message , Jive Dadson wrote: > Gosh, you guys are slow. :-) I figured it out. We were just waiting to see how long it would take you. -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 hundred quadrillonth?

2009-05-22 Thread rustom
On May 22, 6:56 am, AggieDan04 wrote: > The error in this example is roughly equivalent to the width of a red > blood cell compared to the distance between Earth and the sun.  There > are very few applications that need more accuracy than that. For a mathematician there are no inexact numbers; fo

Re: making a python program in windows

2009-05-22 Thread rustom
On May 21, 5:09 pm, Duncan Booth wrote: > rustom wrote: > > i suppose the question is entirely about setting properly (and > > grokking) file associations -- why is a .py file associated with > > pythonw and not python? And is making this association right enough to > > make a .py file in windows

Re: A question regd configobj

2009-05-22 Thread Gabriel Genellina
En Thu, 21 May 2009 08:23:36 -0300, Srijayanth Sridhar escribió: I am wondering if it is possible to have hexadecimal strings in a ini file and have configobj parse it correctly. for eg: moonw...@trantor:~/python/config$ cat foo foo="\x96\x97" . . . a=ConfigObj("foo") a ConfigObj({'foo':

  1   2   >