Re: Executing script with embedded python

2006-01-26 Thread Andrew Ayre
"Farshid Lashkari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > The problem is that PyObject_CallObject always returns NULL. Is this the > > correct return value for simply executing a script, as there is no function > > return value involved? > > The documentation for PyObject_

Re: Ovum quote about Python [OT]

2006-01-26 Thread Dave Benjamin
On Thu, 26 Jan 2006, Pete Forman wrote: > In an article about the Royal Bank of Scotland working with Zope there > is this quote from Gary Barnett, a research director at analyst firm > Ovum: > > "A lot of banks are using applications like Apache and Perl, but > it's interesting to see they're u

beta.python.org content

2006-01-26 Thread Steve Holden
How does http://beta.python.org/about/beginners/ look? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter listener thread?

2006-01-26 Thread Grant Edwards
On 2006-01-26, Steve Holden <[EMAIL PROTECTED]> wrote: > gregarican wrote: >> I have a Python UDP listener socket that waits for incoming data. The >> socket runs as an endless loop. I would like to pop the incoming data >> into an existing Tkinter app that I have created. What's the >> easiest/mos

Question about isinstance()

2006-01-26 Thread Mr.Rech
Hi all, I've read some thread about isinstance(), why it is considered harmful and how you can achieve the same results using a coding style that doesn't break polymorphism etc... Since I'm trying to improve my Python knowledge, and I'm going to design a class hierarchy from scratch, I'd like to ha

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
The below seems to pass all the tests you threw at it (taking the modified 2nd test into consideration) One other test that occurs to me would be "xyz123aaabbaaabab" where you have "aaab" in there twice. -tkc import re tests = [ ("xyz123aaabbab",True), ("xyz123aabbaaab", False), ("xay

Are there memory limits for external C modules?

2006-01-26 Thread david
I've been working on an external C module for Python in order to use some of the functionality from Ethereal. Right now I'm getting segfaults originating from within the Ethereal source code, but the same code works fine when used normally (i.e. through Ethereal or Tethereal). I'm wondering if ther

exporting multiple modules from one dll?

2006-01-26 Thread Andras Balogh
I have a dll that contains all kinds of services (input, audio, video, etc..), and I would like to export these to Python as separate modules. Now, if I call Py_InitModule with a name that's different than the dll name, I get an error. So what can I do? Thanks, Andras -- http://mail.python.o

Re: Tkinter listener thread?

2006-01-26 Thread Jean-Paul Calderone
On 26 Jan 2006 08:46:11 -0800, gregarican <[EMAIL PROTECTED]> wrote: >I have a Python UDP listener socket that waits for incoming data. The >socket runs as an endless loop. I would like to pop the incoming data >into an existing Tkinter app that I have created. What's the >easiest/most efficient wa

Re: Using non-ascii symbols

2006-01-26 Thread Runsun Pan
On 1/26/06, Terry Hancock <[EMAIL PROTECTED]> wrote: > On Thu, 26 Jan 2006 01:12:10 -0600 > Runsun Pan <[EMAIL PROTECTED]> wrote: > > Error) in python. I'd love to see if I can use han char > > for all those keywords like import, but it doesn't work. > > Yeah, I'm pretty sure we're talking about th

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: > >> > $ python test.py >> > gotexpected >> > --- >> > accept accept >> > reject reject >> > accept accept >> > reject reject >> > accept accept >> >> Thanks, but the second test ca

Re: Tkinter listener thread?

2006-01-26 Thread Steve Holden
gregarican wrote: > I have a Python UDP listener socket that waits for incoming data. The > socket runs as an endless loop. I would like to pop the incoming data > into an existing Tkinter app that I have created. What's the > easiest/most efficient way of handling this? Would I create a separate >

Re: How to handle two-level option processing with optparse

2006-01-26 Thread R. Bernstein
Magnus Lycka informs: > [in response to my comment]: > > I see how I missed this. Neither disable_.. or enable_.. have document > > strings. And neither seem to described in the optparser section (6.21) > > of the Python Library (http://docs.python.org/lib/module-optparse.html). > > http://docs.py

mod_python, dates, strings and integers

2006-01-26 Thread marc . wyburn
when POSTing a date from an mod_python psp page to another the date is sent as a string. I'm using form.has_key to pull the POST. I can cut the string up,turn the strings into integers and then use datetime.datetime(y,m,d,hr,mn,se) to create a proper datetime. Is there a simpler way of doing this

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Thanks, but the second test case I listed contained a typo. It should >>have >>contained a sequence

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Fredrik Lundh
Roger L. Cauvin wrote: > > $ python test.py > > gotexpected > > --- > > accept accept > > reject reject > > accept accept > > reject reject > > accept accept > > Thanks, but the second test case I listed contained a typo. It should have > contained a sequence of three of the lette

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that "Fredrik Lundh" > <[EMAIL PROTECTED]> might have written: > >>Roger L. Cauvin wrote: >> >>> Good suggestion. Here are some "test cases": >>> >>> "xyz123aaabbab" a

Ovum quote about Python

2006-01-26 Thread Pete Forman
In an article about the Royal Bank of Scotland working with Zope there is this quote from Gary Barnett, a research director at analyst firm Ovum: "A lot of banks are using applications like Apache and Perl, but it's interesting to see they're using Python and Zope as it's moderately hardcore

Re: Is there a way to profile underlying C++ code?

2006-01-26 Thread Christophe
Bo Peng a écrit : > Travis E. Oliphant wrote: > >> On Linux you can use oprofile (which is pretty nice and easy to use >> --- no recompiling. Just start the profiler, run your code, and stop >> the profiler). > > > Thank you very much for the tip. This is a great tool. > > The source of the

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that "Roger L. Cauvin" <[EMAIL PROTECTED]> might have written: >Thanks, but the second test case I listed contained a typo. It should have >contained a sequence of three of the letter 'a'. The test cases should be: > >"xyz123aaabbab" accept >"xyz123

Re: How to handle two-level option processing with optparse

2006-01-26 Thread R. Bernstein
Steve Holden <[EMAIL PROTECTED]> writes: > Well you are just as capable ... Yes, I guess you are right. Done. Couldn't find how to suggest an addition to the Python Cookbook (other than some generic O'Reilly email), so I've put a submission to: http://aspn.activestate.com/ASPN/Cookbook/Python/ -

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 16:26:57 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message >>news:[EMAIL PROTECTED] > >>> On Thu, 26 Ja

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 16:41:08 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Good suggestion. Here are some "test cases": >> >>"xyz123aaabbab" accept >>"xyz123aabbaab" reject >>

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that "Fredrik Lundh" <[EMAIL PROTECTED]> might have written: >Roger L. Cauvin wrote: > >> Good suggestion. Here are some "test cases": >> >> "xyz123aaabbab" accept >> "xyz123aabbaab" reject >> "xayz123aaabab" accept >> "xaaayz123abab" reject >> "xaa

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: > >> Good suggestion. Here are some "test cases": >> >> "xyz123aaabbab" accept >> "xyz123aabbaab" reject >> "xayz123aaabab" accept >> "xaaayz123abab" reject >> "xaaayz123aaabab" accept > > $ more

Re: Best way to extract an item from a set of len 1

2006-01-26 Thread Christophe
Alex Martelli a écrit : > Fredrik Lundh <[EMAIL PROTECTED]> wrote: >... > >>the obvious solution is >> >>item = list(s)[0] >> >>but that seems to be nearly twice as slow as [x for x in s][0] >>under 2.4. hmm. > > > Funny, and true on my laptop too: > > helen:~ alex$ python -mtimeit -s

Re: Returning a tuple-struct

2006-01-26 Thread Christos Georgiou
On Thu, 19 Jan 2006 10:47:35 GMT, rumours say that "Giovanni Bajo" <[EMAIL PROTECTED]> might have written: >I have a generic solution for this (never submitted to the cookbook... should >I?) This is by Andrew Durdin: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303439 This is by me:

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Dave Hansen
On Thu, 26 Jan 2006 16:26:57 GMT in comp.lang.python, "Roger L. Cauvin" <[EMAIL PROTECTED]> wrote: >"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] [...] >> Is this what you mean? >> >> ^[^a]*(a{3})(?:[^a].*)?$ > >Close, but the pattern should allow "arbitrary seq

Re: Executing script with embedded python

2006-01-26 Thread Andrew Ayre
"Farshid Lashkari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > The problem is that PyObject_CallObject always returns NULL. Is this the > > correct return value for simply executing a script, as there is no function > > return value involved? > > The documentation for PyObject_

Start a python interactive shell from python.

2006-01-26 Thread Bo Peng
Dear list, This may sound strange but I need to start a python shell from python. The motivation is that I have a bunch of (numeric) python functions to provide to a user. The best way I can think of is packing my python module using py2exe, and because it is easiest to let him run the functio

Re: Start a python interactive shell from python.

2006-01-26 Thread Bo Peng
I think I find what I need: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355319 Bo -- http://mail.python.org/mailman/listinfo/python-list

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Fredrik Lundh
Roger L. Cauvin wrote: > Good suggestion. Here are some "test cases": > > "xyz123aaabbab" accept > "xyz123aabbaab" reject > "xayz123aaabab" accept > "xaaayz123abab" reject > "xaaayz123aaabab" accept $ more test.py import re print "gotexpected" print "-- " testsuite = ( ("x

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
I have discovered the possible problem (I can't check this until later when I am home) I think when I upgraded to Python 2.4.2 it created my problem. Below is what is going on: Default Slackware 10.2 install - 2.4.1 installed into /usr/lib/python2.4 Python 2.4.1 upgraded to 2.4.2 Upgrade downloa

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 16:41:08 GMT, rumours say that "Roger L. Cauvin" <[EMAIL PROTECTED]> might have written: >Good suggestion. Here are some "test cases": > >"xyz123aaabbab" accept >"xyz123aabbaab" reject >"xayz123aaabab" accept >"xaaayz123abab" reject >"xaaayz123aaabab" accept Applying my last

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Chase <[EMAIL PROTECTED]> wrote: > >> > Sorry for the confusion. The correct pattern should reject >> > all strings except those in which the first sequence of the >> > letter 'a' that is followed by the letter 'b'

Re: Using non-ascii symbols

2006-01-26 Thread Claudio Grondi
Rocco Moretti wrote: > Terry Hancock wrote: > >> One thing that I also think would be good is to open up the >> operator set for Python. Right now you can overload the >> existing operators, but you can't easily define new ones. >> And even if you do, you are very limited in what you can >> use, a

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 16:26:57 GMT, rumours say that "Roger L. Cauvin" <[EMAIL PROTECTED]> might have written: >"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >> On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin" >> <[EMAIL PROTECTED]> might have

Tkinter listener thread?

2006-01-26 Thread gregarican
I have a Python UDP listener socket that waits for incoming data. The socket runs as an endless loop. I would like to pop the incoming data into an existing Tkinter app that I have created. What's the easiest/most efficient way of handling this? Would I create a separate thread that has the listene

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Alex Martelli
Christoph Conrad <[EMAIL PROTECTED]> wrote: > Hello Roger, > > > since the length of the first sequence of the letter 'a' is 2. Yours > > accepts it, right? > > Yes, i misunderstood your requirements. So it must be modified > essentially to that what Tim Chase wrote: > > m = re.search('^[^a

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin wrote: >> Sorry for the confusion. The correct pattern should reject all strings >> except those in which the first sequence of the letter 'a' that is >> followed by the letter 'b' has a length of exact

Re: ANN: SPE 0.8.2.a Python IDE: configure styles, interactive terminals & ubuntu

2006-01-26 Thread Claudio Grondi
SPE - Stani's Python Editor wrote: > Release news from http://pythonide.stani.be > > This is an important a bugfix release for all platforms. As new > features it can customize your fonts and colors (styles), supports > interactive terminals and has improved support for Ubuntu. > > Thanks to Mar

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>>r = re.compile("[^a]*a{3}b+(a+b*)*") >>>matches = [s for s in listOfStringsToTest if r.match(s)] >> >> Wow, I like it, but it allows some strings it shouldn't. For example: >> >> "xyz123aabbaaab" >> >> (It skips over the t

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Peter Hansen
Roger L. Cauvin wrote: > Sorry for the confusion. The correct pattern should reject all strings > except those in which the first sequence of the letter 'a' that is followed > by the letter 'b' has a length of exactly three. > > Hope that's clearer . . . . Examples are a *really* good way to c

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
>>r = re.compile("[^a]*a{3}b+(a+b*)*") >>matches = [s for s in listOfStringsToTest if r.match(s)] > > Wow, I like it, but it allows some strings it shouldn't. For example: > > "xyz123aabbaaab" > > (It skips over the two-letter sequence of 'a' and matches 'bbaaab'.) Anchoring it to the beginnin

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin" > <[EMAIL PROTECTED]> might have written: > >>Say I have some string that begins with an arbitrary sequence of >>characters >>and then alternates

Re: history

2006-01-26 Thread Claudio Grondi
yqyq22 wrote: > Dear all, > another little question, I use idle 1.1.2, is there a way to use a > history for the command line? > thanks in advance > Another possibility beside going to any of the previous lines and hitting [Return]: [Alt]+p Claudio -- http://mail.python.org/mailman/listinfo/py

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Tim Chase" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Sorry for the confusion. The correct pattern should reject >> all strings except those in which the first sequence of the >> letter 'a' that is followed by the letter 'b' has a length of >> exactly three. > > Ah...a little

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christoph Conrad
Hallo Alex, >> r = re.compile("[^a]*a{3}b+(a+b*)*") matches = [s for s in >> listOfStringsToTest if r.match(s)] > Unfortunately, the OP's spec is even more complex than this, if we are > to take to the letter what you just quoted; e.g. aazaaab SHOULD match, Then it's again "a{3}b", isn't it? Fr

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Alex Martelli
Tim Chase <[EMAIL PROTECTED]> wrote: > > Sorry for the confusion. The correct pattern should reject > > all strings except those in which the first sequence of the > > letter 'a' that is followed by the letter 'b' has a length of > > exactly three. > > Ah...a little more clear. > > r = re

Re: MySQLdb - Query/fetch don't return result when it *theorically* should

2006-01-26 Thread Mark Hertel
On Wed, 18 Jan 2006 18:31:39 -0500, Bernard Lebel <[EMAIL PROTECTED]> wrote: > I'm absolutely flabbergasted. > > Your suggestion worked, the loop now picks up the changed values, and > without the need to reconnect. > > It's the first time I have to commit after a query, up until I wrote > this pro

Re: replacing \n characters in a hash

2006-01-26 Thread Fredrik Lundh
(since this is a newsgroup, can you please quote the message you're replying to). Johhny wrote: > In response to that the output is this : > > 'Updated libc-client packages that fix a buffer overflow > issue are now\navailable.\n\nThis update has been rated as having > moderate security impact b

urllib2 chunked encoding

2006-01-26 Thread Sean Harper
I am trying to download some html using mechanize:br=Browser()r = br.open("url")b = r.read()print bI have used this code successfully many times and now I have run across an instance where it fails. It opens the url without error but then prints nothing. Looking at the http headers when it works fi

Re: replacing \n characters in a hash

2006-01-26 Thread Johhny
Hello All, thanks for your help. I got it working and learnt some more things which is always great. Your assitance has been very useful. Regards, Johhny -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing script with embedded python

2006-01-26 Thread Andrew Ayre
"Farshid Lashkari" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > The problem is that PyObject_CallObject always returns NULL. Is this the > > correct return value for simply executing a script, as there is no function > > return value involved? > > The documentation for PyObject_

Re: Using non-ascii symbols

2006-01-26 Thread Rocco Moretti
Terry Hancock wrote: > One thing that I also think would be good is to open up the > operator set for Python. Right now you can overload the > existing operators, but you can't easily define new ones. > And even if you do, you are very limited in what you can > use, and understandability suffers.

Re: replacing \n characters in a hash

2006-01-26 Thread Johhny
Hello, In response to that the output is this : 'Updated libc-client packages that fix a buffer overflow issue are now\navailable.\n\nThis update has been rated as having moderate security impact by the Red\nHat Security Response Team.' -- http://mail.python.org/mailman/listinfo/python-list

Re: Pulling numbers from ASCII filename not working

2006-01-26 Thread Bengt Richter
On 25 Jan 2006 12:42:20 -0800, "IamIan" <[EMAIL PROTECTED]> wrote: >Thank you for the replies, I'm new to Python and appreciate your >patience. I'm using Python 2.1. > >To reiterate, the ASCII files in the workspace are being read correctly >and their latitude values (coming from the filenames) ar

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
> Sorry for the confusion. The correct pattern should reject > all strings except those in which the first sequence of the > letter 'a' that is followed by the letter 'b' has a length of > exactly three. Ah...a little more clear. r = re.compile("[^a]*a{3}b+(a+b*)*") matches = [s

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Sybren Stuvel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger L. Cauvin enlightened us with: >> I'm looking for a regular expression that matches the first, and >> only the first, sequence of the letter 'a', and only if the length >> of the sequence is exactly 3. > > Your req

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christoph Conrad
Hello Roger, > since the length of the first sequence of the letter 'a' is 2. Yours > accepts it, right? Yes, i misunderstood your requirements. So it must be modified essentially to that what Tim Chase wrote: m = re.search('^[^a]*a{3}b', 'xyz123aabbaaab') Best wishes from germany, Christo

Re: sockets programming with python on mobile phones

2006-01-26 Thread Grant Edwards
On 2006-01-26, al pacino <[EMAIL PROTECTED]> wrote: > Is it possible to write applications using sockets for network > programming on MOBILE Phones( using Python on mobile phones > such as nokia 66* series ) > > actually i want my mobile to 'TALK' to my pc 'WIRELESSLY' so i can send > data between

Re: customized instance dictionaries, anyone?

2006-01-26 Thread Bengt Richter
On 25 Jan 2006 09:35:50 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >thx! indeed, it worked -- took me some time to figure out how to >implement the setting of attributes, too. i finally managed to get that >done using super: Seems good. > >the ``~.__setattr__()`` method tests for the s

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin" <[EMAIL PROTECTED]> might have written: >Say I have some string that begins with an arbitrary sequence of characters >and then alternates repeating the letters 'a' and 'b' any number of times, >e.g. > >"xyz123aaabbaaaba

ANN: SPE 0.8.2.a Python IDE: configure styles, interactive terminals & ubuntu

2006-01-26 Thread SPE - Stani's Python Editor
Release news from http://pythonide.stani.be This is an important a bugfix release for all platforms. As new features it can customize your fonts and colors (styles), supports interactive terminals and has improved support for Ubuntu. Thanks to Marco Ferreira there will be very soon a debian pack

Re: replacing \n characters in a hash

2006-01-26 Thread Steve Holden
Johhny wrote: > Hello, > > Here is the code (minus my details section). > > server = xmlrpclib.ServerProxy(url) > > session = server.auth.login(username,password) > > #functions. > > def getErrata(): > > channel_label = 'rhel-i386-as-4' > > errata = > server.channel.software.list_err

Re: replacing \n characters in a hash

2006-01-26 Thread Fredrik Lundh
Johhny wrote: > for vals in errata: > > print "%s\t\t%s\t\t%s\t%s\t%s" % > (vals['errata_advisory'],vals['errata_issue_date'],vals['errata_update_date'],vals['errata_last_modified_date'],vals['errata_type'], ) > > errata_info = getPackage(vals['errata_advisory'],) > > print errata_info['err

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Chase <[EMAIL PROTECTED]> wrote: > ... >> I'm not quite sure what your intent here is, as the >> resulting find would obviously be "aaa", of length 3. > > But that would also match ''; I think he wants negative

Re: Using non-ascii symbols

2006-01-26 Thread Terry Hancock
On Thu, 26 Jan 2006 01:12:10 -0600 Runsun Pan <[EMAIL PROTECTED]> wrote: > For the tests that I tried earlier, using han characters > as the variable names doesn't seem to be possible (Syntax > Error) in python. I'd love to see if I can use han char > for all those keywords like import, but it does

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
"Christoph Conrad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Roger, > >> I'm looking for a regular expression that matches the first, and only >> the first, sequence of the letter 'a', and only if the length of the >> sequence is exactly 3. > > import sys, re, os > > if _

Re: replacing \n characters in a hash

2006-01-26 Thread Larry Bates
Johhny wrote: > Hello, > > I am currently trying to write some scripts to get information from the > xmlrpc for redhat network. One of the issues I am having is trying to > strip off the special characters in the hash that is returned. Here is > an example of the information returned within the ha

Re: replacing \n characters in a hash

2006-01-26 Thread Johhny
Hello, Here is the code (minus my details section). server = xmlrpclib.ServerProxy(url) session = server.auth.login(username,password) #functions. def getErrata(): channel_label = 'rhel-i386-as-4' errata = server.channel.software.list_errata(session,channel_label,start_date,end_date)

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
Magnus Lycka wrote: > Fred wrote: > > Slackware Linux 10.2 > > Heh, Slackware was my first Linux distro. Version > 2.2 I think. 1993 maybe? I have been using Slackware since 1995, version 3.0 kernel 1.2.13 > Some suggestions: > Finally, the cgitb module is pretty useful. I > suggest that you loo

Re: How to handle two-level option processing with optparse

2006-01-26 Thread Magnus Lycka
R. Bernstein wrote: > I see how I missed this. Neither disable_.. or enable_.. have document > strings. And neither seem to described in the optparser section (6.21) > of the Python Library (http://docs.python.org/lib/module-optparse.html). http://docs.python.org/lib/optparse-other-methods.html --

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Magnus Lycka
Fred wrote: > Slackware Linux 10.2 Heh, Slackware was my first Linux distro. Version 2.2 I think. 1993 maybe? > Everything worked great up to this error when trying to load the > webpage: > "ImportError: No module name MySQLdb" Some suggestions: Start python interactively and try "import MySQLd

Re: Mining strings from a HTML document.

2006-01-26 Thread Magnus Lycka
Derick van Niekerk wrote: > Could you/anyone explain the 4 lines of code to me though? A crash > course in Python shorthand? What does it mean when you use two sets of > brackets as in : beg = [1,0][text.startswith(s1)] ? It's not as strange as it looks. [1,0] is a list. If you put [] after a list

Re: replacing \n characters in a hash

2006-01-26 Thread Carsten Haese
On Thu, 2006-01-26 at 09:49, Johhny wrote: > Hello, > > Thankyou for your response, > If I check that the errara_package value is with a print I get the > following. > > ===SNIP=== > Updated libc-client packages that fix a buffer overflow issue are now > available. > > This update has been rated

Re: Pulling numbers from ASCII filename not working

2006-01-26 Thread Dave Hansen
On Thu, 26 Jan 2006 06:39:20 GMT in comp.lang.python, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On 25 Jan 2006 12:42:20 -0800, "IamIan" <[EMAIL PROTECTED]> declaimed the >following in comp.lang.python: [...] >> I tried print repr(filename) and it returned the actual filename: >> 'n16w099.asc'

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Alex Martelli
Tim Chase <[EMAIL PROTECTED]> wrote: ... > I'm not quite sure what your intent here is, as the > resulting find would obviously be "aaa", of length 3. But that would also match ''; I think he wants negative loobehind and lookahead assertions around the 'aaa' part. But then there's the spec

Re: replacing \n characters in a hash

2006-01-26 Thread Johhny
Hello, Thankyou for your response, If I check that the errara_package value is with a print I get the following. ===SNIP=== Updated libc-client packages that fix a buffer overflow issue are now available. This update has been rated as having moderate security impact by the Red Hat Security Respo

Re: Assigning to self.__class__

2006-01-26 Thread Alex Martelli
Heiko Wundram <[EMAIL PROTECTED]> wrote: > bruno at modulix wrote: > > Paul McGuire wrote: > >> or am I taking advantage of a fortuitous accident, which may get > >> undone at a future time? > > > > It's certainly not a fortuitous accident. > > And even the (printed) cookbook has examples which

Re: Nitpicking - slightly misleading traceback

2006-01-26 Thread Alex Martelli
Sybren Stuvel <[EMAIL PROTECTED]> wrote: ... > if data[x][y] > 0 or datadict.has_key(key): > > This might even make things fit on one line again ;-) Particularly if you code it idiomatically: if data[x][y] > 0 or key in datadict: Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing \n characters in a hash

2006-01-26 Thread Carsten Haese
On Thu, 2006-01-26 at 09:24, Johhny wrote: > Hello, > > I am currently trying to write some scripts to get information from the > xmlrpc for redhat network. One of the issues I am having is trying to > strip off the special characters in the hash that is returned. Here is > an example of the infor

Re: history

2006-01-26 Thread [EMAIL PROTECTED]
yqyq22 wrote: > Dear all, > another little question, I use idle 1.1.2, is there a way to use a > history for the command line? Cursor up to a previously entered line and hit return. The line will be repeated, allowing editing. If the "line" was an entire block, the entire block will be repeated.

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Tim Chase
> Say I have some string that begins with an arbitrary > sequence of characters and then alternates repeating the > letters 'a' and 'b' any number of times, e.g. > "xyz123aaabbaaabaaaabb" > > I'm looking for a regular expression that matches the > first, and only the first, sequence

sockets programming with python on mobile phones

2006-01-26 Thread al pacino
Hi everyone, Is it possible to write applications using sockets for network programming on MOBILE Phones( using Python on mobile phones such as nokia 66* series ) actually i want my mobile to 'TALK' to my pc 'WIRELESSLY' so i can send data between the two I think it works over the GPRS stack. P

Re: www.mywebsite.py

2006-01-26 Thread Fuzzyman
Simon Brunning wrote: > On 1/24/06, Cyril Bazin <[EMAIL PROTECTED]> wrote: > > Does someone ever tried (and succeed) to make an address like > > "www.website.py". > > I found that the .py extension is given to the paraguay. > > > > I found this link ( http://www.nic.py/) but I don't speak spanish.

Re: Possible memory leak?

2006-01-26 Thread Tuvas
The times that I posted was the time that it took to perform ONE row iteration. As you can see, the time was going up, fairly dramatically. Why on earth could it be doing this? I understand the the time will fluctuate somewhat depending upon what else the CPU is doing, but, why is the base time inc

replacing \n characters in a hash

2006-01-26 Thread Johhny
Hello, I am currently trying to write some scripts to get information from the xmlrpc for redhat network. One of the issues I am having is trying to strip off the special characters in the hash that is returned. Here is an example of the information returned within the hash : ===SNIP=== {'errata_

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Sybren Stuvel
Roger L. Cauvin enlightened us with: > I'm looking for a regular expression that matches the first, and > only the first, sequence of the letter 'a', and only if the length > of the sequence is exactly 3. Your request is ambiguous: 1) You're looking for the first, and only the first, sequence of

Re: Nitpicking - slightly misleading traceback

2006-01-26 Thread Sybren Stuvel
Juho Schultz enlightened us with: > However, the bug sits on the next line. [...] I feel the traceback > is misleading. Well, the bug sits in the command starting on the line indicated. Nitpick back: Learn about operator precedence and Python syntax rules. You don't need so many brackets: if dat

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christoph Conrad
Hello Roger, > I'm looking for a regular expression that matches the first, and only > the first, sequence of the letter 'a', and only if the length of the > sequence is exactly 3. import sys, re, os if __name__=='__main__': m = re.search('a{3}', 'xyz123aaabbaaaabaaabb') print m

Re: en la misma linea

2006-01-26 Thread Heiko Wundram
Sebastian Bassi wrote: > Por ejemplo: > if name != 'comic': return > Hay un return despues de los dos puntos, no se que significa. I can't write spanish, but nevertheless maybe an english answer is of help. Yes, it's allowed to write that, and it is the same as: if name != 'comic': return Yo

Match First Sequence in Regular Expression?

2006-01-26 Thread Roger L. Cauvin
Say I have some string that begins with an arbitrary sequence of characters and then alternates repeating the letters 'a' and 'b' any number of times, e.g. "xyz123aaabbaaabaaaabb" I'm looking for a regular expression that matches the first, and only the first, sequence of the letter 'a

Re: Mining strings from a HTML document.

2006-01-26 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Derick van Niekerk <[EMAIL PROTECTED]> wrote: . . . >I suppose very few books on python start off with HTML processing in >stead of 'hello world' :p .

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Steve Holden
Fred wrote: > Here is the complete error from my Apache error log: > > Traceback (most recent call last): > File "/var/www/cgi-bin/mysqld_script_test.py", line 7, in ? > import MySQLdb > ImportError: No module named MySQLdb > [Thu Jan 26 07:25:16 2006] [error] [client 127.0.0.1] malformed he

Re: Convert a long XML string into indented format

2006-01-26 Thread Paul Boddie
Jim wrote: > > You want to pretty print. Have a look at > http://www.boddie.org.uk/python/XML_intro.html > for example. > > Thank you to Paul, I've found that page useful, Let me know if there's anything else that you think it should cover! After updating the HTML parsing page and rediscovering

Nitpicking - slightly misleading traceback

2006-01-26 Thread Juho Schultz
if ((data[x][y] > 0) or (datadict.has_key[key])): Traceback (most recent call last): File "reduce.py", line 524, in remove_badvalues if ((data[x][y] > 0) or TypeError: unsubscriptable object However, the bug sits on the next line. I used square brackets when normal brackets were nee

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
>From what I can tell everything seems right. Here are the results of the sys.path: >>> print sys.path ['', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
Here is the complete error from my Apache error log: Traceback (most recent call last): File "/var/www/cgi-bin/mysqld_script_test.py", line 7, in ? import MySQLdb ImportError: No module named MySQLdb [Thu Jan 26 07:25:16 2006] [error] [client 127.0.0.1] malformed header from script. Bad head

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
This is the result of print sys.path: >>> print sys.path ['', '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4', '/usr/local/lib/python2.4/plat-linux2', '/usr/local/lib/python2.4/lib-tk', '/usr/local/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages'] MySQLdb lives here

<    1   2   3   >