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 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: > http://feeds.huffingtonpost.com/posts/ , http:

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 wrote: > > On Mon, Jan 12, 2009 at 11:46 PM, S.Selvam Siva > 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-d

Re: efficient interval containment lookup

2009-01-13 Thread Gabriel Genellina
En Tue, 13 Jan 2009 02:55:36 -0200, Per Freem escribió: On Jan 12, 10:58 pm, Steven D'Aprano 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 operation is containment, i.e. (a,b) is within (c,d) iff

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 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 runtime. Ideally

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

Re: Relative performance of comparable regular expressions

2009-01-13 Thread John Machin
On Jan 13, 7:24 pm, "Barak, Ron" 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}", or wit

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 possibiliti

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 wrote: > RajNewbie wrote: > > On Jan 12, 6:51 pm, Tim Chase 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 : break > >>> if inifinte_l

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

2009-01-13 Thread sim.sim
On 12 янв, 16:00, John Machin wrote: > On Jan 13, 12:45 am, "sim.sim" wrote: > > > > > On 10 ÑÎ×, 23:40, John Machin wrote: > > > > On Jan 11, 2:45šam, "sim.sim" wrote: > > > > > Hi all! > > > > > I had touch with some different python behavior: I was tried to write > > > > into a file a string

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

2009-01-13 Thread John Machin
On Jan 13, 10:12 pm, "sim.sim" 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 give reasons to u

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 wrote: >> On Mon, Jan 12, 2009 at 11:46 PM, S.Selvam Siva >> 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

Re: Problems in Using C-API for Unicode handling

2009-01-13 Thread abhi
On Jan 13, 12:17 pm, Terry Reedy 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: > > >  PyUnicode_FromEncodedObject(PyObject

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Steve Holden
John Machin wrote: > On Jan 13, 7:24 pm, "Barak, Ron" 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, matchin

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

Re: Attaching a live interpreter to a script?

2009-01-13 Thread Benjamin Kaplan
On Tue, Jan 13, 2009 at 2:35 AM, Kannon 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 (I.E, not some

Re: Is there a better algorithm?

2009-01-13 Thread Lie
On Jan 3, 4:38 am, mr 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: > Yet another solution: for i in l: k, u, v = i[0], None if len(i) == 2 else i[1], i[-1] -- http://mail.python.org/mailman/li

Re: Is there a better algorithm?

2009-01-13 Thread Lie
On Jan 3, 11:55 am, Kottiyath wrote: > On Jan 3, 2:38 am, mr wrote: > > 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, filename, > value). > My view was that since fi

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 read

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 "^[a-zA-Z]

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 _is_owne

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" wrote: Hey all, The following fails for me: from urllib2 import urlopen f = urlopen("http://groups.google.com/group/chromium-announce/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" wrote: > Hey all, > > The following fails for me: > from urllib2

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 functi

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 necessary

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 the

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 r

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", l

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

Re: Ethernet packet size python

2009-01-13 Thread K-man
On Jan 13, 10:35 am, Steve Holden 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 > > suggestions? > >

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

2009-01-13 Thread Paul Rubin
imageguy 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' > variables are assig

Re: Relative performance of comparable regular expressions

2009-01-13 Thread Chris Rebert
On Tue, Jan 13, 2009 at 6:16 AM, Barak, Ron 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 my question

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 b

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 a

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

Re: urllib2 - 403 that _should_ not occur.

2009-01-13 Thread Falcolas
On Jan 11, 6:59 pm, "James Mills" 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 well. Us

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

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

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 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 distinct. UTF-16 is a

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

2009-01-13 Thread Roger
On Jan 13, 11:59 am, "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? > > 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 "", 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 me

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 encom

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

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" wrote: > I figured it was some kind of bug. M

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

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 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 already perfect? That's a fallacious ar

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 t

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

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 = int(self.headers['Content-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 th

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", val

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

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

2009-01-13 Thread imageguy
On Jan 13, 1:01 am, Miles wrote: > On Tue, Jan 13, 2009 at 12:02 AM, imageguy 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 is that 'else' clause > > result en

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

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

2009-01-13 Thread Russ P.
On Jan 13, 9:47 am, Bruno Desthuilliers wrote: > Steven D'Aprano a écrit : > > > On Mon, 12 Jan 2009 13:36:07 -0800, Paul Rubin wrote: > > >> Bruno Desthuilliers 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

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=Z2Q0cDdpYmJobzVzbzZobXJxbTc2OHUxYW9fMjAwOTAxMTVUMDIwMDAwWiBhZG1pbkBweXRob25jYWxnYXJ5LmNvbQ&ctz=America/Edmonton Google

Re: Standard IPC for Python?

2009-01-13 Thread drobi...@gmail.com
On Jan 13, 2:37 pm, Philip Semanchuk 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 much appre

Re: Standard IPC for Python?

2009-01-13 Thread Aaron Brady
On Jan 13, 2:04 pm, Laszlo Nagy 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 CreateEvent/WaitForSingleObject for s

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

2009-01-13 Thread John Machin
On Jan 13, 5:36 pm, Steve Holden wrote: > Miles wrote: > > On Tue, Jan 13, 2009 at 12:02 AM, imageguy 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 is that

Re: ctype problem

2009-01-13 Thread Aaron Brady
On Jan 13, 10:22 am, Grimson 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 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 something like a full-scale static type

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 t

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 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? It's not rea

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

2009-01-13 Thread John Machin
On Jan 14, 6:54 am, ag73 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'SomeServ

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 d

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 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) File "/Library/

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?". Interes

'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 wrote: > Bruno Desthuilliers 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

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. -- http://mail

Re: why cannot assign to function call

2009-01-13 Thread Mark Wooding
Steven D'Aprano 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 in an attempt to reduce > frustrat

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 t

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. -- http://mail.python.org/mailman/

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 depende

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 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 regard Ctrl-Z as an E

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 wrote: > On Jan 13, 3:08 pm, John Machin 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.p

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 slight

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 2:25 AM, Laszlo Nagy 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 processes can communicat

Re: Standard IPC for Python?

2009-01-13 Thread James Mills
On Wed, Jan 14, 2009 at 3:40 AM, Laszlo Nagy 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 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 major stroke in the Pytho

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 doing

  1   2   >