Re: Python Programming Challenges for beginners?

2009-11-27 Thread Wolodja Wentland
On Thu, Nov 26, 2009 at 19:24 -0800, astral orange wrote: > 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 challenge

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

2009-11-27 Thread Peter Otten
cmptrwhz wrote: > 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 exampl

hex int and string

2009-11-27 Thread luca72
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://mail.python.org/mailman/listinfo/python-list

Re: hex int and string

2009-11-27 Thread Ben Finney
luca72 writes: > str = 'D3' Be careful when choosing names. Here you have clobbered the existing string type binding to the name ‘str’. > and i need to trasform in 0xd3 type int and not type string how i can > do this? You already have the answer; you used it in your example below. I can only

Re: hex int and string

2009-11-27 Thread luca72
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 0xdd for the list and if i use hex i have a sting that is not what i need Luca On 27 Nov, 10:22, Ben Finney wrote: > luca72 writes:

Re: Python Programming Challenges for beginners?

2009-11-27 Thread John McMonagle
n00m wrote: > On Nov 27, 5:24 am, astral orange <[email protected]> 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' > I

Re: hex int and string

2009-11-27 Thread [email protected]
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 0xdd for the list and if i use hex i have > a sting that is not what i need > > Luca >

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

2009-11-27 Thread [email protected]
On 11月27日, 下午3时45分, cmptrwhz wrote: > 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://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="spor

Re: hex int and string

2009-11-27 Thread Lie Ryan
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 like dd and i need to trasform it in 0xdd for the list and if i use hex i have a sting that is not what i need >>> # Do you know th

Re: Anything equivalent to cassert in C++?

2009-11-27 Thread Bruno Desthuilliers
Jean-Michel Pichavant a écrit : (snip) I personally never use asserts in python, cause I will end up handling with asserts what I should in fact handle properly in what you call the production code. Not the same concern. Assertions are here for 1/ documention of expected state / value / pre|

Re: string payload expected: error

2009-11-27 Thread Ramdas
On Nov 27, 2:39 am, Lie Ryan 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 attachm

Re: Python Programming Challenges for beginners?

2009-11-27 Thread n00m
> You're missing some sub-strings. Yes! :) -- http://mail.python.org/mailman/listinfo/python-list

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 >

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 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: 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

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: 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

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: 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: 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: 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: 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

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: 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

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: 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

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 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

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: 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':

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: 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: extending optionparser to accept multiple comma delimited input for one arg

2009-11-27 Thread cmptrwhz
On Nov 27, 2:33 am, Peter Otten <[email protected]> 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

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: 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

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: 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: 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: 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 < > [email protected]> > > wrote: > >> Nothing hinting at having > >> opened an interactive Python console and typing statemen

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: Python Programming Challenges for beginners?

2009-11-27 Thread J Kenneth King
astral orange <[email protected]> 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

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: 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 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: Python Programming Challenges for beginners?

2009-11-27 Thread MRAB
n00m wrote: On Nov 27, 5:24 am, astral orange <[email protected]> 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: 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: 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: 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: 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

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
On Nov 27, 6:00 pm, Paul Rudin wrote: > efficiency ... This is it! -- http://mail.python.org/mailman/listinfo/python-list

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: 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: 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 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: 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 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: 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: 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: 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

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: 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

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: 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

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: 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 = '

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 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: 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: 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: 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: 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

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

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

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

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 <[email protected]> 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

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),

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: 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

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: 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 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

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 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

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: 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: 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: 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: 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.

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

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

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

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: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: 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: hex int and string

2009-11-27 Thread jessica
On 11月27日, 下午5时35分, "[email protected]" <[email protected]> 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: 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: 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 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

  1   2   >