Re: XML-XSD Processing/Creation.

2008-01-03 Thread Stefan Behnel
paul wrote: Can i create python classes based off the XSD files? What else can I do with the XSD files? This might be worth looking at: http://www.rexx.com/~dkuhlman/#generateDS If it's really such a complex XML language, the tool above might or might not be of any help, as it doesn't support

Re: ElementTree should parse string and file in the same way

2008-01-03 Thread Stefan Behnel
Hi, Chris Mellon wrote: On that note, I really don't like APIs that take either a file name or a file object - I can open my own files, thanks. ... and HTTP URLs, and FTP URLs. In lxml, there is a performance difference between passing an open file (which is read in Python space using the

shelve and nested dictionaries

2008-01-03 Thread Matthew Schibler
I'm a newbie to Python, with some experience using perl (where I used nested arrays and hashes extensively). I am building a script in python for a MUD I play, and I want to use the shelve module to store persistent information between script executions. The following code does not work for me,

Re: sending commands in body of HTTP with urllib2

2008-01-03 Thread Astan Chee
Astan Chee wrote: Hi, Im trying to implement the logic from http://www.hypothetic.org/docs/msn/general/http_connections.php to a simple python code using urllib2 and some parts of urllib. Im behind a http proxy that requires authentication that is why Im using urllib2. Im asking for help

Re: shelve and nested dictionaries

2008-01-03 Thread Fredrik Lundh
Matthew Schibler wrote: I'm a newbie to Python, with some experience using perl (where I used nested arrays and hashes extensively). I am building a script in python for a MUD I play, and I want to use the shelve module to store persistent information between script executions. The following

Re: Manually installing PIL

2008-01-03 Thread Fredrik Lundh
Jose Ignacio Gisbert wrote: Does somebody install PIL manually??, I mean, copy directories manually without executing setup.py. I saw an identical message from Guirai, but I didn’t see any response. Thanks in advance! PIL's just a bunch of modules in a single PIL directory; you can put

Re: Extracting files from an ISO image?

2008-01-03 Thread Ant
On Jan 2, 7:07 pm, Rob Williscroft [EMAIL PROTECTED] wrote: Ant wrote in news:34a84caa-5387-40a2-a808- 1) Is there a module out there for extracting files from an ISO? There are command line programs that can do this: http://cdrecord.berlios.de/old/private/cdrecord.html ... One problem

Re: Cloning Environments

2008-01-03 Thread Diez B. Roggisch
gamename wrote: Hi, I have several machines running Linux (mostly fedora6) and Windows (mostly XP). I'm thinking of using easy_install to create as uniform an environment as possible for all of them. Cloning the environment, to put it another way. Is there a good example somewhere

PyObject_CallObject code dump after calling 4 times

2008-01-03 Thread grbgooglefan
I have a following C++ code which uses PyObject_CallObject to evaluate expressions dynamically. This code sets the input parameters for the function also dynamically. After calling this function 4 times (with these shown values), PyObject_CallObject causes application to crash in frame_dealloc.

Re: PyObject_CallObject code dump after calling 4 times

2008-01-03 Thread Fredrik Lundh
grbgooglefan wrote: I have a following C++ code which uses PyObject_CallObject to evaluate expressions dynamically. This code sets the input parameters for the function also dynamically. After calling this function 4 times (with these shown values), PyObject_CallObject causes application to

Re: PyObject_CallObject code dump after calling 4 times

2008-01-03 Thread Phil Thompson
On Thursday 03 January 2008, grbgooglefan wrote: I have a following C++ code which uses PyObject_CallObject to evaluate expressions dynamically. This code sets the input parameters for the function also dynamically. After calling this function 4 times (with these shown values),

Re: ElementTree should parse string and file in the same way

2008-01-03 Thread Fredrik Lundh
Stefan Behnel wrote: My take on the API decision in question was always that a file is inherently an XML *document*, while a string is inherently an XML *fragment*. Not inherently, no. I know some people who do web processing with an XML document coming in as a string (from an HTTP

Installing pcaplib

2008-01-03 Thread ashish
Hi All, I am trying to install pylibpcap-0.6.1 but i am getting these errors . python ./setup.py install . . . . . constants.c:172: (near initialization for `pcapmodule_DLT[52]') pcap.c: In function `init_pcap': pcap.c:4246: structure has no member named `value' pcap.c:4260: warning: passing

Re: PyObject_CallObject code dump after calling 4 times

2008-01-03 Thread grbgooglefan
On Jan 3, 8:02 pm, Phil Thompson [EMAIL PROTECTED] wrote: On Thursday 03 January 2008, grbgooglefan wrote: I have a following C++ code which uses PyObject_CallObject to evaluate expressions dynamically. This code sets the input parameters for the function also dynamically. After calling

Re: Cloning Environments

2008-01-03 Thread gamename
You might be interested in workingenv.py/virtualenv.py Thanks! That looks promising. -T -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing pcaplib

2008-01-03 Thread Diez B. Roggisch
ashish wrote: Hi All, I am trying to install pylibpcap-0.6.1 but i am getting these errors . python ./setup.py install . . . . . constants.c:172: (near initialization for `pcapmodule_DLT[52]') pcap.c: In function `init_pcap': pcap.c:4246: structure has no member named `value'

Re: reassign to builtin possible !?

2008-01-03 Thread Diez B. Roggisch
Bernhard Merkle wrote: Hi there, I am reading Learning Python 3e from Mark Lutz and just found out that reassigning to builtins is possible. What is the reason, why Python allows this ? IMO this is very risky and can lead to hard to find errors. (see also Learning Python 3e, Chapter 16,

reassign to builtin possible !?

2008-01-03 Thread Bernhard Merkle
Hi there, I am reading Learning Python 3e from Mark Lutz and just found out that reassigning to builtins is possible. What is the reason, why Python allows this ? IMO this is very risky and can lead to hard to find errors. (see also Learning Python 3e, Chapter 16, Page 315) True True False

Treating a unicode string as latin-1

2008-01-03 Thread Simon Willison
Hello, I'm using ElementTree to parse an XML file which includes some data encoded as cp1252, for example: nameBob\x92s Breakfast/name If this was a regular bytestring, I would convert it to utf8 using the following: print 'Bob\x92s Breakfast'.decode('cp1252').encode('utf8') Bob's Breakfast

Re: reassign to builtin possible !?

2008-01-03 Thread Bernhard Merkle
On Jan 3, 2:07 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: This hal always been possible. But it's not reassigning, it's shadowing - which is a totally different beast. Shadowing builtins is bad style, but lokal to your context. Which can get nasty of course, if you do the above on e.g.

Re: Treating a unicode string as latin-1

2008-01-03 Thread Duncan Booth
Simon Willison [EMAIL PROTECTED] wrote: How can I tell Python I know this says it's a unicode string, but I need you to treat it like a bytestring? Can you not just fix your xml file so that it uses the same encoding as it claims to use? If the xml says it contains utf8 encoded data then it

Trying to build python2.5.msi

2008-01-03 Thread abhishek
Hello Group, I have compile the python source code using MSVC 8 (a.k.a VS .NET 2005) . Can i create an MSI ?? similar to one provided by the official python website. What can be the possible procedure to achieve this. I have looked into Tools/msi folder. But i dont know how it works. Thank

Re: ElementTree should parse string and file in the same way

2008-01-03 Thread Stefan Behnel
Fredrik Lundh wrote: Stefan Behnel wrote: My take on the API decision in question was always that a file is inherently an XML *document*, while a string is inherently an XML *fragment*. Not inherently, no. I know some people who do web processing with an XML document coming in as a string

Re: reassign to builtin possible !?

2008-01-03 Thread Diez B. Roggisch
Bernhard Merkle wrote: On Jan 3, 2:07 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: This hal always been possible. But it's not reassigning, it's shadowing - which is a totally different beast. Shadowing builtins is bad style, but lokal to your context. Which can get nasty of course, if you

Re: Treating a unicode string as latin-1

2008-01-03 Thread Paul Hankin
On Jan 3, 1:31 pm, Simon Willison [EMAIL PROTECTED] wrote: How can I tell Python I know this says it's a unicode string, but I need you to treat it like a bytestring? u'Bob\x92s Breakfast'.encode('latin-1') -- Paul Hankin -- http://mail.python.org/mailman/listinfo/python-list

Re: Treating a unicode string as latin-1

2008-01-03 Thread Diez B. Roggisch
Simon Willison wrote: Hello, I'm using ElementTree to parse an XML file which includes some data encoded as cp1252, for example: nameBob\x92s Breakfast/name If this was a regular bytestring, I would convert it to utf8 using the following: print 'Bob\x92s

Re: reassign to builtin possible !?

2008-01-03 Thread Jeroen Ruigrok van der Werven
-On [20080103 14:47], Bernhard Merkle ([EMAIL PROTECTED]) wrote: Are you sure ? what about the following example ? Is this also shadowing ? It is, as it is local to your current executing interpreter. Any other Python process that is currently running is unaffected by your shadowing. So as Diez

Re: reassign to builtin possible !?

2008-01-03 Thread Tim Chase
But you can't alter the values for True/False globally with this. Are you sure ? what about the following example ? Is this also shadowing ? import __builtin__ __builtin__.True = False __builtin__.True False It doesn't seem to screw things up globally import __builtin__ t =

Re: ElementTree should parse string and file in the same way

2008-01-03 Thread Fredrik Lundh
Stefan Behnel wrote: also, putting large documents in a *single* Python string can be quite inefficient. it's often more efficient to use lists of string fragments. That's a pretty general statement. Do you mean in terms of reading from that string (which at least in lxml is a straight

CSV

2008-01-03 Thread Beema shafreen
Hi all, I have written a script to parse a CSV file: import csv def get_lines(fname): fhandle = csv.reader(open(fname,rb)) for line in fhandle: while fhandle.next()[0] == prot_hit_num: continue for row in fhandle: print row result =

Re: Treating a unicode string as latin-1

2008-01-03 Thread Jeroen Ruigrok van der Werven
-On [20080103 14:36], Simon Willison ([EMAIL PROTECTED]) wrote: How can I tell Python I know this says it's a unicode string, but I need you to treat it like a bytestring? Although it does not address the exact question it does raise the issue how you are using ElementTree. When I use

problem with global var

2008-01-03 Thread Bruno Ferreira
Hi, I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Here is a simplified version: ## 1 logfile = open (squid_access.log, r) 2 topsquid = [[0, 0, 0, 0, 0, 0, 0]] 3 4 def add_sorted (list): 5 for i in

Re: Pivot Table/Groupby/Sum question

2008-01-03 Thread patrick . waldo
Yes in the sense that the top part will have merged cells so that Horror and Classics don't need to be repeated every time, but the headers aren't the important part. At this point I'm more interested in organizing the data itself and i can worry about putting it into a new excel file later. --

Re: problem with global var

2008-01-03 Thread Matt Nordhoff
Bruno Ferreira wrote: Hi, I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Here is a simplified version: ## 1 logfile = open (squid_access.log, r) 2 topsquid = [[0, 0, 0, 0, 0, 0, 0]] 3 4 def

Who's to blame?

2008-01-03 Thread Nicola Musatti
Hallo, First of all I apologize for the longish example at the bottom, but the biggest source file is automatically generated and I didn't want to modify more than strictly necessary. Also, it would be shorter if XML wasn't so verbose ;-) The following is a wxPython/XRC toy program with a form

Re: unicode(s, enc).encode(enc) == s ?

2008-01-03 Thread mario
On Jan 2, 9:34 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: In any case, it goes well beyond the situation that triggered my original question in the first place, that basically was to provide a reasonable check on whether round-tripping a string is successful -- this is in the context of

Re: unicode(s, enc).encode(enc) == s ?

2008-01-03 Thread mario
Thanks again. I will chunk my responses as your message has too much in it for me to process all at once... On Jan 2, 9:34 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: Thanks a lot Martin and Marc for the really great explanations! I was wondering if it would be reasonable to imagine a

Re: problem with global var

2008-01-03 Thread wes
Bruno Ferreira wrote: Hi, I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Here is a simplified version: ## 1 logfile = open (squid_access.log, r) 2 topsquid = [[0, 0, 0, 0, 0, 0, 0]] 3 4 def

Re: problem with global var

2008-01-03 Thread Diez B. Roggisch
Bruno Ferreira wrote: Hi, I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Here is a simplified version: ## 1 logfile = open (squid_access.log, r) 2 topsquid = [[0, 0, 0, 0, 0, 0, 0]] 3 4 def

Re: Treating a unicode string as latin-1

2008-01-03 Thread Fredrik Lundh
Simon Willison wrote: But ElementTree gives me back a unicode string, so I get the following error: print u'Bob\x92s Breakfast'.decode('cp1252').encode('utf8') Traceback (most recent call last): File stdin, line 1, in module File /Library/Frameworks/Python.framework/Versions/2.5/lib/

Re: urllib2 disable proxy

2008-01-03 Thread Dimitrios Apostolou
On Wed, 2 Jan 2008, Rob Wolfe wrote: Dimitrios Apostolou [EMAIL PROTECTED] writes: Hello list, I've been looking for a way to explicitly disable the use of proxies with urllib2, no matter what the environment dictates. Unfortunately I can't find a way in the documentation, and reading

Re: problem with global var

2008-01-03 Thread Fredrik Lundh
Bruno Ferreira wrote: When I execute the program _without_ the lines 10 and 11: 10 if len(topsquid) 50: 11 topsquid = topsquid[0:50] it runs perfectly. But if I execute the program _with_ those lines, this exception is thrown: [EMAIL PROTECTED]:~$ python topsquid.py

Re: Choosing a new language

2008-01-03 Thread Joachim Durchholz
Tim Roberts schrieb: Joachim Durchholz [EMAIL PROTECTED] wrote: Xah Lee [EMAIL PROTECTED] wrote: [...] PHP and Perl are practically identical in their high-levelness or expressiveness or field of application (and syntax), That must have been a very, very distant point of view with narrowly

how to use bool

2008-01-03 Thread jimgardener
hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass: . def mymethod(self): success=True msg=all validation OK

Re: how to use bool

2008-01-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass: . def mymethod(self): success=True

Re: Insert to a clob field using cx_Oracle via a stored procedure

2008-01-03 Thread hinds . ja
On Jan 2, 2:01 pm, [EMAIL PROTECTED] wrote: Hello, Does anyone have experience using cx_Oracle to call a stored procedure that inserts to a clob field?  We have done this successfully via straight SQL, but we are at a loss on how to do the same insert using a stored procedure call.  Any

Re: Treating a unicode string as latin-1

2008-01-03 Thread Duncan Booth
Fredrik Lundh [EMAIL PROTECTED] wrote: ET has already decoded the CP1252 data for you. If you want UTF-8, all you need to do is to encode it: u'Bob\x92s Breakfast'.encode('utf8') 'Bob\xc2\x92s Breakfast' I think he is claiming that the encoding information in the file is incorrect and

Re: how to use bool

2008-01-03 Thread tinnews
[EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass: . def mymethod(self): success=True

How do you pass compiler option to setup.py install?

2008-01-03 Thread Emin.shopper Martinian.shopper
Dear Experts, How do you pass the -c option to setup.py install? Specifically, when I try to install zope.interfaces version 3.3 from source on a windows machine, I get a message about using -c mingw32. That works fine for setup.py build, but it does not work for setup.py install. Note: I would

Re: How do you pass compiler option to setup.py install?

2008-01-03 Thread Christian Heimes
Emin.shopper Martinian.shopper wrote: Dear Experts, How do you pass the -c option to setup.py install? Specifically, when I try to install zope.interfaces version 3.3 from source on a windows machine, I get a message about using -c mingw32. That works fine for setup.py build, but it does

Re: How do you pass compiler option to setup.py install?

2008-01-03 Thread Emin.shopper Martinian.shopper
On Jan 3, 2008 11:24 AM, Emin.shopper Martinian.shopper [EMAIL PROTECTED] wrote: How do you pass the -c option to setup.py install? After some fiddling, I figured out that you can put the following two lines in setup.cfg: [build] compiler=mingw32 It would be nice if you could somehow pass

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2008-01-03 Thread [EMAIL PROTECTED]
On Dec 29 2007, 11:10 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: I'm considering deprecating these two functions and would like some feedback from the community or from people who have a background in functional programming. Well I have just this minute used dropwhile in anger, to find the

Adding a HTTP header to a SOAPpy request

2008-01-03 Thread Matias Surdi
Hi, Could anybody tell me which is the easier way to do a SOAP call to a web service wich requires an http header to be present? I can't figure it out. Thanks a lot Some code I'm using: import SOAPpy s = SOAPpy.SOAPProxy(http://10.3.5.128:10560/SERVICES,namespace=http://ws.mysite.com;)

Re: how to use bool

2008-01-03 Thread Chris Mellon
On 03 Jan 2008 16:09:53 GMT, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: hi, i have some code where i set a bool type variable and if the value is false i would like to return from the method with an error msg.. being a beginner I wd like some help here class myclass:

Re: Who's to blame?

2008-01-03 Thread Rob Williscroft
Nicola Musatti wrote in news:92dfc2fc-0677-43c0-b34f-4f240fa40205 @e4g2000hsg.googlegroups.com in comp.lang.python: Note there is a wxpython mailinglist/newsgroup: news:gmane.comp.python.wxpython [snip] problem lies in the fact that apparently ShowModal() does not return when either

C++ equivalent of comp.lang.python?

2008-01-03 Thread brzrkr0
Hopefully this isn't too OT. One thing I like about comp.lang.python is the breadth of topics discussed here. People can ask about Python installation and configuration issues on specific platforms, compare third party libraries, ask for book recommendations, and discuss current Python projects.

[OT] How is AI implemented

2008-01-03 Thread Martin Marcher
Hi, I know it's not a trivial field but I had some readings about artificial intelligence lately and my personal conclusion is that it's mostly just statistics. Naively explained: continiously gather and store information and apply a default rating 1) answer questions with gathered information

Re: Pivot Table/Groupby/Sum question

2008-01-03 Thread petr . jakes . tpc
On Jan 3, 3:41 pm, [EMAIL PROTECTED] wrote: Yes in the sense that the top part will have merged cells so that Horror and Classics don't need to be repeated every time, but the headers aren't the important part. At this point I'm more interested in organizing the data itself and i can worry

PyOpenGL, wxPython weird behaviour

2008-01-03 Thread Adeola Bannis
Hi everyone, I'm doing a project using wxPython and pyopengl, and I seem to have a problem rendering textures. This is code that worked before my hard drive had a meltdown, but not since I re-installed everything. I've determined the problem is in the OpenGL part of my program. I do some

Re: Treating a unicode string as latin-1

2008-01-03 Thread Diez B. Roggisch
Duncan Booth schrieb: Fredrik Lundh [EMAIL PROTECTED] wrote: ET has already decoded the CP1252 data for you. If you want UTF-8, all you need to do is to encode it: u'Bob\x92s Breakfast'.encode('utf8') 'Bob\xc2\x92s Breakfast' I think he is claiming that the encoding information in the

urllib timeout hole - long timeout if site doesn't send headers.

2008-01-03 Thread John Nagle
urllib has a hole in its timeout protection. Using socket.setdefaulttimeout will make urllib time out if a site doesn't open a TCP connection in the indicated time. But if the site opens the TCP connection and never sends HTTP headers, it takes about 20 minutes for the read in urllib's

Re: Treating a unicode string as latin-1

2008-01-03 Thread Fredrik Lundh
Diez B. Roggisch wrote: I would think it more likely that he wants to end up with u'Bob\u2019s Breakfast' rather than u'Bob\x92s Breakfast' although u'Dog\u2019s dinner' seems a probable consequence. If that's the case, he should read the file as string, de- and encode it (probably into

Re: reassign to builtin possible !?

2008-01-03 Thread Benjamin
On Jan 3, 7:04 am, Bernhard Merkle [EMAIL PROTECTED] wrote: Hi there, I am reading Learning Python 3e from Mark Lutz and just found out that reassigning to builtins is possible. What is the reason, why Python allows this ? IMO this is very risky and can lead to hard to find errors. I don't

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2008-01-03 Thread Arnaud Delobelle
On Jan 3, 4:39 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Dec 29 2007, 11:10 pm, Raymond Hettinger [EMAIL PROTECTED] wrote: I'm considering deprecating these two functions and would like some feedback from the community or from people who have a background in functional programming.

Re: reassign to builtin possible !?

2008-01-03 Thread Chris Mellon
On Jan 3, 2008 8:05 AM, Tim Chase [EMAIL PROTECTED] wrote: But you can't alter the values for True/False globally with this. Are you sure ? what about the following example ? Is this also shadowing ? import __builtin__ __builtin__.True = False __builtin__.True False It doesn't

Re: PyOpenGL, wxPython weird behaviour

2008-01-03 Thread kyosohma
On Jan 3, 11:50 am, Adeola Bannis [EMAIL PROTECTED] wrote: Hi everyone, I'm doing a project using wxPython and pyopengl, and I seem to have a problem rendering textures. This is code that worked before my hard drive had a meltdown, but not since I re-installed everything. I've determined

Re: urllib2 disable proxy

2008-01-03 Thread Rob Wolfe
Dimitrios Apostolou [EMAIL PROTECTED] writes: On Wed, 2 Jan 2008, Rob Wolfe wrote: Dimitrios Apostolou [EMAIL PROTECTED] writes: Hello list, I've been looking for a way to explicitly disable the use of proxies with urllib2, no matter what the environment dictates. Unfortunately I can't

Re: Who's to blame?

2008-01-03 Thread kyosohma
On Jan 3, 8:48 am, Nicola Musatti [EMAIL PROTECTED] wrote: Hallo, First of all I apologize for the longish example at the bottom, but the biggest source file is automatically generated and I didn't want to modify more than strictly necessary. Also, it would be shorter if XML wasn't so verbose

Re: PyOpenGL, wxPython weird behaviour

2008-01-03 Thread Adeola Bannis
Thanks, will do... On Jan 3, 2:07 pm, [EMAIL PROTECTED] wrote: On Jan 3, 11:50 am, Adeola Bannis [EMAIL PROTECTED] wrote: Hi everyone, I'm doing a project using wxPython and pyopengl, and I seem to have a problem rendering textures. This is code that worked before my hard drive had a

Re: different encodings for unicode() and u''.encode(), bug?

2008-01-03 Thread mario
On Jan 2, 2:25 pm, Piet van Oostrum [EMAIL PROTECTED] wrote: Apparently for the empty string the encoding is irrelevant as it will not be used. I guess there is an early check for this special case in the code. In the module I an working on [*] I am remembering a failed encoding to allow me,

New-style objects are not instances, apparently

2008-01-03 Thread [EMAIL PROTECTED]
I have a class that derives from Exception. In Python 2.4, isinstance(MyClass(), types.InstanceType) was True. In 2.5, it's False. Further experimentation showed that derivation from object was the culprit; new-style objects are not considered instances in the above sense. I wasn't able to

Re: New-style objects are not instances, apparently

2008-01-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Further experimentation showed that derivation from object was the culprit; new-style objects are not considered instances in the above sense. I wasn't able to figure out a workaround. Is there one, or is the distinction between traditional classes and built-in

Re: New-style objects are not instances, apparently

2008-01-03 Thread Arnaud Delobelle
On Jan 3, 9:15 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have a class that derives from Exception.  In Python 2.4, isinstance(MyClass(), types.InstanceType) was True.  In 2.5, it's False. Further experimentation showed that derivation from object was the culprit; new-style objects are

Re: How is AI implemented

2008-01-03 Thread kyosohma
On Jan 3, 11:49 am, Martin Marcher [EMAIL PROTECTED] wrote: Hi, I know it's not a trivial field but I had some readings about artificial intelligence lately and my personal conclusion is that it's mostly just statistics. Naively explained: continiously gather and store information and

Re: How is AI implemented

2008-01-03 Thread montyphyton
On Jan 3, 6:49 pm, Martin Marcher [EMAIL PROTECTED] wrote: Hi, I know it's not a trivial field but I had some readings about artificial intelligence lately and my personal conclusion is that it's mostly just statistics. Naively explained: continiously gather and store information and

Re: New-style objects are not instances, apparently

2008-01-03 Thread Martin v. Löwis
Further experimentation showed that derivation from object was the culprit; new-style objects are not considered instances in the above sense. I wasn't able to figure out a workaround. Is there one, or is the distinction between traditional classes and built-in types only going to get more

choosing random dynamic port number

2008-01-03 Thread Emin.shopper Martinian.shopper
Dear Experts, Is there a good way to choose/assign random dynamic port numbers in python? I had in mind something like the following, but if multiple programs are generating random port numbers, is there a way to check if a given port number is already taken? def

Re: choosing random dynamic port number

2008-01-03 Thread Fredrik Lundh
Emin.shopper Martinian.shopper wrote: Is there a good way to choose/assign random dynamic port numbers in python? I had in mind something like the following, but if multiple programs are generating random port numbers, is there a way to check if a given port number is already taken?

Re: XML-XSD Processing/Creation.

2008-01-03 Thread xkenneth
On Jan 3, 1:55 am, Stefan Behnel [EMAIL PROTECTED] wrote: paul wrote: Can i create python classes based off the XSD files? What else can I do with the XSD files? This might be worth looking at:http://www.rexx.com/~dkuhlman/#generateDS If it's really such a complex XML language, the tool

dictionary/hash and '1' versus 1

2008-01-03 Thread Reedick, Andrew
As a Perl monkey in the process of learning Python, I just stepped on the '1' (string) is not the same as 1 (integer) in regards to keys for dictionaries/hashes landmine. Is there a good way to ensure that numbers represented as strings or ints do not get mixed up as keys? Example of the

Re: different encodings for unicode() and u''.encode(), bug?

2008-01-03 Thread John Machin
On Jan 4, 8:03 am, mario [EMAIL PROTECTED] wrote: On Jan 2, 2:25 pm, Piet van Oostrum [EMAIL PROTECTED] wrote: Apparently for the empty string the encoding is irrelevant as it will not be used. I guess there is an early check for this special case in the code. In the module I an working on

ctypes - pointer to array of structs?

2008-01-03 Thread skip
(Is this the right place to ask ctypes questions? There's a mailing list but the last post to it seems to have been in November 2006.) Using ctypes I reference a structure which contains a pointer to an array of another structure: class SYMBOL(Structure): _fields_ = [(symbol,

Re: dictionary/hash and '1' versus 1

2008-01-03 Thread John Machin
On Jan 4, 9:56 am, Reedick, Andrew [EMAIL PROTECTED] wrote: As a Perl monkey in the process of learning Python, I just stepped on the '1' (string) is not the same as 1 (integer) in regards to keys for dictionaries/hashes landmine. Congratulations. You have just stepped off the '1' (string) is

Re: ctypes - pointer to array of structs?

2008-01-03 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: (Is this the right place to ask ctypes questions? There's a mailing list but the last post to it seems to have been in November 2006.) No, it's active. Using ctypes I reference a structure which contains a pointer to an array of another structure: class

py2exe command prompt whenr run

2008-01-03 Thread SMALLp
HY! I'm using py2exe to port my applications on windows so user won't have to install python and other dependencies. Everything works file except when i run any of programs it star's command prompt before program starts. How can i avoid this to happen, and is there any other way of porting my

Re: py2exe command prompt whenr run

2008-01-03 Thread Fredrik Lundh
SMALLp wrote: I'm using py2exe to port my applications on windows so user won't have to install python and other dependencies. Everything works file except when i run any of programs it star's command prompt before program starts. How can i avoid this to happen use windows= instead of

Re: dictionary/hash and '1' versus 1

2008-01-03 Thread Stephen Hansen
As a Perl monkey in the process of learning Python, I just stepped on the '1' (string) is not the same as 1 (integer) in regards to keys for dictionaries/hashes landmine. Is there a good way to ensure that numbers represented as strings or ints do not get mixed up as keys? Well one

Cursors in a Loop

2008-01-03 Thread t_rectenwald
I have a python script that uses the cx_Oracle module. I have a list of values that I iterate through via a for loop and then insert into the database. This works okay, but I'm not sure whether I can use one cursor for all inserts, and define it outside of the loop, or instantiate and close the

Re: ctypes - pointer to array of structs?

2008-01-03 Thread Skip Montanaro
(Is this the right place to ask ctypes questions? There's a mailing list but the last post to it seems to have been in November 2006.) No, it's active. Thanks. I guess the official ASPN-based archive must be dead. I managed to sort of get access to the array just using indexing as I

Re: Cursors in a Loop

2008-01-03 Thread t_rectenwald
On Jan 3, 7:47 pm, t_rectenwald [EMAIL PROTECTED] wrote: I have a python script that uses the cx_Oracle module.  I have a list of values that I iterate through via a for loop and then insert into the database.  This works okay, but I'm not sure whether I can use one cursor for all inserts, and

calling system command in window is very slow in python 2.5.1

2008-01-03 Thread wang frank
Hi, I am running a python script that will change the attribute of a directory and its subdiretory by command: os.system(chmod -R .) or os.system(attrib -R * /S) Both commands chmod and attrib run quite fast in dos command shell. However, inside python, they are very slow and I

lucas ares

2008-01-03 Thread lucas
visitame www.lucasares.com.ar -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary/hash and '1' versus 1

2008-01-03 Thread Steven D'Aprano
On Thu, 03 Jan 2008 16:56:00 -0600, Reedick, Andrew wrote: The problem occurred because a method used to generate keys was returning a string instead of a number without an explicit conversion taking place. And since I was using hash.get(i, default_value) to avoid having to pair every key

Re: problem with global var

2008-01-03 Thread Steven D'Aprano
On Thu, 03 Jan 2008 11:38:48 -0300, Bruno Ferreira wrote: Hi, I wrote a very simple python program to generate a sorted list of lines from a squid access log file. Here is a simplified version: ## 1 logfile = open (squid_access.log, r) 2 topsquid =

linecache and glob

2008-01-03 Thread jo3c
hi everyone happy new year! im a newbie to python i have a question by using linecache and glob how do i read a specific line from a file in a batch and then insert it into database? because it doesn't work! i can't use glob wildcard with linecache import linecache

Information on PyGMT?

2008-01-03 Thread Alaric
Hello - I'm seeking info on the PyGMT python wrapper for the Generic Mapping Tools package. Unfortunately, the only site (forge.nesc.ac.uk) that seems to offer the code (written by Magnus Hagdorn) is not responding. I don't know if that's a temporary condition or if that site is out of

Re: Cursors in a Loop

2008-01-03 Thread Carsten Haese
On Thu, 2008-01-03 at 17:25 -0800, t_rectenwald wrote: On Jan 3, 7:47 pm, t_rectenwald [EMAIL PROTECTED] wrote: I have a python script that uses the cx_Oracle module. I have a list of values that I iterate through via a for loop and then insert into the database. This works okay, but I'm

Re: linecache and glob

2008-01-03 Thread Jeremy Dillworth
Hello, Welcome to Python! glob returns a list of filenames, but getline is made to work on just one filename. So you'll need to iterate over the list returned by glob. import linecache, glob for filename in glob.glob('/etc/*'): print linecache.getline(filename, 4) Maybe you could

Im back...

2008-01-03 Thread Sam Garson
Hi there same project I am afraid... I want to put the text from the selection of a listbox into a Label when the the selection is clicked. I have it so it is put in, but it is put in when I click on the *next*selection...as in it defines the variable when I click on the desired the selection,

Re: PyObject_CallObject code dump after calling 4 times

2008-01-03 Thread grbgooglefan
On Jan 3, 8:49 pm, grbgooglefan [EMAIL PROTECTED] wrote: On Jan 3, 8:02 pm, Phil Thompson [EMAIL PROTECTED] wrote: On Thursday 03 January 2008, grbgooglefan wrote: I have a following C++ code which uses PyObject_CallObject to evaluate expressions dynamically. This code sets the

  1   2   3   >