odict the Ordered Diction 0.2.2

2006-11-29 Thread Fuzzyman
After a break of almost a year there has been an update to `odict the Ordered Dictionary http://www.voidspace.org.uk/python/odict.html`_. The latest version is 0.2.2, with changes implemented by Nicola Larosa. Despite over 700 downloads since May (plus 1300 as part of `pythonutils

ANN: FileTrack 0.1-beta3 is released

2006-11-29 Thread t . koutsovassilis
FileTrack is a Web-enabled communication log, keeping track of all of your company's inbound and outbound documents. It supports multiple logs, auto-archiving of older entries, and generates simple reports based on multiple criteria. One or more log entries, contacts, or documents can be grouped

PIL throws exception when reading bitmap/pnm data

2006-11-29 Thread Cameron Walsh
Hi all, I'm trying to extract the data from a bitmap or .pnm file using the following code: import Image img = Image.open(test.bmp,r) data=img.getdata() Unfortunately I get the following exception on Linux, but not on Windows: data=img.getdata() Traceback (most recent call last): File

Re: Question about import and sys.path

2006-11-29 Thread Rob Wolfe
Frank Millman wrote: One small point. The docs have the following warning - Important: the caller is responsible for closing the file argument, if it was not None, even when an exception is raised. This is best done using a try ... finally statement. I have added this to my code. I

Re: Reading text labels from a Win32 window

2006-11-29 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: [EMAIL PROTECTED] schrieb: Does anyone know of a way to read text labels from a Win32 application. I am familiar with using pywin32 and the SendMessage function to capture text from Buttons,text boxex, comboboxes, etc, however, the text I am would like to capture

Re: Using SimpleXMLRPCServer in a Windows Service

2006-11-29 Thread Gabriel Genellina
At Tuesday 28/11/2006 05:49, Rudy Schockaert wrote: I found the problem. Actually both pieces of code work now. The problem was that when I run the SimpleXMLRPCService in a Windows Service, the STDERR needs to be redirected to a real file. I guess some kind of buffer overflow occurs when you

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-29 Thread Antoon Pardon
On 2006-11-28, Leo Kislov [EMAIL PROTECTED] wrote: Antoon Pardon wrote: This little program gives IMO a strange result. import imaplib user = cpapen cyr = imaplib.IMAP4(imap.vub.ac.be) cyr.login(cyrus, cOn-A1r) rc, lst = cyr.list('', user/%s/* % user) for el in lst: print %r % (el,)

[PyQt] windows problem

2006-11-29 Thread hankpai
Dumb question from extreme newbie. Steps so far: 1. Installed Python 2.5 2. Installed Qt 4.2.1 (with mingw) from executable 3. Installed PyQt 4.1 from executable Been trying to run the first example (t1.pyw) in the tutorials folder, but the following error pops up while running the from

Re: [PyQt] windows problem

2006-11-29 Thread Phil Thompson
On Wednesday 29 November 2006 8:12 am, [EMAIL PROTECTED] wrote: Dumb question from extreme newbie. Steps so far: 1. Installed Python 2.5 2. Installed Qt 4.2.1 (with mingw) from executable 3. Installed PyQt 4.1 from executable Been trying to run the first example (t1.pyw) in the tutorials

Re: splitting a long string into a list

2006-11-29 Thread Frederic Rentsch
ronrsr wrote: still having a heckuva time with this. here's where it stand - the split function doesn't seem to work the way i expect it to. longkw1,type(longkw): Agricultural subsidies; Foreign aid;Agriculture; Sustainable Agriculture - Support; Organic Agriculture; Pesticides, US,

Re: windows problem

2006-11-29 Thread hankpai
thanks :)! On Nov 29, 12:35 am, Phil Thompson [EMAIL PROTECTED] wrote: On Wednesday 29 November 2006 8:12 am, [EMAIL PROTECTED] wrote: Dumb question from extreme newbie. Steps so far: 1. Installed Python 2.5 2. Installed Qt 4.2.1 (with mingw) from executable 3. Installed PyQt 4.1

Small prog question from a newbie: abt variables in a function definition

2006-11-29 Thread B Shyam Sundar
Hi all, I am a newbie as far as python is concerned ... I am trying to write a code for playing bridge in obj oriented manner .. Well ... i have this small problem: class hand: def __init__(self,set_of_cards=[]): self.set_of_cards=set_of_cards card_played_flag =0 def

Re: Python program that validates an url against w3c markup validator

2006-11-29 Thread Gabriel Genellina
At Wednesday 29/11/2006 02:29, yaru22 wrote: I'd like to create a program that validates bunch of urls against the w3c markup validator (http://validator.w3.org/) and store the result in a file. Since I don't know network programming, I have no idea how to start coding this program. Why not

Asyncore Medusa Example

2006-11-29 Thread Graeme Matthew
Hi all does anyone know where you can find examples of how to write a native python webserver, I have looked at medusa and asyncore but there are no real examples and the doco is very light any help is appreciated regards graeme -- http://mail.python.org/mailman/listinfo/python-list

Re: Small prog question from a newbie: abt variables in a function definition

2006-11-29 Thread Gabriel Genellina
At Wednesday 29/11/2006 06:48, B Shyam Sundar wrote: I am a newbie as far as python is concerned ... I am trying to write a code for playing bridge in obj oriented manner .. Well ... i have this small problem: class hand: def __init__(self,set_of_cards=[]):

Re: Asyncore Medusa Example

2006-11-29 Thread Gabriel Genellina
At Wednesday 29/11/2006 07:23, Graeme Matthew wrote: does anyone know where you can find examples of how to write a native python webserver, I have looked at medusa and asyncore but there are no real examples and the doco is very light The Python standard library already comes with a native

Re: utf - string translation

2006-11-29 Thread Frederic Rentsch
Dan wrote: On 22 nov, 22:59, John Machin [EMAIL PROTECTED] wrote: processes (Vigenère) So why do you want to strip off accents? The history of communication has several examples of significant difference in meaning caused by minute differences in punctuation or accents including

Re: proof of concept python and tkinter gnugo interface

2006-11-29 Thread grindel
Anton Vredegoor wrote: For the last few days I've been doodling with a script that provides a graphical interface to gnugo by using its GTP protocol. At the moment the script is *very* basic, in fact the only thing it does is to allow one to click on a coordinate and place a move there OR

shtoom or yate client source code

2006-11-29 Thread Croteam
Hello, Can somebody give me (if is that possible) source code of shtoom or yate client ( e.g. yate.exe or shtoom.exe client source code) and, Do you know any python voip module except shtoom and yate,if you know please tell me. I will appreciate any help!!

Re: Really closing stdout (was: fork and exit needed?)

2006-11-29 Thread Nick Craig-Wood
Mitja Trampus [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: I'm not sure how you do open stdout to /dev/null in python though! I suspect something like this... import posix posix.close(1) posix.open(/dev/null, posix.O_WRONLY) Yes, you're close enough... The explanations are

Re: shtoom or yate client source code

2006-11-29 Thread Paul Boddie
Croteam wrote: Can somebody give me (if is that possible) source code of shtoom or yate client Take a look at the SourceForge downloads page for Shtoom: http://sourceforge.net/project/showfiles.php?group_id=94774 The project is actually hosted at divmod.com...

Processing Solid Edge objects

2006-11-29 Thread Maria R
I consider using Python to process Solid Edge .par .asm etc objects. Solid Edge provides a pretty rich documentation and tutorials. Still, when trying it out, using PyWin32, I get somewhat frustrated. So, I hope for someone out there to be willing to share experiences. The objective is to

Re: Wrapping A Shell

2006-11-29 Thread Nick Craig-Wood
Jeremy Moles [EMAIL PROTECTED] wrote: I'm not sure if this is really the right place to ask this question, but since the implementation is in Python, I figured I'd give it a shot. I want to wrap a shell process using popen inside of python program rather than creating a new shell process

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-29 Thread Leo Kislov
Antoon Pardon wrote: On 2006-11-28, Leo Kislov [EMAIL PROTECTED] wrote: Antoon Pardon wrote: This little program gives IMO a strange result. import imaplib user = cpapen cyr = imaplib.IMAP4(imap.vub.ac.be) cyr.login(cyrus, cOn-A1r) rc, lst = cyr.list('', user/%s/* % user)

Re: Processing Solid Edge objects

2006-11-29 Thread olive
It would help if you could give an exemple of .par and .asm file. Is it human readable, XML ... ? Is there any other import/export file format provided ? Maria R a écrit : I consider using Python to process Solid Edge .par .asm etc objects. Solid Edge provides a pretty rich documentation and

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-29 Thread Antoon Pardon
On 2006-11-29, Leo Kislov [EMAIL PROTECTED] wrote: Antoon Pardon wrote: On 2006-11-28, Leo Kislov [EMAIL PROTECTED] wrote: Are there more docs than at http://www.python.org/doc/. I don't find those very helpfull in explaining this. I also took a look at rfc 2060 and to be honest I don't

Re: screen output problem

2006-11-29 Thread Ritesh Raj Sarraf
I'm not sure if there is a definite solution to this problem. I've noticed that one of the applications, which I use on a daily basis (apt from Debian) does address the progress bar issue in another way. When apt tries to download multiple files, it displays the progress of all the downloads on

Re: Processing Solid Edge objects

2006-11-29 Thread Maria R
olive skrev: It would help if you could give an exemple of .par and .asm file. Is it human readable, XML ... ? Is there any other import/export file format provided ? The .par files and friends are in binary format so the method I prefer is using the provided COM interfaces and access the

Re: Error handling. Python embedded into a C++ app.

2006-11-29 Thread Wolfram
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You would use try: and then on the next line except: Thanks for the idea, but it did not help. I can not wrap every pythion line in python, so I wrote the following code on the C++ side: -- snip - try { int

Re: ANN: CherryPy 3.0 RC1

2006-11-29 Thread Christian
Christian Wyglendowski [EMAIL PROTECTED] writes: I'm happy to announce the first release candidate for CherryPy 3.0. Ben Finney wrote: Congratulations, I'm glad to see an announcement for CherryPy. Please, in future, don't send HTML message bodies to public forums; plain text is far

Re: ANN: CherryPy 3.0 RC1

2006-11-29 Thread James Cunningham
On 2006-11-29 08:37:46 -0500, Christian [EMAIL PROTECTED] said: Christian Wyglendowski [EMAIL PROTECTED] writes: I'm happy to announce the first release candidate for CherryPy 3.0. Ben Finney wrote: Congratulations, I'm glad to see an announcement for CherryPy. Please, in future,

Re: pyxpcom

2006-11-29 Thread hg
Trent Mick wrote: My need is as follows: I have developed an activex component to access a smart card on the client side / do some web site logon. Are xpcom / pyxpcom advanced/stable enough for such an implementation under Linux / Windows ? You mean to provide the equivalent functionality

odict the Ordered Diction 0.2.2

2006-11-29 Thread Fuzzyman
After a break of almost a year there has been an update to `odict the Ordered Dictionary http://www.voidspace.org.uk/python/odict.html`_. The latest version is 0.2.2, with changes implemented by Nicola Larosa. Despite over 700 downloads since May (plus 1300 as part of `pythonutils

Stani's Python Editor is looking for a new webhost

2006-11-29 Thread SPE - Stani's Python Editor
SPE was hosted for a long while by Zettai. I'd like to thank them again for their wonderful service. Unfortunately they will go out of business. So SPE is looking for a new webhost. These are the requirements: - python framework (Zope/Plone, django, turbogears, ...) - I have the freedom to use

trouble writing results to files

2006-11-29 Thread lisa . engblom
I have two semi related questions... First, I am trying to output a list of strings to a csv file using the csv module. The output file separates each letter of the string with a comma and then puts each string on a separate line. So the code is: import csv output =

Calling functions with dynamic arguments

2006-11-29 Thread SeanDavis12
I have a dictionary like: {a:1, b:2} and I want to call a function: def func1(a=3,b=4): print a,b so that I get a=1,b=2, how can I go about that? Thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling functions with dynamic arguments

2006-11-29 Thread Roberto Bonvallet
SeanDavis12 wrote: I have a dictionary like: {a:1, b:2} and I want to call a function: def func1(a=3,b=4): print a,b so that I get a=1,b=2, how can I go about that? func1(**yourdict) -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting recursion loops

2006-11-29 Thread Rob Wolfe
robert wrote: My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to endless recursions and after expensive I/O to the Python recursion exception. What would be a good method to detect recursion loops and stop it by user-Exception

Re: trouble writing results to files

2006-11-29 Thread Roberto Bonvallet
[EMAIL PROTECTED] wrote: import csv output = csv.writer(open('/Python25/working/output.csv', 'a')) a = [apple, cranberry, tart] for elem in range(len(a)): output.writerow(a[elem]) output.writerow expects a sequence as an argument. You are passing a string, which is a sequence of

Re: Calling functions with dynamic arguments

2006-11-29 Thread SeanDavis12
Roberto Bonvallet wrote: SeanDavis12 wrote: I have a dictionary like: {a:1, b:2} and I want to call a function: def func1(a=3,b=4): print a,b so that I get a=1,b=2, how can I go about that? func1(**yourdict) Thanks, Roberto. Sean --

Re: trouble writing results to files

2006-11-29 Thread Neil Cerutti
On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? -- Neil Cerutti You can't give him that cutback lane. He's so fast, and he sees it so well. He can also run away from you if

How to detect what type a variable is?

2006-11-29 Thread Leandro Ardissone
Hi, I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble writing results to files

2006-11-29 Thread Roberto Bonvallet
Neil Cerutti wrote: On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? enumerate is your friend :) for n, item in enumerate(a): if f(item): a[n] =

Re: How to detect what type a variable is?

2006-11-29 Thread Grant Edwards
On 2006-11-29, Leandro Ardissone [EMAIL PROTECTED] wrote: I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. x = 'asdf' type(x) type 'str' i = 0 type(i) type 'int' -- Grant

Re: How to detect what type a variable is?

2006-11-29 Thread Neil Cerutti
On 2006-11-29, Grant Edwards [EMAIL PROTECTED] wrote: On 2006-11-29, Leandro Ardissone [EMAIL PROTECTED] wrote: I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. x = 'asdf' type(x)

Re: How to detect what type a variable is?

2006-11-29 Thread SeanDavis12
Leandro Ardissone wrote: Hi, I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. type(variable) Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble writing results to files

2006-11-29 Thread Neil Cerutti
On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: Neil Cerutti wrote: On 2006-11-29, Roberto Bonvallet [EMAIL PROTECTED] wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? enumerate is your friend :) for n,

Re: Detecting recursion loops

2006-11-29 Thread Carl Banks
robert wrote: My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to endless recursions and after expensive I/O to the Python recursion exception. What would be a good method to detect recursion loops and stop it by user-Exception

Re: Asyncore Medusa Example

2006-11-29 Thread Fredrik Lundh
Graeme Matthew wrote: does anyone know where you can find examples of how to write a native python webserver, I have looked at medusa and asyncore but there are no real examples and the doco is very light medusa *is* a web server based on asyncore, so you should be able to use it more or

Re: trouble writing results to files

2006-11-29 Thread Fredrik Lundh
Neil Cerutti wrote: BTW, iterating over range(len(a)) is an anti-pattern in Python. Unless you're modifying elements of a, surely? and needs to run on a Python version that doesn't support enumerate. /F -- http://mail.python.org/mailman/listinfo/python-list

Overloading if object unary operator

2006-11-29 Thread Sarcastic Zombie
Good morning, If I have a class class A: __init__(id) self.id = id is there any way to overload the 'if' unary usage to detect if a variable has a value? For example, in the code: a = A(56) if a: print Hoo hah! how can I insure that the if will come back true and fire off the

Re: trouble writing results to files

2006-11-29 Thread lisa . engblom
Roberto Bonvallet wrote: [EMAIL PROTECTED] wrote: import csv output = csv.writer(open('/Python25/working/output.csv', 'a')) a = [apple, cranberry, tart] for elem in range(len(a)): output.writerow(a[elem]) output.writerow expects a sequence as an argument. You are passing a

Re: Reading GDSII layouts

2006-11-29 Thread Vincent Arnoux
Le mardi 28 novembre 2006 17:56, Paddy a écrit : The link you gave states this near the top: IPKISS is a python-based library for the generation of GDSII layouts, including hierarchy. It has grown out of the GDS_KEY library, but it is more flexible and object oriented. Contrary to

Re: Reading GDSII layouts

2006-11-29 Thread Vincent Arnoux
Le mardi 28 novembre 2006 18:46, Jacob Rael a écrit : Funny, I started writing one this past weekend as a learning exercise (handling large files and start to use classes). If ipkiss does not work out, let me know specifically what you need and maybe my hack will work. jr Well, if you know

Re: Overloading if object unary operator

2006-11-29 Thread Roberto Bonvallet
Sarcastic Zombie wrote: For example, in the code: a = A(56) if a: print Hoo hah! how can I insure that the if will come back true and fire off the print if and only if self.id is defined? I want to do this in an overloaded, generic way, if possible; I know that I could test for a.id.

Re: How to detect what type a variable is?

2006-11-29 Thread Leandro Ardissone
great, thanks And how I can compare this type 'str' output ? I want to decide what to do if the var is an string and what to do if not.. Tried with: if type(artistList) == type 'list': and if type(artistList) == list: but nothing.. On Nov 29, 12:41 pm, Grant Edwards [EMAIL PROTECTED] wrote:

Re: How to detect what type a variable is?

2006-11-29 Thread Leandro Ardissone
Thanks, I don't store Python objects in xml, but I get an object from a library that parses xml and converts it to objects. On Nov 29, 12:43 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2006-11-29, Grant Edwards [EMAIL PROTECTED] wrote: On 2006-11-29, Leandro Ardissone [EMAIL PROTECTED]

Re: Overloading if object unary operator

2006-11-29 Thread Peter Otten
Sarcastic Zombie wrote: is there any way to overload the 'if' unary usage to detect if a variable has a value? Define a __nonzero__() or __len__() method. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to detect what type a variable is?

2006-11-29 Thread Roberto Bonvallet
Leandro Ardissone wrote: And how I can compare this type 'str' output ? I want to decide what to do if the var is an string and what to do if not.. Tried with: if type(artistList) == type 'list': and if type(artistList) == list: but nothing.. type() doesn't return a string, it

Re: Overloading if object unary operator

2006-11-29 Thread Sarcastic Zombie
On Nov 29, 11:26 am, Peter Otten [EMAIL PROTECTED] wrote: Sarcastic Zombie wrote: is there any way to overload the 'if' unary usage to detect if a variable has a value?Define a __nonzero__() or __len__() method. Peter Thanks to both of you, it worked perfectly. I must have missed it in

Re: trouble writing results to files

2006-11-29 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I can try that. Is using range(len(a)) a bad solution in the sense that its likely to create an unexpected error? Or because there is a more efficient way to accomplish the same thing? for-in uses an internal index counter to fetch items from the sequence, so

Using Python

2006-11-29 Thread beemer328i2004
Hi Guys, I am new to this language and i need some help... I am trying to create a script that will go into a log file and bring me back the xml from an order... For example: go into Log1.xml and extract order number 2 from top to bottom and extract it into a txt file... Does anyone know

Re: How to detect what type a variable is?

2006-11-29 Thread Leandro Ardissone
great, that is just what I need! Thank you all! -- Leandro Ardissone On Nov 29, 1:29 pm, Roberto Bonvallet [EMAIL PROTECTED] wrote: Leandro Ardissone wrote: And how I can compare this type 'str' output ? I want to decide what to do if the var is an string and what to do if not..

Re: How to detect what type a variable is?

2006-11-29 Thread Daniel Klein
On 29 Nov 2006 08:25:35 -0800, Leandro Ardissone [EMAIL PROTECTED] wrote: great, thanks And how I can compare this type 'str' output ? I want to decide what to do if the var is an string and what to do if not.. Tried with: if type(artistList) == type 'list': and if type(artistList) == list:

Re: Overloading if object unary operator

2006-11-29 Thread Fredrik Lundh
Sarcastic Zombie wrote: If I have a class class A: __init__(id) self.id = id is there any way to overload the 'if' unary usage to detect if a variable has a value? http://effbot.org/pyref/__nonzero__ /F -- http://mail.python.org/mailman/listinfo/python-list

Re: why would anyone use python when java is there?

2006-11-29 Thread Adam Jones
gregarican wrote: gavino wrote: wtf You have to be trolling I would think. Yeah, gavino has been trolling comp.lang.lisp for quite some time. For the life of me I can't understand why he would troll comp.lang.python when comp.lang.lisp is there. -Adam --

Re: How to detect what type a variable is?

2006-11-29 Thread [EMAIL PROTECTED]
Leandro Ardissone wrote: Hi, I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. You should try to treat it as a list, catch the exceptions raise when it is a string (problably

Re: Using Python

2006-11-29 Thread hg
beemer328i2004 wrote: Hi Guys, I am new to this language and i need some help... I am trying to create a script that will go into a log file and bring me back the xml from an order... For example: go into Log1.xml and extract order number 2 from top to bottom and extract it into a

Re: why would anyone use python when java is there?

2006-11-29 Thread Antoine De Groote
+1 Éric Daigneault wrote: wtf a reasonable question... But before I run circle yelling the trolls are here, the trolls are here I got one for you... why would anyone use java when python is there?? ;-) .^_^. Eric :D, --

Re: pyxpcom

2006-11-29 Thread Trent Mick
hg wrote: Trent Mick wrote: My need is as follows: I have developed an activex component to access a smart card on the client side / do some web site logon. Are xpcom / pyxpcom advanced/stable enough for such an implementation under Linux / Windows ? You mean to provide the equivalent

Re: How to detect what type a variable is?

2006-11-29 Thread Luis M. González
Leandro Ardissone wrote: great, thanks And how I can compare this type 'str' output ? I want to decide what to do if the var is an string and what to do if not.. Tried with: if type(artistList) == type 'list': and if type(artistList) == list: but nothing.. You shouldn't enclose

Re: How to refer to Python?

2006-11-29 Thread Alan Isaac
On Tue, 28 Nov 2006 16:51:10 -0500, Fredrik Lundh [EMAIL PROTECTED] wrote: http://effbot.org/pyfaq/are-there-any-published-articles-about-python-that-i-can-reference.htm Maybe:

Re: Processing Solid Edge objects

2006-11-29 Thread obnmfrbeqzgkst
I've done a similar thing with Python and Catia in the past. I used late binding to the Catia objects and I didn't have any real issues. Things to remember: Remove all of the Set statements No need to : set obj = XYZ just obj =XYZ Include the brackets with all Sub calls. VB is sloppy and

Re: How to detect what type a variable is?

2006-11-29 Thread Grant Edwards
On 2006-11-29, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Leandro Ardissone wrote: Hi, I want to know what type is a variable. For example, I get the contents of an xml but some content is a list or a string, and I need to know what type it is. You should try to treat it as a list, catch

Re: How to detect what type a variable is?

2006-11-29 Thread Tim Chase
I want to know what type is a variable. You should try to treat it as a list, catch the exceptions raise when it is a string (problably ValueError, TypeError ou Attribute error, depends on what are you doing), and then treat it as a string. This is the BAFP (better ask for forgiveness than

pickle and infinity

2006-11-29 Thread Bart Ogryczak
Hello, I´ve got this problem with pickle, it seems it doesn´t handle correctly infinite values (nor does Python return overflow/underflow error). What could I do about it? Example code: x = 1e310 #actually it would be a result of calculations type(x) type 'float' x 1.#INF import pickle

Re: pickle and infinity

2006-11-29 Thread Bart Ogryczak
To make things more interesting -- Solaris version: x = 1e310 x Infinity import pickle pickle.dumps(x) 'FInfinity\n.' pickle.loads(_) Infinity pickle.dumps(x,1) [...] SystemError: frexp() result out of range -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle and infinity

2006-11-29 Thread Grant Edwards
On 2006-11-29, Bart Ogryczak [EMAIL PROTECTED] wrote: I´ve got this problem with pickle, it seems it doesn´t handle correctly infinite values (nor does Python return overflow/underflow error). What could I do about it? Here's what I did. I'm sure it'll fall down on some systems, but it works

Re: How to refer to Python?

2006-11-29 Thread Bart Ogryczak
Sebastian Bassi wrote: I am writing a paper where I refer to Python. Is there a paper that I can refer the reader to? Or just use the Python web page as a reference? I´d refer to The Python Language Reference Manual, Guido Van Rossum, Fred L., Jr. Drake Network Theory Ltd (September 2003),

Re: Using Python

2006-11-29 Thread Larry Bates
beemer328i2004 wrote: Hi Guys, I am new to this language and i need some help... I am trying to create a script that will go into a log file and bring me back the xml from an order... For example: go into Log1.xml and extract order number 2 from top to bottom and extract it into a

Re: How to detect what type a variable is?

2006-11-29 Thread Eduardo \EdCrypt\ O. Padoan
One might prefer to check for string-ness, as strings can duck-type somewhat like lists: my_list = ['my', 'brain', 'hurts'] my_string = 'Are you the brain specialist?' for test in [my_list, my_string]: try: for thing in test: process_list_item(thing)

libboost, python, and dijkstra shortest path

2006-11-29 Thread Bytter
Hi everyone, I need to implement a very quick (performance-wise) Dijkstra shortest path in python, and found that libboost already has such thing. Problem is: I cannot find the installation package for my Python 2.4 under windows. Can someone please provide me instructions for installing libboost

Surprise with special floating point values

2006-11-29 Thread prouleau001
Hi all, While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point values and found that both Python 2.4 and 2.5 return False when comparing a NaN with itself. Although surprising, I imagine it could also be correct since NaN is not a

Re: Detecting recursion loops

2006-11-29 Thread Bytter
Hi! I hope you are not trying to find infinite loops and I simply misunderstood your question. Because if you are, then forget it (Turing anyone?)... Infinite loops are impossible to find (minus some few, very specific situations). Cf. http://en.wikipedia.org/wiki/Halting_problem Cheers, Hugo

Re: Surprise with special floating point values

2006-11-29 Thread prouleau001
On Nov 29, 12:53 pm, [EMAIL PROTECTED] wrote: Hi all, While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point values and found that both Python 2.4 and 2.5 return False when comparing a NaN with itself. Although surprising, I

Re: pickle and infinity

2006-11-29 Thread Fredrik Lundh
Bart Ogryczak wrote: I´ve got this problem with pickle, it seems it doesn´t handle correctly infinite values (nor does Python return overflow/underflow error). Python 2.X relies on the C library to serialize floats, and, as you've noticed, some C libraries can produce values that they

Re: pyxpcom

2006-11-29 Thread hg
Trent Mick wrote: hg wrote: Trent Mick wrote: My need is as follows: I have developed an activex component to access a smart card on the client side / do some web site logon. Are xpcom / pyxpcom advanced/stable enough for such an implementation under Linux / Windows ? You mean to provide

Re: Surprise with special floating point values

2006-11-29 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point values note that JSON doesn't support non-numeric floating point values, as can be seen by the number syntax description on this page:

Re: Detecting recursion loops

2006-11-29 Thread robert
Rob Wolfe wrote: robert wrote: My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to endless recursions and after expensive I/O to the Python recursion exception. What would be a good method to detect recursion loops and stop it by

Re: Detecting recursion loops

2006-11-29 Thread robert
Carl Banks wrote: robert wrote: My code does recursion loops through a couple of functions. Due to problematic I/O input this leads sometimes to endless recursions and after expensive I/O to the Python recursion exception. What would be a good method to detect recursion loops and stop it by

Re: pickle and infinity

2006-11-29 Thread Bart Ogryczak
Fredrik Lundh wrote: Bart Ogryczak wrote: I´ve got this problem with pickle, it seems it doesn´t handle correctly infinite values (nor does Python return overflow/underflow error). Python 2.X relies on the C library to serialize floats, and, as you've noticed, some C libraries can

Re: Detecting recursion loops

2006-11-29 Thread John Machin
robert wrote: the bug comes in from the I/O input. Have you considered checking your input for valid values? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

SPE refuses.

2006-11-29 Thread egbert
According to apt-show-versions I have installed: python-wxgtk2.6 2.6.3.2.1.5 spe 0.8.2a+repack-1 However when I start SPE I get the message You need to install at least wxPython v2.5.4.1 to run SPE How do I tell SPE that I have the right wxPython ? e. -- Egbert Bouwman -

Re: OODB vs RDBMS

2006-11-29 Thread Magnus Lycka
Thomas Guettler wrote: Hi, most of the time I use ZODB/Durus to store my data. I like it, but I know that it has some weaknesses: - only accesible from python - I need to code your indexes for fast searching yourself. There are other features of relational database systems that I find

RE: Python work in UK

2006-11-29 Thread Sells, Fred
The technical director of Cabletron used to write applications in Python, then give the working product/code to the development group to convert. Perhaps you could build stuff in Python and outsource the conversion to India? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: Surprise with special floating point values

2006-11-29 Thread prouleau001
On Nov 29, 1:11 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point valuesnote that JSON doesn't support non-numeric floating point values, as can be seen

Re: SPE refuses.

2006-11-29 Thread SPE - Stani's Python Editor
If wxPython is rightly installed, which means that import wx works fine and wx.VERSION gives the right version, you can ignore the wxPython warning. Please cd do your site-packages directory and do python SPE.py --debug and see the error message. Stani On 29 nov, 19:51, egbert [EMAIL PROTECTED]

Re: libboost, python, and dijkstra shortest path

2006-11-29 Thread Bytter
Ok, found the solution here: http://www.osl.iu.edu/~dgregor/bgl-python/ But still cannot make anything that works... Anyone who has experience in this area can help me with the following code: import boost as bgl graph = bgl.Graph() a = graph.add_vertex() b = graph.add_vertex() e =

Re: why would anyone use python when java is there?

2006-11-29 Thread gregarican
He trolls other groups as well. Smalltalk for example -- http://groups.google.com/group/comp.lang.smalltalk/browse_thread/thread/1c83e576be824633/927227555661a2cd?lnk=gstq=gavinornum=1#927227555661a2cd. There are at least a dozen recent posts where he asks some obvious trollling line of

buildbot

2006-11-29 Thread Bryan
does anyone know if processes defined around buildbot would be similar to the one used by the mozilla seamonkey project which uses tinderbox? this link shows an example of an entire checkin cycle using tinderbox and it's quite detailed and gives a very good picture of what using the product would

  1   2   >