Re: Extracting real-domain-name (without sub-domains) from a given URL

2009-01-13 Thread Chris Rebert
On Mon, Jan 12, 2009 at 11:46 PM, S.Selvam Siva s.selvams...@gmail.com wrote: Hi all, I need to extract the domain-name from a given url(without sub-domains). With urlparse, i am able to fetch only the domain-name(which includes the sub-domain also). eg:

Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching with ^[a-zA-Z]{3}, or with ^\S{3} ? Also, which is better (if different at all):

Re: Extracting real-domain-name (without sub-domains) from a given URL

2009-01-13 Thread S.Selvam Siva
On Tue, Jan 13, 2009 at 1:50 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 12, 2009 at 11:46 PM, S.Selvam Siva s.selvams...@gmail.com wrote: Hi all, I need to extract the domain-name from a given url(without sub-domains). With urlparse, i am able to fetch only the

Re: efficient interval containment lookup

2009-01-13 Thread Gabriel Genellina
En Tue, 13 Jan 2009 02:55:36 -0200, Per Freem perfr...@yahoo.com escribió: On Jan 12, 10:58 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 12 Jan 2009 14:49:43 -0800, Per Freem wrote: thanks for your replies -- a few clarifications and questions. the is_within

Re: Attaching a live interpreter to a script?

2009-01-13 Thread Julian Smith
On Mon, 12 Jan 2009 23:35:14 -0800 (PST) Kannon neokan...@gmail.com wrote: What I'd like to do is attach an interpreter to a program running from a script (I.E, not something I typed into the live interpreter). It'd be an awesome way to debug programs, as well as tweak parameters and such at

Re: Implementing file reading in C/Python

2009-01-13 Thread Marc 'BlackJack' Rintsch
On Mon, 12 Jan 2009 21:26:27 -0500, Steve Holden wrote: The very idea of mapping part of a process's virtual address space onto an area in which low-level system code resides, so writing to this region may corrupt the system, with potentially catastrophic consequences seems to be asking for

Re: Relative performance of comparable regular expressions

2009-01-13 Thread John Machin
On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching with  ^[a-zA-Z]{3},

Re: efficient interval containment lookup

2009-01-13 Thread Tim Chase
Per Freem wrote: i forgot to add, my naive_find is: def naive_find(intervals, start, stop): results = [] for interval in intervals: if interval.start = start and interval.stop = stop: results.append(interval) return results I don't know if using a list-comprehension here is a

Re: using PIL for PCA analysis

2009-01-13 Thread Jan Erik Solem
if i want to do an array of PIL image data i can use img=Image.open(myimg.jpg) .convert(L) pixelarray=img.getdata() convert(L) is a good way to make images grayscale. An option to using getdata() is to try numpy's array: pixelarray = numpy.array(img) this gives lots of possibilities for

Re: why cannot assign to function call

2009-01-13 Thread Steven D'Aprano
On Sat, 10 Jan 2009 15:46:35 +, Mark Wooding wrote: [Another tome. I hope this contains sufficient new material to continue to be of interest to other readers.] I found it interesting. I don't know about others. However, at 756 lines (including quoting) it was nearly double the size of

best site for hacking tricks , computer tweaks

2009-01-13 Thread debasish ray
-- http://mail.python.org/mailman/listinfo/python-list

Re: Python tricks

2009-01-13 Thread Nick Craig-Wood
Scott David Daniels scott.dani...@acm.org wrote: RajNewbie wrote: On Jan 12, 6:51 pm, Tim Chase python.l...@tim.thechases.com wrote: [a perfectly fine reply which is how I'd solve it] RajNewbie wrote: ... The solution that I had in mind is: while True: ... if

Re: are there some special about '\x1a' symbol

2009-01-13 Thread sim.sim
On 12 янв, 16:00, John Machin sjmac...@lexicon.net wrote: On Jan 13, 12:45 am, sim.sim maksim.kasi...@gmail.com wrote: On 10 ÑÎ×, 23:40, John Machin sjmac...@lexicon.net wrote: On Jan 11, 2:45šam, sim.sim maksim.kasi...@gmail.com wrote: Hi all! I had touch with some different

Re: are there some special about '\x1a' symbol

2009-01-13 Thread John Machin
On Jan 13, 10:12 pm, sim.sim maksim.kasi...@gmail.com wrote: Ah John, thank you for your explanations! My first impression was that your comments does not relates to my question, but I've found new things where I used to think there was nothing. Now it is interesting to me how one have to

Re: Extracting real-domain-name (without sub-domains) from a given URL

2009-01-13 Thread Steve Holden
S.Selvam Siva wrote: On Tue, Jan 13, 2009 at 1:50 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jan 12, 2009 at 11:46 PM, S.Selvam Siva s.selvams...@gmail.com wrote: Hi all, I need to extract the domain-name from a given url(without sub-domains). With urlparse, i am able to fetch

Re: Problems in Using C-API for Unicode handling

2009-01-13 Thread abhi
On Jan 13, 12:17 pm, Terry Reedy tjre...@udel.edu wrote: abhi wrote: Hi,     I am trying to handle Unicode objects in C (Python 2.5.2). I am getting PyObjects from and want to coerce them to unicode objects. The documentation provides two APIs for that:  

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Steve Holden
John Machin wrote: On Jan 13, 7:24 pm, Barak, Ron ron.ba...@lsi.com wrote: Hi, I have a question about relative performance of comparable regular expressions. I have large log files that start with three letters month names (non-unicode). Which would give better performance, matching

WebDAV client module

2009-01-13 Thread Vincent Gulinao
Kindly point me to a good WebDAV client module for Python. Looks like PyDav is popular, but it seems some of the modules used within were already deprecated. TIA. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems in Using C-API for Unicode handling

2009-01-13 Thread Steve Holden
abhi wrote: On Jan 13, 12:17 pm, Terry Reedy tjre...@udel.edu wrote: abhi wrote: Hi, I am trying to handle Unicode objects in C (Python 2.5.2). I am getting PyObjects from and want to coerce them to unicode objects. The documentation provides two APIs for that:

Re: Attaching a live interpreter to a script?

2009-01-13 Thread Benjamin Kaplan
On Tue, Jan 13, 2009 at 2:35 AM, Kannon neokan...@gmail.com wrote: I'm sure this has come up before, but my google-fu is just not strong enough to find it out of 10,000~ posts, and apologies if this is obvious. What I'd like to do is attach an interpreter to a program running from a script

Re: Is there a better algorithm?

2009-01-13 Thread Lie
On Jan 3, 4:38 am, mr mario.rugg...@gmail.com wrote: As has been noted, the best is to fix the input to be regular-3- tuples. For the fun of it, here's another variation of a solution: snip Yet another solution: for i in l: k, u, v = i[0], None if len(i) == 2 else i[1], i[-1] --

Re: Is there a better algorithm?

2009-01-13 Thread Lie
On Jan 3, 11:55 am, Kottiyath n.kottiy...@gmail.com wrote: On Jan 3, 2:38 am, mr mario.rugg...@gmail.com wrote: snip It is a code to post some data to HTML server. Even though usually the POST values are of type(name, value), if file transfer is involved, then POST values change to (name,

Python-URL! - weekly Python news and links (Jan 13)

2009-01-13 Thread Gabriel Genellina
QOTW: If Jack Valenti had been around at the time of Gutenberg he would have organized the monks to come and burn down the printing press' :-). - Information Technology Association of America president Harris Miller Dynamic creation of instance attributes may adversely affect code

RE: Relative performance of comparable regular expressions

2009-01-13 Thread Barak, Ron
Hi John, Thanks for the below - teaching me how to fish ( instead of just giving me a fish :-) Now I could definitely get the answers for myself, and also be a bit more enlightened. As for your (2) remark below (on my question: Which would give better performance, matching with

Python threading

2009-01-13 Thread Brian Allen Vanderburg II
I'm doing some multi-threaded programming and before diving into the C/C++ code I though I'd do some in Python first. I decided to read through the threading module and I understand some of it, but I don't understand this, though I'm sure it is easy: The condition object has a method

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 1:22 AM, Steve Holden wrote: Philip Semanchuk wrote: On Jan 12, 2009, at 6:48 PM, ajaksu wrote: On Jan 11, 11:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f =

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Steve Holden
Philip Semanchuk wrote: On Jan 13, 2009, at 1:22 AM, Steve Holden wrote: Philip Semanchuk wrote: On Jan 12, 2009, at 6:48 PM, ajaksu wrote: On Jan 11, 11:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f =

exec in a nested function yields an error

2009-01-13 Thread TP
Hi everybody, Try the following program: def f(): def f_nested(): exec a=2 print a f() It yields an error. $ python nested_exec.py File nested_exec.py, line 3 exec a=2 SyntaxError: unqualified exec is not allowed in function

Ethernet packet size python

2009-01-13 Thread K-man
Hi, I am sending data using the socket interface in python, but I want to know how big the ethernet packet size is (in bytes). I didn't really see a way using the socket library of how to do this. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python with non-filesystem code source?

2009-01-13 Thread Ryan Oltman
Background: I'm trying to develop some certification software in C/C++ that would allow engineers/technicians to quickly develop scripts/functions in Python to verify a product (there could be hundreds of functions per product). I would like to use SQLite db to store the functions and the

Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread skip
I'm trying to convert Python's gdbinit file to Python 3. One of the things it does is print filenames and function names when displaying stack frames. This worked fine in Python 2 because the type of such objects is PyStringObject which uses NUL-terminated strings under the covers. For example:

Re: Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread MRAB
s...@pobox.com wrote: I'm trying to convert Python's gdbinit file to Python 3. One of the things it does is print filenames and function names when displaying stack frames. This worked fine in Python 2 because the type of such objects is PyStringObject which uses NUL-terminated strings under

Re: Ethernet packet size python

2009-01-13 Thread Steve Holden
K-man wrote: Hi, I am sending data using the socket interface in python, but I want to know how big the ethernet packet size is (in bytes). I didn't really see a way using the socket library of how to do this. Any suggestions? There is no way to know what size Ethernet packets will

Re: exec in a nested function yields an error

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 16:13 +0100, TP wrote: Hi everybody, Try the following program: def f(): def f_nested(): exec a=2 print a f() It yields an error. $ python nested_exec.py File nested_exec.py, line 3 exec

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread Scott David Daniels
imageguy wrote: 1) n = None 2) c,d = n if n is not None else 0,0 ... This is more easily expressed as: c, d = n or (0, 0) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple CGI-XMLRPC failure

2009-01-13 Thread Mike MacHenry
I figured it was some kind of bug. Must be either a bug with my version of either the library (most likely) or perhaps some weird environment setting that I have set incorrectly (also likely). How can I figure out which version of SimpleXMLRPCServer I'm running? Do you run Ubuntu by any chance? If

Could you suggest optimisations ?

2009-01-13 Thread Barak, Ron
Hi, In the attached script, the longest time is spent in the following functions (verified by psyco log): def match_generator(self,regex): Generate the next line of self.input_file that matches regex. generator_ = self.line_generator() while

Re: Ethernet packet size python

2009-01-13 Thread K-man
On Jan 13, 10:35 am, Steve Holden st...@holdenweb.com wrote: K-man wrote: Hi,   I am sending data using the socket interface in python, but I want to know how big the ethernet packet size is (in bytes).  I didn't really see a way using the socket library of how to do this.  Any

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread Paul Rubin
imageguy imageguy1...@gmail.com writes: Using py2.5.4 and entering the following lines in IDLE, I don't really understand why I get the result shown in line 8. Note the difference between lines 7 and 10 is that 'else' clause result enclosed in brackets, however, in line 2, both the 'c,d'

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 6:16 AM, Barak, Ron ron.ba...@lsi.com wrote: Hi John, Thanks for the below - teaching me how to fish ( instead of just giving me a fish :-) Now I could definitely get the answers for myself, and also be a bit more enlightened. As for your (2) remark below (on

ctype problem

2009-01-13 Thread Grimson
hello out there, I have a problem with c-types. I made a c-library, which expects a pointer to a self defined structure. let the funtion call myfunction(struct interface* iface) and the struct: struct interface { int a; int b; char *c; } the Python ctype port of this structur would

Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
I would like to develop some module for Python for IPC. Socket programming howto recommends that for local communication, and I personally experienced problems with TCP (see my previous post: Slow network). I was looking for semaphores and shared memory, but it is not in the standard lib. I

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 11:25 AM, Laszlo Nagy wrote: I would like to develop some module for Python for IPC. Socket programming howto recommends that for local communication, and I personally experienced problems with TCP (see my previous post: Slow network). I was looking for semaphores

Re: Standard IPC for Python?

2009-01-13 Thread Diez B. Roggisch
Laszlo Nagy wrote: I would like to develop some module for Python for IPC. Socket programming howto recommends that for local communication, and I personally experienced problems with TCP (see my previous post: Slow network). I was looking for semaphores and shared memory, but it is not in

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Falcolas
On Jan 11, 6:59 pm, James Mills prolo...@shortcircuit.net.au wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen(http://groups.google.com/group/chromium-announce/feed/rss_v2_0_msgs.xml;) For what it's worth, I've had a similar problem with the urlopen as

Re: Problems in Using C-API for Unicode handling

2009-01-13 Thread Stefan Behnel
abhi wrote: Now I want to utf-16 so I am trying to use the first one, but it is giving back NULL in case of PyObject is already Unicode type which is expected. What puzzles me is that PyUnicode_FromObject(PyObject *obj) is passing irrespective of type of PyObject. The API says it is Shortcut

basic python list/dict/key question/issues..

2009-01-13 Thread bruce
Hi.. quite new to python, and have a couple of basic question: i have (term:[1,2,3]) as i understand it, this is a list, yes/no? how can i represent this as a dict/list? i've got a few of these that i'm trying to deal with.. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems in Using C-API for Unicode handling

2009-01-13 Thread Scott David Daniels
abhi wrote: On Jan 13, 12:17 pm, Terry Reedy tjre...@udel.edu wrote: abhi wrote: Hi, I am trying to handle Unicode objects in C (Python 2.5.2) ... I want to convert this explicitely to utf-16 You are trying to get Unicode and UTF-16, whereas you should think of those two as

Re: basic python list/dict/key question/issues..

2009-01-13 Thread Roger
On Jan 13, 11:59 am, bruce bedoug...@earthlink.net wrote: Hi.. quite new to python, and have a couple of basic question: i have  (term:[1,2,3]) as i understand it, this is a list, yes/no? how can i represent this as a dict/list? i've got a few of these that i'm trying to deal with..

Re: basic python list/dict/key question/issues..

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 08:59 -0800, bruce wrote: Hi.. quite new to python, and have a couple of basic question: i have (term:[1,2,3]) as i understand it, this is a list, yes/no? No, that's invalid syntax: (term:[1,2,3]) File stdin, line 1

Re: Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
The only reason to use shm over the sysv_ipc module is that shm supports versions of Python 2.5. I'm not developing shm any further, so avoid using it if possible. Hmm, we are using FreeBSD, Ubuntu and Windows. Unfortunately - posix_ipc is broken under FreeBSD - sysv_ipc does not support

Re: Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
I use Pyro. Has always been fast enough for me. It spares you the troubles of bloated XML-documents other RPC-mechanisms use. Of course it is RPC, not only IPC - so it comes with a tradeoff. But so far, it has been always fast enough for me. Unfortunately, I'm developing an ORB, and using

Re: i want to join developer group

2009-01-13 Thread gert
On Jan 13, 1:36 pm, gkc...@gmail.com wrote: Hello,       I want to contribute to the open source projects. Open source is about finding where you are good at. Contributing is a product of the skills you learn. -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 12:40 PM, Laszlo Nagy wrote: The only reason to use shm over the sysv_ipc module is that shm supports versions of Python 2.5. I'm not developing shm any further, so avoid using it if possible. Hmm, we are using FreeBSD, Ubuntu and Windows. Unfortunately - posix_ipc

Re: exec in a nested function yields an error

2009-01-13 Thread Scott David Daniels
TP wrote: ... def f(): def f_nested(): exec a=2 print a f() ... What is the problem? Why? What it wants is you to provide the in context portion of the exec statement. I expect the reason it fails is that there is no dictionary that is available as locals that

Re: Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
- posix_ipc is broken under FreeBSD A clarification: the module posix_ipc is *not* broken. It exposes FreeBSD's implementation of POSIX IPC which has broken semaphores (based on my experiments, anyway). The practical result for you is the same but the difference is very important to me as

Re: Ethernet packet size python

2009-01-13 Thread Grant Edwards
On 2009-01-13, Steve Holden st...@holdenweb.com wrote: K-man wrote: I am sending data using the socket interface in python, but I want to know how big the ethernet packet size is (in bytes). I didn't really see a way using the socket library of how to do this. Any suggestions? There is no

Re: Simple CGI-XMLRPC failure

2009-01-13 Thread Jeff McNeil
I don't have the version in front of me now as that was on my home machine, but Python was the same right down to the revision number. Unless you've mucked with it, it's the same file that I've got on my box. Jeff On Jan 13, 10:51 am, Mike MacHenry dski...@ccs.neu.edu wrote: I figured it was

Re: Converting from PyUnicodeObject to char * without calling C API

2009-01-13 Thread skip
MRAB Should you be using char * when they aren't char? Is there a MRAB wide char type of some sort? No, I shouldn't. The storage is wchar_t *, what you get with my first printed expression: (gdb) set $__f = (PyUnicodeObject *)(co-co_filename) (gdb) p *$__f-s...@$__f-length $14

Re: Does Python really follow its philosophy of Readability counts?

2009-01-13 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote: Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr writes: Why on earth are you using Python if you don't like the way it work ??? Why on earth keep releasing new versions of Python if the old ones are

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 1:22 PM, Laszlo Nagy wrote: - posix_ipc is broken under FreeBSD A clarification: the module posix_ipc is *not* broken. It exposes FreeBSD's implementation of POSIX IPC which has broken semaphores (based on my experiments, anyway). The practical result for you is

Re: Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
I realize that lack of Windows support is a big minus for both of these modules. As I said, any help getting either posix_ipc or sysv_ipc working under Windows would be much appreciated. It sounds like you have access to the platform and incentive to see it working, so dig in if you like.

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 2:01 PM, Laszlo Nagy wrote: I realize that lack of Windows support is a big minus for both of these modules. As I said, any help getting either posix_ipc or sysv_ipc working under Windows would be much appreciated. It sounds like you have access to the platform and

Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread ag73
Hi, I am trying to parse data posted to a Python class that extends http.server.BaseHTTPRequestHandler. Here is the code I am using: def do_POST(self): ctype, pdict = cgi.parse_header(self.headers['Content-Type']) length =

Re: Standard IPC for Python?

2009-01-13 Thread Laszlo Nagy
I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? OK I see. But probably I do not want to use Cygwin because that would create another dependency. I understand

Read binary file and dump data in

2009-01-13 Thread Santiago Romero
Hi. Until now, all my python programs worked with text files. But now I'm porting an small old C program I wrote lot of years ago to python and I'm having problems with datatypes (I think). some C code: fp = fopen( file, rb); while !feof(fp) { value = fgetc(fp); printf(%d, value

Re: Read binary file and dump data in

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 12:02 -0800, Santiago Romero wrote: Hi. Until now, all my python programs worked with text files. But now I'm porting an small old C program I wrote lot of years ago to python and I'm having problems with datatypes (I think). some C code: fp = fopen( file, rb);

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread imageguy
On Jan 13, 1:01 am, Miles semantic...@gmail.com wrote: On Tue, Jan 13, 2009 at 12:02 AM, imageguy imageguy1...@gmail.com wrote: Using py2.5.4 and entering the following lines in IDLE, I don't really understand why I get the result shown in line 8. Note the difference between lines 7 and 10

Re: Read binary file and dump data in

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 12:02 PM, Santiago Romero srom...@gmail.com wrote: Hi. Until now, all my python programs worked with text files. But now I'm porting an small old C program I wrote lot of years ago to python and I'm having problems with datatypes (I think). some C code: fp =

Re: Does Python really follow its philosophy of Readability counts?

2009-01-13 Thread Russ P.
On Jan 13, 9:47 am, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Steven D'Aprano a écrit : On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote: Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr writes: Why on earth are you using Python if you don't like

Reminder: Calgary Python User Group - 1st Meeting tomorrow - Wed Jan 14

2009-01-13 Thread Greg
Our first meeting is tomorrow night at: Good Earth Cafe, 1502 11 Street SW, Calgary, AB Wed Jan 14, 7pm - 8pm Topic: Google App Engine http://www.google.com/calendar/event?eid=Z2Q0cDdpYmJobzVzbzZobXJxbTc2OHUxYW9fMjAwOTAxMTVUMDIwMDAwWiBhZG1pbkBweXRob25jYWxnYXJ5LmNvbQctz=America/Edmonton Google

Re: Standard IPC for Python?

2009-01-13 Thread drobi...@gmail.com
On Jan 13, 2:37 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Jan 13, 2009, at 2:01 PM, Laszlo Nagy wrote: I realize that lack of Windows support is a big minus for both of   these modules. As I said, any help getting either posix_ipc or   sysv_ipc working under Windows would be

Re: Standard IPC for Python?

2009-01-13 Thread Aaron Brady
On Jan 13, 2:04 pm, Laszlo Nagy gand...@shopzeus.com wrote: - create a wrapper, using ctypes, /windll / cdll/ to access API functions - use CreateFileMapping on the page file to create shared memory (a la windows:http://msdn.microsoft.com/en-us/library/aa366537.aspx) - use

Re: Ternary operator and tuple unpacking -- What am I missing ?

2009-01-13 Thread John Machin
On Jan 13, 5:36 pm, Steve Holden st...@holdenweb.com wrote: Miles wrote: On Tue, Jan 13, 2009 at 12:02 AM, imageguy imageguy1...@gmail.com wrote: Using py2.5.4 and entering the following lines in IDLE, I don't really understand why I get the result shown in line 8. Note the difference

Re: ctype problem

2009-01-13 Thread Aaron Brady
On Jan 13, 10:22 am, Grimson grim...@gmx.de wrote: hello out there, I have a problem with c-types. I made a c-library, which expects a pointer to a self defined structure. let the funtion call myfunction(struct interface* iface) and the struct: struct interface {     int a;     int b;  

Re: Does Python really follow its philosophy of Readability counts?

2009-01-13 Thread Paul Rubin
Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr writes: And that's the problem : what Paul suggests are not improvements but radical design changes. Eh? I think of them as moderate and incremental improvements, in a direction that Python is already moving in. Radical would be

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 3:04 PM, Laszlo Nagy wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? OK I see. But probably I do not want to use Cygwin because

Re: Standard IPC for Python?

2009-01-13 Thread Philip Semanchuk
On Jan 13, 2009, at 4:31 PM, drobi...@gmail.com wrote: On Jan 13, 2:37 pm, Philip Semanchuk phi...@semanchuk.com wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread John Machin
On Jan 14, 6:54 am, ag73 andygrov...@gmail.com wrote: Hi, I am trying to parse data posted to a Python class that extends http.server.BaseHTTPRequestHandler. Here is the code I am using:         def do_POST(self):                 ctype, pdict = cgi.parse_header(self.headers['Content-Type'])

Pydev 1.4.2 Released

2009-01-13 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.4.2 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions:

Re: Scheduled Tasks - SetFlags

2009-01-13 Thread Roger Upole
kj7ny wrote: How do I enable/disable a scheduled task using Python? I can get to a task: self.ts=pythoncom.CoCreateInstance (taskscheduler.CLSID_CTaskScheduler,None,pythoncom.CLSCTX_INPROC_SERVER,taskscheduler.IID_ITaskScheduler) self.ts.SetTargetComputer(u'SomeServer')

Weird behaviour re: Python on Windows

2009-01-13 Thread Kevin Jing Qiu
I've been experiencing weird behavior of Python's os module on Windows: Here's the environment: Box1: Running Windows 2003 Server with Apache+mod_python Box2: Running Windows 2003 Server with Zope/Plone and Z:\ mapped to D:\ on Box1 It appears any os calls that deals with file/dir on the mapped

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread Andy Grove
On Jan 13, 3:08 pm, John Machin sjmac...@lexicon.net wrote: Please show the full traceback. John, Thanks. Here it is: File /Library/Frameworks/Python.framework/Versions/3.0/lib/ python3.0/socketserver.py, line 281, in _handle_request_noblock self.process_request(request, client_address)

Re: python3.0 MySQLdb

2009-01-13 Thread Martin v. Löwis
Steve Holden wrote: Daniel Fetchinson wrote: I need something to connect to a database, preferably mysql, that works in python3.0 please. And your question is? Surely it's fairly obvious that the question is does such a thing exist, and if so where can I find it?. Interestingly enough,

'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-13 Thread Ben Sizer
I have the following C++ code and am attempting to embed Python 2.5, but although the import sys statement works, attempting to reference sys.path from inside a function after that point fails. It's as if it's not treating it as a normal module but as any other global variable which I'd have to

Re: Does Python really follow its philosophy of Readability counts?

2009-01-13 Thread Carl Banks
On Jan 13, 4:03 pm, Paul Rubin http://phr...@nospam.invalid wrote: Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr writes: And that's the problem : what Paul suggests are not improvements but radical design changes. Eh?  I think of them as moderate and incremental improvements,

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread Andy Grove
I don't fully understand this but if I pass in str(qs) instead of qs then the call works. However, qs is returned from file.read() operation so shouldn't that be a string already? In case it's not already obvious, I am new to Python :-) .. so I'm probably missing something here. --

Re: why cannot assign to function call

2009-01-13 Thread Mark Wooding
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I found it interesting. Well, that's something, at any rate. I think this conversation is reaching it's natural end. Frustration levels are rising. I think you may be right. That said... So I'm going to take a different tack

cgi.FieldStorage hanging with Python 3.0 (but works with 2.5.1)

2009-01-13 Thread Andy Grove
I'm trying to get a Python web server running that I can upload files to. I actually have the code running with the version of Python pre- installed on Mac OS X but it doesn't work with ActivePython 3.0 - I have not been able to compile Python from source myself to see if the issue is specific to

Re: Standard IPC for Python?

2009-01-13 Thread Mel
Philip Semanchuk wrote: I'm working on message queue support, but the Sys V IPC API is a headache and takes longer to code against than the POSIX API. I hadn't found it that bad. I have a C extension I should perhaps clean up and make public. Mel. --

Re: Standard IPC for Python?

2009-01-13 Thread Terry Reedy
Laszlo Nagy wrote: I was suggesting getting posix_ipc or sysv_ipc to compile against a compatibility library (Cygwin?) under Windows. It sounds like you're proposing something totally different, no? OK I see. But probably I do not want to use Cygwin because that would create another

Re: Could you suggest optimisations ?

2009-01-13 Thread Terry Reedy
Barak, Ron wrote: Hi, In the attached script, the longest time is spent in the following functions (verified by psyco log): I cannot help but wonder why and if you really need all the rigamorole with file pointers, offsets, and tells instead of for line in open(...): do your processing.

Re: [OT] Re: are there some special about '\x1a' symbol

2009-01-13 Thread Terry Reedy
Gabriel Genellina wrote: En Mon, 12 Jan 2009 12:00:16 -0200, John Machin sjmac...@lexicon.net escribió: I didn't think your question was stupid. Stupid was (a) CP/M recording file size as number of 128-byte sectors, forcing the use of an in-band EOF marker for text files (b) MS continuing to

Re: Python 3.0 urllib.parse.parse_qs results in TypeError

2009-01-13 Thread John Machin
On Jan 14, 9:56 am, Andy Grove andygrov...@gmail.com wrote: On Jan 13, 3:08 pm, John Machin sjmac...@lexicon.net wrote: Please show the full traceback. John, Thanks. Here it is:   File /Library/Frameworks/Python.framework/Versions/3.0/lib/ python3.0/socketserver.py, line 281, in

Re: Extracting real-domain-name (without sub-domains) from a given URL

2009-01-13 Thread Terry Reedy
S.Selvam Siva wrote: I doubt anyone's created a general ready-made solution for this, you'd have to code it yourself. To handle the common case, you can cheat and just .split() at the periods and then slice and rejoin the list of domain parts, ex: '.'.join(domain.split('.')[-2:]) Cheers, Chris

Re: python3.0 MySQLdb

2009-01-13 Thread Daniel Fetchinson
I need something to connect to a database, preferably mysql, that works in python3.0 please. And your question is? Surely it's fairly obvious that the question is does such a thing exist, and if so where can I find it?. Interestingly enough, the question was slightly (but importantly)

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 2:25 AM, Laszlo Nagy gand...@shopzeus.com wrote: The question is: what is the standard way to implement fast and portable IPC with Python? Are there tools in the standard lib that can do this? Certainly not standard by any means, but I use circuits (1). Two or more

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:40 AM, Laszlo Nagy gand...@shopzeus.com wrote: Can anyone tell me if select.select works under OS X? Yes it does. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of Readability counts?

2009-01-13 Thread Russ P.
On Jan 13, 3:07 pm, Carl Banks pavlovevide...@gmail.com wrote: I've seen no evidence that any Python project is moving even remotely toward data encapsulation. That would be a drastic change. Even if it were only a minor change in the implementation (and it would not be), it would be a

executing multiple functions in background simultaneously

2009-01-13 Thread Catherine Moroney
Hello everybody, I know how to spawn a sub-process and then wait until it completes. I'm wondering if I can do the same thing with a Python function. I would like to spawn off multiple instances of a function and run them simultaneously and then wait until they all complete. Currently I'm

  1   2   3   >