Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
r0g wrote: > Gabriel Genellina wrote: >> En Fri, 27 Nov 2009 22:35:36 -0300, r0g >> escribió: >> >>> gethostbyname ignores setdefaulttimeout. >>> >>> How big a job is it to use non-blocking sockets to write a DNS lookup >>> function with a customisable timeout? A few lines? A few hundred? I'd As

Re: Some Basic questions on the use of CTRL and ALT Keys

2009-11-27 Thread joy99
On Nov 28, 5:35 am, Steven D'Aprano wrote: > On Fri, 27 Nov 2009 12:41:42 -0800, joy99 wrote: > > Dear Group, > > > I have written a small and simple program like the following: > > > def alphabet1(n): > >     file_open=open("/python26/alphabetlist1.txt","r") > >     file_read=file_open.read() > >

Re: Some Basic questions on the use of CTRL and ALT Keys

2009-11-27 Thread joy99
On Nov 28, 5:35 am, Steven D'Aprano wrote: > On Fri, 27 Nov 2009 12:41:42 -0800, joy99 wrote: > > Dear Group, > > > I have written a small and simple program like the following: > > > def alphabet1(n): > >     file_open=open("/python26/alphabetlist1.txt","r") > >     file_read=file_open.read() > >

Re: a 100-line indentation-based preprocessor for HTML

2009-11-27 Thread Steve Howell
On Nov 27, 9:56 pm, "David Williams" wrote: > You might want to take a look at this: > > http://www.ghrml.org/ > Yep, it's not clear how actively they are maintaining that. The fact that it seems to target Genshi only might be limiting their audience, which is unfortunate. -- http://mail.pytho

Re: a 100-line indentation-based preprocessor for HTML

2009-11-27 Thread David Williams
You might want to take a look at this: http://www.ghrml.org/ David > Python has this really neat idea called indentation-based syntax, and > there are folks that have caught on to this idea in the HTML > community. > > AFAIK the most popular indentation-based solution for generating HTML > is a

Re: Python & OpenOffice Spreadsheets

2009-11-27 Thread r
On Nov 27, 10:44 pm, Lawrence D'Oliveiro wrote: > In message <486869af-d89f-4261-b4c2- > > f45af5d3b...@e7g2000vbi.googlegroups.com>, r wrote: > > I find the syntax far to[o] complicated than it should be. > > That’s because it was originally written for Java programmers. Well that explains the h

Re: Python & OpenOffice Spreadsheets

2009-11-27 Thread Lawrence D'Oliveiro
In message <486869af-d89f-4261-b4c2- f45af5d3b...@e7g2000vbi.googlegroups.com>, r wrote: > I find the syntax far to[o] complicated than it should be. That’s because it was originally written for Java programmers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Enkidu
Ben Finney wrote: Enkidu writes: Heh! Maybe a little sleep-deprived, but I didn't realise that the original post was cross-posted to comp.lang.python. If I'd purposely posted it to CLP it *would* have been a stupid troll. I did it by accident, and apologise for doing so. Oh, so trash-talking

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
Gabriel Genellina wrote: > En Fri, 27 Nov 2009 22:35:36 -0300, r0g > escribió: > >> gethostbyname ignores setdefaulttimeout. >> >> How big a job is it to use non-blocking sockets to write a DNS lookup >> function with a customisable timeout? A few lines? A few hundred? I'd >> only need to resolv

Re: How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-27 Thread ++imanshu
On Nov 27, 4:06 pm, Marco Mariani wrote: > Jon Clements wrote: > > pychecker returns "test.py:3: No global (o) found" for the above, and > > can be found athttp://pychecker.sourceforge.net/ > > > There's also pylint and another one whose name I can't remember... > > pyflakes. I use that one Thank

Re: Python C API, building a module

2009-11-27 Thread MRAB
P.F.C. wrote: I see what your saying. Is there another way of declaring (at least) the docstring apart from the actual array?(it would get messy otherwise) I had also tried defining the variables as static but got the same result (I thought static meant in code memory instead of the heap...?

Re: Feature request: String-inferred names

2009-11-27 Thread The Music Guy
Gred, thanks for your comments. On Nov 26, 7:49 pm, Gregory Ewing wrote: > > [...] Also, many of the uses of getattr in the std lib appear > to be of the 3-argument form, which your suggested syntax > doesn't cover. [...] Good point. After excluding those, only ~435 uses would work for my propos

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread J Sisson
On Fri, Nov 27, 2009 at 9:20 PM, r0g wrote: > Ahh so close. I set the alarm for 3 seconds and it raises the exception, > but only after spending 25 seconds seemingly blocked in gethostbyname. > > Here's a snippet, just in case I'm doing it wrong!... > > If you're doing many lookups prior to conne

Re: Feature request: String-inferred names

2009-11-27 Thread The Music Guy
On Nov 26, 9:10 pm, "Gabriel Genellina" wrote: > 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 abo

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread MRAB
r0g wrote: Hi, I'm writing a reliability monitoring app but I've run into a problem. I was hoping to keep it very simple and single threaded at first but that's looking unlikely now! The crux of it is this... gethostbyname ignores setdefaulttimeout. It seems gethostbyname asks the OS to resolv

Re: hex int and string

2009-11-27 Thread jessica
On 11月27日, 下午5时35分, "84715...@qq.com" <84715...@qq.com> wrote: > On 11月27日, 下午5时28分, luca72 wrote: > > > > > i'm using pyscard > > > and for send a command he need a list like this: > > > cmd = [0xdd,0xff, etc] > > > the problem is that i get a text > > like dd > > and i need to trasform it in 0xd

Re: hex int and string

2009-11-27 Thread jessica
On 11月27日, 下午4时54分, luca72 wrote: > hello i have a problem > > i have this > > str = 'D3' > and i need to trasform in 0xd3 type int and not type string how i can > do this? > if i do > hex(int(str,16) ) i obtain a string and this is not what i need. > > thanks Luca http://www.mbthome.net/ mbt sho

Re:Python C API, building a module

2009-11-27 Thread P.F.C.
I see what your saying. Is there another way of declaring (at least) the docstring apart from the actual array?(it would get messy otherwise) I had also tried defining the variables as static but got the same result (I thought static meant in code memory instead of the heap...?) I am new to C so

Re: Python C API, building a module

2009-11-27 Thread MRAB
P.F.C. wrote: Hello, I'm new to the mailing list but have been using python for a while. I am now attempting to embed the interpreter into a C application but am having an issue when building a module exposing my application's functions to python. I do not know if this is the right place to as

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
John Bokma wrote: > r0g wrote: > >> It seems gethostbyname asks the OS to resolve the address and the OS >> uses it's own timeout value ( 25 seconds ) rather than the one provided >> in setdefaulttimeout. 25 seconds of blocking is way too long for me, I >> want the response within 5 seconds or no

Python C API, building a module

2009-11-27 Thread P.F.C.
Hello, I'm new to the mailing list but have been using python for a while. I am now attempting to embed the interpreter into a C application but am having an issue when building a module exposing my application's functions to python. I do not know if this is the right place to ask for help with it

a 100-line indentation-based preprocessor for HTML

2009-11-27 Thread Steve Howell
Python has this really neat idea called indentation-based syntax, and there are folks that have caught on to this idea in the HTML community. AFAIK the most popular indentation-based solution for generating HTML is a tool called HAML, which actually is written in Ruby. I have been poking around w

Re: python bijection

2009-11-27 Thread Gabriel Genellina
En Fri, 27 Nov 2009 15:12:36 -0300, Francis Carr escribió: I was really inspired by this discussion thread! :-) After much tinkering, I think I have a simpler solution. Just make the inverse mapping accessible via an attribute, -AND- bind the inverse of -THAT- mapping back to the original.

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Ben Finney
Enkidu writes: > Heh! Maybe a little sleep-deprived, but I didn't realise that the > original post was cross-posted to comp.lang.python. If I'd purposely > posted it to CLP it *would* have been a stupid troll. I did it by > accident, and apologise for doing so. Oh, so trash-talking in *other* fo

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread Gabriel Genellina
En Fri, 27 Nov 2009 22:35:36 -0300, r0g escribió: gethostbyname ignores setdefaulttimeout. How big a job is it to use non-blocking sockets to write a DNS lookup function with a customisable timeout? A few lines? A few hundred? I'd only need to resolve v4 addresses for the foreseeable. Thi

Re: Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread John Bokma
r0g wrote: > It seems gethostbyname asks the OS to resolve the address and the OS > uses it's own timeout value ( 25 seconds ) rather than the one provided > in setdefaulttimeout. 25 seconds of blocking is way too long for me, I > want the response within 5 seconds or not at all but I can see no

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Enkidu
Steven D'Aprano wrote: On Sat, 28 Nov 2009 14:02:31 +1300, Enkidu wrote: Are you trolling or just a little sleep-deprived today? Heh! Maybe a little sleep-deprived, but I didn't realise that the original post was cross-posted to comp.lang.python. If I'd purposely posted it to CLP it *would* h

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Enkidu
Ben Finney wrote: Enkidu writes: Urgh. Is that all that python is good for, drawing pretty pictures? Yep, that's all http://python.org/about/success/>. Rackspace, Google, NASA, Philips, Honeywell, AstraZeneca; they're *all* organisations focussed on drawing pretty pictures, and that's all th

Best strategy for overcoming excessive gethostbyname timeout.

2009-11-27 Thread r0g
Hi, I'm writing a reliability monitoring app but I've run into a problem. I was hoping to keep it very simple and single threaded at first but that's looking unlikely now! The crux of it is this... gethostbyname ignores setdefaulttimeout. It seems gethostbyname asks the OS to resolve the address

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Steven D'Aprano
On Sat, 28 Nov 2009 14:02:31 +1300, Enkidu wrote: > Lawrence D'Oliveiro wrote: > > >> Done by Northland Polytechnic, available for download under CC-BY-NC-ND >> here >> . >> > Urgh. Is that all that python is good for, draw

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Ben Finney
Enkidu writes: > Urgh. Is that all that python is good for, drawing pretty pictures? Yep, that's all http://python.org/about/success/>. Rackspace, Google, NASA, Philips, Honeywell, AstraZeneca; they're *all* organisations focussed on drawing pretty pictures, and that's all they use Python for.

Re: Intro To Python Using Turtle Graphics

2009-11-27 Thread Enkidu
Lawrence D'Oliveiro wrote: > Done by Northland Polytechnic, available for download under CC-BY-NC-ND here . Urgh. Is that all that python is good for, drawing pretty pictures? Cheers, Cliff -- The Internet is interestin

Re: Some Basic questions on the use of CTRL and ALT Keys

2009-11-27 Thread Steven D'Aprano
On Fri, 27 Nov 2009 12:41:42 -0800, joy99 wrote: > Dear Group, > > I have written a small and simple program like the following: > > def alphabet1(n): > file_open=open("/python26/alphabetlist1.txt","r") > file_read=file_open.read() > file_word=file_read.split() > print file_word

cmndbot 0.1 beta 1 released

2009-11-27 Thread Bart Thate
So once again i bite the bullet because i can no longer wait on going public with this. I'm pleased to announce CMNDBOT 0.1 BETA1 to the world as this is the first released of my port of GOZERBOT to the Google Application Engine, enabling it on wave, web and xmpp. I'll paste here the README to ex

Re: Render a xml graph as an image

2009-11-27 Thread David Williams
Maybe I am missing something, but according to this example, http://code.google.com/p/python-graph/wiki/Example, python-graph can export to at least PNG format. Another option, transform the XML into GraphML (http://graphml.graphdrawing.org/) using XSLT (assuming it is not already in that format),

Re: extending optionparser to accept multiple comma delimited input for one arg

2009-11-27 Thread Terry Reedy
cmptrwhz wrote: On Nov 27, 2:33 am, Peter Otten <__pete...@web.de> wrote: If you had problems understanding the documentation perhaps you can suggest an improvement. Peter First I would like to thank you very much for the quick and concise answer this is very clear to me as to what I need to d

My Python / wxPython app crashing - suggestions?

2009-11-27 Thread Ross
I have a rather elaborate app on python 2.5.2 on mac osx 10.4.11. The GUI elements are built on wxPython 2.8.10.1. Development has gone pretty well, but I've got an intermittent rather silent crash that happens without spewing any error messages to my console at all. I'm developing in Eclipse wi

Render a xml graph as an image

2009-11-27 Thread anand jeyahar
hi all. Am looking to display a graph as an image.. the graph is in the format of a xml file(basically the output of a python-graph package).. Is there a package that already does it?? == Anand J http://sites.google.com/a/cbcs.ac.in/stude

Some Basic questions on the use of CTRL and ALT Keys

2009-11-27 Thread joy99
Dear Group, I have written a small and simple program like the following: def alphabet1(n): file_open=open("/python26/alphabetlist1.txt","r") file_read=file_open.read() file_word=file_read.split() print file_word Here, I am using a file “alphabetlist1.txt” which I am reading and

Re: Feature request: String-inferred names

2009-11-27 Thread The Music Guy
Testing, testing...is this thing on? Hang on guys, I'm having some trouble posting to the mailing list suddenly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
> > > > > > > > > The problem here is that only one of the images prints on the said page! > > However, if I surf to those URLs, the images appear! > > Are you sure that you're surfing to *exactly* those URLs? When I go to > http://www.angrynates.com/cart/getpic.py?pic=2&id=1, I get an image, but

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Stefan Behnel
Mel, 27.11.2009 18:47: > Steven D'Aprano wrote: >> On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: >>> Here's my question: Given a list of onknown length, I'd like to be able >>> to do the following: >>> >>> (a, b, c, d, e, f) = list >>> >>> If the list has fewer items than the tuple, I'd like

Re: why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
What a newbie mistake for me to make. I appreciate the replies everyone! Cheers, Chris > On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote: > > I would think that second loop should terminate at 9.9, no? > > > > I am missing something fundamental? > > "What Every Computer Scientist Sh

Re: Can't Encode Pic

2009-11-27 Thread Carsten Haese
Victor Subervi wrote: > On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese > wrote: > > Victor Subervi wrote: > > The difficulty I am having is that for > > some reason it's not inserting. The form inserts the first image > but not > > the second.

Re: debugger on system with Python 2 and 3

2009-11-27 Thread Alan Franzoni
On 11/27/09 6:17 PM, Yo Sato wrote: > Hi, > > I am a relative newcomer to the Python language, and only write Python > 3. Now I would very much like to a more-than-basic debugger. However > it seems as if the fact that I have both Python 2 and 3 on the system > complicates the matter... You haven

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 1:43 PM, Dennis Lee Bieber wrote: > On Fri, 27 Nov 2009 05:59:39 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > > > > > > The following complained that there weren't enough arguments: > > > > for pic in pics: > > sql = '

setup.py and MANIFEST.in - duplicating inclusion of files?

2009-11-27 Thread Aljosa Mohorovic
the only way i can get to distribute template files when using "python setup.py sdist" is to declare it both in setup.py and MANIFEST.in. setup.py: > package_data={'myapp':['templates/*.html', 'templates/admin/*.html'],} MANIFEST.in: > recursive-include myapp/templates *.html am i doing somethin

Re: python bijection

2009-11-27 Thread Francis Carr
I was really inspired by this discussion thread! :-) After much tinkering, I think I have a simpler solution. Just make the inverse mapping accessible via an attribute, -AND- bind the inverse of -THAT- mapping back to the original. The result is a python dict with NO NEW METHODS except this inve

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Mel
Steven D'Aprano wrote: > On Fri, 27 Nov 2009 04:18:08 -0800, boblatest wrote: >> Here's my question: Given a list of onknown length, I'd like to be able >> to do the following: >> >> (a, b, c, d, e, f) = list >> >> If the list has fewer items than the tuple, I'd like the remaining tuple >> elemen

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Steven D'Aprano
On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote: > I would think that second loop should terminate at 9.9, no? > > I am missing something fundamental? "What Every Computer Scientist Should Know About Floating Point" http://docs.sun.com/source/806-3568/ncg_goldberg.html -- Steven

debugger on system with Python 2 and 3

2009-11-27 Thread Yo Sato
Hi, I am a relative newcomer to the Python language, and only write Python 3. Now I would very much like to a more-than-basic debugger. However it seems as if the fact that I have both Python 2 and 3 on the system complicates the matter... First I tried to use something called pydb, but it seems

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese wrote: > Victor Subervi wrote: > > The difficulty I am having is that for > > some reason it's not inserting. The form inserts the first image but not > > the second. > > My guess is that you're not calling db.commit() after inserting the > second im

Re: ANN: pdfrw pure-Python PDF file reading and writing

2009-11-27 Thread Patrick Maupin
On Nov 27, 2:35 am, Patrick Maupin wrote: > pdfrw is a basic PDF file manipulation library, developed and tested > on Python 2.5 and 2.6. > > pdfrw can read and write PDF files, and can also be used to read in > PDFs which can then be used inside reportlab (as source material for > new PDFs).  Thi

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Carsten Haese
S. Chris Colbert wrote: > In [15]: t = 0. > > In [16]: time = 10. > > In [17]: while t < time: >: print t >: t += 0.1 >: >: > 0.0 > 0.1 > 0.2 > 0.3

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Tim Wintle
On Fri, 2009-11-27 at 17:06 +0100, S. Chris Colbert wrote: > This seems strange to me, but perhaps I am just missing something: > I would think that second loop should terminate at 9.9, no? > > I am missing something fundamental? Floating points variables ... http://en.wikipedia.org/wiki/Floati

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Jon Clements
On 27 Nov, 12:18, boblatest wrote: > Hello all, > > (sorry for posting from Google. I currently don't have access to my > normal nntp account.) > > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Paul Rudin
"S. Chris Colbert" writes: >: print t Try replacing with: print "%0.20f" % t The thing you're missing is that floating point arithmetic isn't (in general) exact - but when it's printed it's rounded. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Someone Something
Codechef and all those algorithmic websites aren't very good for python because, quite frankly, python is definitley slower than C or C++. You should probably pick up a project on sourceforge or freshmeat if you feel confident enough. On Thu, Nov 26, 2009 at 10:24 PM, astral orange <457r0...@gmail

Re: why do I get this behavior from a while loop?

2009-11-27 Thread Diez B. Roggisch
S. Chris Colbert schrieb: This seems strange to me, but perhaps I am just missing something: In [12]: t = 0. In [13]: time = 10. In [14]: while t < time: : print t : t += 1. : : 0.0 1.0

Re: Can't Encode Pic

2009-11-27 Thread Carsten Haese
Victor Subervi wrote: > The difficulty I am having is that for > some reason it's not inserting. The form inserts the first image but not > the second. My guess is that you're not calling db.commit() after inserting the second image. (If you had shown your code, I wouldn't have to guess.) HTH, -

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
On Nov 27, 6:00 pm, Paul Rudin wrote: > efficiency ... This is it! -- http://mail.python.org/mailman/listinfo/python-list

why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
This seems strange to me, but perhaps I am just missing something: In [12]: t = 0. In [13]: time = 10. In [14]: while t < time: : print t : t += 1. : : 0.0 1.0 2.0

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
> abba > bbaz> abbaz > > == > > Answer: 11 > > Answer: 13- Hide quoted text - 14 ! with '' (empty substring :-)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Paul Rudin
n00m writes: > On Nov 27, 1:22 pm, Jon Clements wrote: >> Of course, if you take '~' literally (len(s) <= -10001) I reckon >> you've got way too many :) >> >> Jon. > > Then better: len(s) < abs(~1) > > PS It's a hard problem; so let's leave it alone what's hard? substrings of a string? If y

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

2009-11-27 Thread Diez B. Roggisch
李白,字一日 schrieb: On Nov 27, 3:35 pm, Ben Finney wrote: 李白,字一日 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

Re: Please recommend the books that might be helpful to learn Python :)

2009-11-27 Thread Chandrakant Silver
On Nov 17, 7:18 am, Psi wrote: > as the subject says, > > any books? This is one of the good books available on the internet... http://diveintopython.org/ I myself liked this book very much (to start with). Also, on the website, on the right-hand-side it mentions about other books. -- Silver, Ch

Re: Python Programming Challenges for beginners?

2009-11-27 Thread MRAB
n00m wrote: 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 substri

Re: Debugging thread stall

2009-11-27 Thread Chandrakant Silver
On Nov 27, 3:22 pm, Roy Smith wrote: > I've got an application which uses several threads (from the threading > module) to do I/O.  Inexplicably, I've now got a situation where one thread > stalls. > > Are there any good tools for debugging Python threading problems?  I'm > thinking of something w

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Dave Angel
Peter Otten wrote: boblatest wrote: Hello all, (sorry for posting from Google. I currently don't have access to my normal nntp account.) Here's my question: Given a list of onknown length, I'd like to be able to do the following: (a, b, c, d, e, f) = list If the list has fewer items than

Re: Debugging thread stall

2009-11-27 Thread silvercl
On Nov 27, 3:22 pm, Roy Smith wrote: > I've got an application which uses several threads (from the threading > module) to do I/O.  Inexplicably, I've now got a situation where one thread > stalls. > > Are there any good tools for debugging Python threading problems?  I'm > thinking of something w

Re: Python Programming Challenges for beginners?

2009-11-27 Thread J Kenneth King
astral orange <457r0...@gmail.com> writes: > 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

ANN: pdfrw pure-Python PDF file reading and writing

2009-11-27 Thread Patrick Maupin
pdfrw is a basic PDF file manipulation library, developed and tested on Python 2.5 and 2.6. pdfrw can read and write PDF files, and can also be used to read in PDFs which can then be used inside reportlab (as source material for new PDFs). This is also the underlying library for a new rst2pdf ext

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 9:02 AM, Rami Chowdhury wrote: > On Fri, Nov 27, 2009 at 02:59, Victor Subervi > wrote: > > On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber < > wlfr...@ix.netcom.com> > > wrote: > >> Nothing hinting at having > >> opened an interactive Python console and typing statemen

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
On Nov 27, 1:22 pm, Jon Clements wrote: > Of course, if you take '~' literally (len(s) <= -10001) I reckon > you've got way too many :) > > Jon. Then better: len(s) < abs(~1) PS It's a hard problem; so let's leave it alone -- http://mail.python.org/mailman/listinfo/python-list

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

2009-11-27 Thread 李白,字一日
On Nov 27, 7:04 pm, Marco Mariani wrote: > ??,??? wrote: > > or is it possible for large source files? > > Google for polystyle. > > It's a tool that reformats a program (in several languages) using an > example you must provide (let's call it a "style sheet", written in > Python or whatever) of h

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

2009-11-27 Thread 李白,字一日
On Nov 27, 3:35 pm, Ben Finney wrote: > 李白,字一日 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

Re: Using struct to read binary files

2009-11-27 Thread mercado
Thanks Tim and Gabriel! That was exactly what I needed -- http://mail.python.org/mailman/listinfo/python-list

Debugging thread stall

2009-11-27 Thread Roy Smith
I've got an application which uses several threads (from the threading module) to do I/O. Inexplicably, I've now got a situation where one thread stalls. Are there any good tools for debugging Python threading problems? I'm thinking of something which might print out a list of all the threads

Re: extending optionparser to accept multiple comma delimited input for one arg

2009-11-27 Thread cmptrwhz
On Nov 27, 2:33 am, Peter Otten <__pete...@web.de> wrote: > > If you had problems understanding the documentation perhaps you can suggest > an improvement. > > Peter First I would like to thank you very much for the quick and concise answer this is very clear to me as to what I need to do now. Than

Re: Anything equivalent to cassert in C++?

2009-11-27 Thread Jonathan Hartley
On Nov 26, 6:08 pm, 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: Can't Encode Pic

2009-11-27 Thread Rami Chowdhury
On Fri, Nov 27, 2009 at 02:59, Victor Subervi wrote: > On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber > wrote: >> Nothing hinting at having >> opened an interactive Python console and typing statements into it as an >> experiment to see what may work, or what changes may break something. > >

Re: parsing json data

2009-11-27 Thread Jon Clements
On 27 Nov, 13:52, jujulj wrote: > Hi, > > I get the data shown below from the json geonames web service. > What's the best way to get the name value of the alternateNames with a > given lang value? > Do I have to loop in the array to find it? > > thanks > > {u'adminCode1': u'09', >  u'adminName1':

parsing json data

2009-11-27 Thread jujulj
Hi, I get the data shown below from the json geonames web service. What's the best way to get the name value of the alternateNames with a given lang value? Do I have to loop in the array to find it? thanks {u'adminCode1': u'09', u'adminName1': u'The Federal District', u'adminName2': u'', u'a

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Stefan Behnel
boblatest, 27.11.2009 13:18: > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer items than the tuple, I'd like the remaining > tuple elements to be set to "None". If the list is longer, I'd like

python logging filters

2009-11-27 Thread Grimsqueaker
I have found some strange behaviour when using the Python 2.6 logging module, maybe someone here can explain what's happening? When I add a Filter to a Handler, everything works as expected (ie. all messages sent from Loggers below the Filter's level are allowed through), but when I add the Filter

Re: Filling in a tuple from unknown size list

2009-11-27 Thread Peter Otten
boblatest wrote: > Hello all, > > (sorry for posting from Google. I currently don't have access to my > normal nntp account.) > > Here's my question: Given a list of onknown length, I'd like to be > able to do the following: > > (a, b, c, d, e, f) = list > > If the list has fewer items than th

Filling in a tuple from unknown size list

2009-11-27 Thread boblatest
Hello all, (sorry for posting from Google. I currently don't have access to my normal nntp account.) Here's my question: Given a list of onknown length, I'd like to be able to do the following: (a, b, c, d, e, f) = list If the list has fewer items than the tuple, I'd like the remaining tuple el

Re: Access to file in Windows Xp

2009-11-27 Thread Jon Clements
On Nov 27, 11:26 am, FelixCatus wrote: > Good morning to all, > I have written a simple python script that extracts data from a lot > (800Mb) of text files. > Now... In Linux the extraction runs in more or less 1s in Windows Xp > it takes 325 - 326 s. I find that really hard to believe; I don't t

Access to file in Windows Xp

2009-11-27 Thread FelixCatus
Good morning to all, I have written a simple python script that extracts data from a lot (800Mb) of text files. Now... In Linux the extraction runs in more or less 1s in Windows Xp it takes 325 - 326 s. The hardware is the same. I have also noticed somehing similar when moving the files from a dire

Re: Python Programming Challenges for beginners?

2009-11-27 Thread Jon Clements
On Nov 27, 9:43 am, n00m wrote: > > You're missing some sub-strings. > > Yes! :) Of course, if you take '~' literally (len(s) <= -10001) I reckon you've got way too many :) Jon. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-11-27 Thread Marco Mariani
??,??? wrote: or is it possible for large source files? Google for polystyle. It's a tool that reformats a program (in several languages) using an example you must provide (let's call it a "style sheet", written in Python or whatever) of how you would want to format it. You can then refo

Re: How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-27 Thread Jon Clements
On Nov 27, 10:36 am, "++imanshu" wrote: >     Is there a script/module to detect the use of unassigned > (undefined) variables(functions) in python. e.g. can I detect the > problem on line 3 automatically :- > > i = 1 > if i == 3: >     print o > print i > > Thank You, > ++imanshu pychecker retur

Re: hex int and string

2009-11-27 Thread Marco Mariani
Ben Finney wrote: i'm using pyscard I don't know what that is; can you give a link to what you're referring to? Simple story: he has seen the examples with hex literals and didn't know what they were. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex int and string

2009-11-27 Thread Marco Mariani
luca72 wrote: i have checked and pyscard accept also the decimal notation, I'm not sure you ever understood what the problem was, or where, but I'm happy you feel like you've solved it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber wrote: > On Thu, 26 Nov 2009 13:32:12 -0500, Victor Subervi > declaimed the following in > gmane.comp.python.general: > > > > A problem occurred in a Python script. Here is the sequence of function > > calls leading up to the error, in the order

How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-27 Thread ++imanshu
Is there a script/module to detect the use of unassigned (undefined) variables(functions) in python. e.g. can I detect the problem on line 3 automatically :- i = 1 if i == 3: print o print i Thank You, ++imanshu -- http://mail.python.org/mailman/listinfo/python-list

Re: IDE+hg

2009-11-27 Thread NiklasRTZ
welcome continue python (naturally not java:) less wind and less komdo since the 2 are unavailible, or I add button to drPython,Eric,Boa,PIDA alternatively oldschool emacs for this all natural function you make so difficult. -- http://mail.python.org/mailman/listinfo/python-list

Re: hex int and string

2009-11-27 Thread Peter Otten
luca72 wrote: > i'm using pyscard > > and for send a command he need a list like this: > > cmd = [0xdd,0xff, etc] Note that 0xdd is exactly the same as 221: >>> 0xdd == 221 True It's just an alternative way to write an integer literal that is sometimes more convenient. Therefore you don't ne

Re: hex int and string

2009-11-27 Thread Ben Finney
(Please don't top-post; it makes the message difficult to follow. Instead, post inline to the quoted material you're responding to, and remove material that you're not responding to.) luca72 writes: > i'm using pyscard I don't know what that is; can you give a link to what you're referring to?

Re: hex int and string

2009-11-27 Thread luca72
i have checked and pyscard accept also the decimal notation, Thanks Luca On 27 Nov, 10:38, Lie Ryan wrote: > On 11/27/2009 8:28 PM, luca72 wrote: > > > i'm using pyscard > > > and for send a command he need a list like this: > > > cmd = [0xdd,0xff, etc] > > > the problem is that i get a text >

  1   2   >