Re: problem with exec and locals()

2008-07-10 Thread Uwe Schmitt
On 1 Jul., 15:15, Mel <[EMAIL PROTECTED]> wrote: > rocksportrockerwrote: > > > Hi, > > > the following code does not work until I ommit the "a=0" statement. > > >    def test(): > >        exec "a=3" in locals() > >        print a > >        a=0 > > >     test() > > > print raises: > >      Unbound

Re: Bypassing WebFilter security

2008-07-10 Thread Daniel Fetchinson
>> I am working in an organization, which is using a very strict >> webcontent filter management suite. Due to this i am unable to >> download any exe file, or surf web (even the necessary downloads from >> sourceforgenet are blocked). I was wondering, if python could be of >> any help. Say i have

Re: Elisp Lesson on file processing (make downloadable copy of a website)

2008-07-10 Thread [EMAIL PROTECTED]
Xah Lee wrote: « ... emacs program and tutorial that does archiving a website for offline reading. (See http://xahlee.org/emacs/make_download_copy.html ) » Sashi wrote: «Why not use wget or curl?» The Emacs lisp program makes a archive of parts of website you own, so that readers of your website

Re: Python 3.0 and removal of the 'string' module

2008-07-10 Thread Ben Finney
Terry Reedy <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Can anyone see a reason to believe the above wiki page's statement > > about the 'string' module being removed? More to the point, can > > anyone see a reason why that statement should remain on that page? > > Removing string and mov

Re: Simple question, how do you tell how many items in a list?

2008-07-10 Thread Vlastimil Brom
2008/7/11, Alex Bryan <[EMAIL PROTECTED]>: > > I am just wondering how you get an integer value for how many items there > are in a list, preferably w/o a for loop. > > -- > http://mail.python.org/mailman/listinfo/python-list > Use len >>> len([1,2,3]) 3 >>> vbr -- http://mail.python.org/mailman/

Simple question, how do you tell how many items in a list?

2008-07-10 Thread Alex Bryan
I am just wondering how you get an integer value for how many items there are in a list, preferably w/o a for loop. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bypassing WebFilter security

2008-07-10 Thread Stefan Behnel
pranav wrote: > I am working in an organization, which is using a very strict > webcontent filter management suite. Due to this i am unable to > download any exe file, or surf web (even the necessary downloads from > sourceforgenet are blocked). I was wondering, if python could be of > any help. Sa

Re: B-Soup: broken iterator, tag a keyword?

2008-07-10 Thread Stefan Behnel
Hi, Brendan wrote: > I have the following using Beautiful Soup: > > soup = BeautifulSoup(data) > tags = soup.findAll(href=re.compile("/MER_FRS_L2_Canada/MER_FRS_\S > +gz")) > for tag in tags: > print tag['href'] > print tag.parent.nextSibling.string > print tag.parent.nextSibling.next

Re: using Python's AST generator for other languages

2008-07-10 Thread eliben
> > 2) What is the meaning of the comment in astgen.py ? Are the Python > > maintainers unhappy with the design of the AST ?3 > > Node, I think, is talking about a node in the parse tree. (AST is > generated from another parse tree.) See PEP 339 for details. > Thanks, PEP 339 clarified a lot to

Re: Python 3.0 and removal of the 'string' module

2008-07-10 Thread Terry Reedy
Ben Finney wrote: Howdy all, The Python wiki page states on its page for Python 3.0 http://wiki.python.org/moin/Python3.0>, in the section for "Standard Library Changes" http://wiki.python.org/moin/Python3.0#head-40dd57e6561cce0b209ef49f8ce86030c6313113>, that the 'string' module is to be remo

Bypassing WebFilter security

2008-07-10 Thread pranav
Hello everyone, I am working in an organization, which is using a very strict webcontent filter management suite. Due to this i am unable to download any exe file, or surf web (even the necessary downloads from sourceforgenet are blocked). I was wondering, if python could be of any help. Say i have

recommended gcc versions for python2.5 compilation on Solaris sparc/x86, AIX, Linux

2008-07-10 Thread YIN Ming
Dear All, We are going to compile python2.5.1 with gcc on various platforms, including Solaris8(sparc), Solaris10(x86), AIX and Linux. Just want to check if there are recommended gcc versions for these platforms. We aim to: 1. use a single version of gcc for all platforms 2. us

Re: paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-10 Thread Ben Finney
WDC <[EMAIL PROTECTED]> writes: > On Jul 10, 10:33 pm, 128 <[EMAIL PROTECTED]> wrote: […] > > Is that spam i spy? It is, clearly. Please don't make the problem worse by repeating the entire thing. -- \“I got fired from my job the other day. They said my | `\ perso

Re: error with configure (svn 64857)

2008-07-10 Thread WDC
On Jul 10, 6:57 pm, "Mathieu Prevot" <[EMAIL PROTECTED]> wrote: > 2008/7/10 "Martin v. Löwis" <[EMAIL PROTECTED]>: > > >> I have the following error when I run configure: > > >> checking size of wchar_t... configure: error: cannot compute sizeof > >> (wchar_t) > > >> what can I do ? > > > Study co

Re: paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-10 Thread WDC
On Jul 10, 10:33 pm, 128 <[EMAIL PROTECTED]> wrote: > paypal wholesale men jordans (paypal accept)(www super-saler com > > paypal wholesale men jordans 1 (paypal accept)(www super-saler com > > paypal wholesale men jordans 2 (paypal accept)(www super-saler com > > paypal wholesale men jordans 3 (pa

Re: Loading just in time

2008-07-10 Thread Scott David Daniels
D'Arcy J.M. Cain wrote: I am trying to create a utility module that only loads functions when they are first called rather than loading everything. I have a bunch of files in my utility directory with individual methods and for each I have lines like this in __init__.py: def calc_tax(*arg, **na

paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-10 Thread 128
paypal wholesale men jordans (paypal accept)(www super-saler com paypal wholesale men jordans 1 (paypal accept)(www super-saler com paypal wholesale men jordans 2 (paypal accept)(www super-saler com paypal wholesale men jordans 3 (paypal accept)(www super-saler com paypal wholesale men jordans

paypal wholesale men jordans 17 (paypal accept)(www super-saler com

2008-07-10 Thread 128
paypal wholesale men jordans (paypal accept)(www super-saler com paypal wholesale men jordans 1 (paypal accept)(www super-saler com paypal wholesale men jordans 2 (paypal accept)(www super-saler com paypal wholesale men jordans 3 (paypal accept)(www super-saler com paypal wholesale men jordans

Re: TypeError, I know why but not how!?

2008-07-10 Thread alex23
On Jul 10, 11:15 pm, ssecorp <[EMAIL PROTECTED]> wrote: > I don't fully understand why I have to do this. Because your function is recursive. You call your function passing it a list of numbers. It generates a new number and looks to see if it's in the 'placed' list. If it is, it calls itself aga

Python 3.0 and removal of the 'string' module

2008-07-10 Thread Ben Finney
Howdy all, The Python wiki page states on its page for Python 3.0 http://wiki.python.org/moin/Python3.0>, in the section for "Standard Library Changes" http://wiki.python.org/moin/Python3.0#head-40dd57e6561cce0b209ef49f8ce86030c6313113>, that the 'string' module is to be removed. It references PE

Basic Question about Python WebServer File handling

2008-07-10 Thread Alok Kumar
Hi, I need to have a python webserver which can handle Get request from the clients and upload the *files* from 4 different directories. Can someone please point me what to exactly look for. Thanks you very much for this great help. Regards Alok Kumar -- http://mail.python.org/mailman/listinfo/

Re: Can this program be shortened? Measuring program-length?

2008-07-10 Thread r.e.s.
"r.e.s." <[EMAIL PROTECTED]> wrote ... > <[EMAIL PROTECTED]> wrote ... >> "r.e.s." <[EMAIL PROTECTED]> wrote: >>> Can the following program be shortened? ... >>> >>> def h(n,m): >>> E=n, >>> while (E!=())*m>0:n=h(n+1,m-1);E=E[:-1]+(E[-1]>0)*(E[-1]-1,)*n >>> return n >>> h(9,9) >>> >> >> Some id

Re: Can this program be shortened? Measuring program-length?

2008-07-10 Thread r.e.s.
<[EMAIL PROTECTED]> wrote ... > "r.e.s." <[EMAIL PROTECTED]> wrote: >> Can the following program be shortened? ... >> >> def h(n,m): >> E=n, >> while (E!=())*m>0:n=h(n+1,m-1);E=E[:-1]+(E[-1]>0)*(E[-1]-1,)*n >> return n >> h(9,9) >> > > Some ideas... > > # h is your version > def h(n,m): > E=n,

Re: Doubts about how implementing asynchronous timeouts through a heap

2008-07-10 Thread Josiah Carlson
On Jul 10, 11:30 am, Josiah Carlson <[EMAIL PROTECTED]> wrote: > On Jul 9, 4:13 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > I'm trying to implement an asynchronous scheduler for asyncore to call > > functions at a later time without blocking the main loop. > > The logic beh

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread Michiel Overtoom
Ron wrote: Now all I need to know is how to plug the date into the datetime object from a string. You could use simple string manipulation: >>> import datetime >>> a="20081031" >>> d=datetime.date(int(a[0:4]),int(a[4:6]),int(a[6:8])) >>> d datetime.date(2008, 10, 31) >>> print d 2008-10-31

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread Larry Bates
RV wrote: On Thu, 10 Jul 2008 13:39:29 -0700, Gary Herron <[EMAIL PROTECTED]> wrote: The datetime module has what you need. It has methods (with examples) on building a datetime object from a string, and it has a object named timedelta, and the ability to subtract a timedelta from a time.

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread Gary Herron
RV wrote: On Thu, 10 Jul 2008 13:39:29 -0700, Gary Herron <[EMAIL PROTECTED]> wrote: The datetime module has what you need. It has methods (with examples) on building a datetime object from a string, and it has a object named timedelta, and the ability to subtract a timedelta from a time

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread RV
On Thu, 10 Jul 2008 13:39:29 -0700, Gary Herron <[EMAIL PROTECTED]> wrote: >The datetime module has what you need. > >It has methods (with examples) on building a datetime object from a >string, and it has a object named timedelta, and the ability to subtract >a timedelta from a time. > >For in

Re: Reportlab Image object opens filehandles

2008-07-10 Thread norseman
Daniel de Sousa Barros wrote: - Original Message - From: "norseman" <[EMAIL PROTECTED]> To: "Daniel de Sousa Barros" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, July 08, 2008 6:49 PM Subject: Re: Reportlab Image object opens filehandles Daniel de Sousa Barros wrote: Hi Mr Robin, I saw

Re: Python and decimal character entities over 128.

2008-07-10 Thread Ben Finney
I don't have an answer for why Python might be mis-handling the data, but wanted to make a factual correction: [EMAIL PROTECTED] writes: > Some web feeds use decimal character entities that seem to confuse > Python (or me). For example, the string "doesn't" may be coded as > "doesn’t" which shoul

Re: Loading just in time

2008-07-10 Thread Ben Finney
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> writes: > Performance optimization wasn't really my goal here. What I was > looking for was the ability to spread the functions around different > files to manage them better from a proggrammer's POV. Why not do that, then? Your functions should be organised

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread MRAB
On Jul 10, 9:46 pm, ssecorp <[EMAIL PROTECTED]> wrote: > >>> def mod(x,y): > >         return x.append(y) > append adds y to list x and returns None, which is then returned by mod. > > > >>> mod([1,2],3) > >>> k=[1,2,3] > >>> k > [1, 2, 3] > >>> l = mod(k,4) 4 has been appended to list k and mod h

Re: error with configure (svn 64857)

2008-07-10 Thread Mathieu Prevot
2008/7/10 "Martin v. Löwis" <[EMAIL PROTECTED]>: >> I have the following error when I run configure: >> >> checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) >> >> what can I do ? > > Study config.log for the source of the problem. Thank you Martin. How can I remove -lgc

Re: using Python's AST generator for other languages

2008-07-10 Thread Benjamin
On Jul 10, 12:40 pm, eliben <[EMAIL PROTECTED]> wrote: > Hello, > > I'm building a parser in Python, and while pondering on the design of > my ASTs had the idea to see what Python uses. I quickly got to the > compiler.ast module, and understood it's automatically generated. So I > went to the sourc

Re: multithreading in python ???

2008-07-10 Thread Kris Kennaway
Laszlo Nagy wrote: Abhishek Asthana wrote: Hi all , I have large set of data computation and I want to break it into small batches and assign it to different threads .I am implementing it in python only. Kindly help what all libraries should I refer to implement the multithreading in pytho

Re: Determining when a file has finished copying

2008-07-10 Thread Cameron Simpson
On 10Jul2008 13:20, Manuel Vazquez Acosta <[EMAIL PROTECTED]> wrote: | Cameron Simpson wrote: | > On 09Jul2008 15:54, Ethan Furman <[EMAIL PROTECTED]> wrote: | >> The solution my team has used is to monitor the file size. If the file | >> has stopped growing for x amount of time (we use 45 secon

Re: Smal question

2008-07-10 Thread Aahz
[contextectomy] If we answer a small question, are we making smalltalk? -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "as long as we like the same operating system, things are cool." --piranha -- http://mail.python.org/mailman/listinfo/python-list

Re: redirecting output of process to a file using subprocess.Popen()

2008-07-10 Thread Matt Nordhoff
skeept wrote: > On Jul 9, 7:32 pm, [EMAIL PROTECTED] wrote: >> I am trying to redirect stderr of a process to a temporary file and >> then read back the contents of the file, all in the same python >> script. As a simple exercise, I launched /bin/ls but this doesn't >> work: >> >> #!/usr/bin/python

Re: Can this program be shortened? Measuring program-length?

2008-07-10 Thread wolfram . hinderer
On 10 Jul., 21:57, "r.e.s." <[EMAIL PROTECTED]> wrote: > Can the following program be shortened? ... > > def h(n,m): > E=n, > while (E!=())*m>0:n=h(n+1,m-1);E=E[:-1]+(E[-1]>0)*(E[-1]-1,)*n > return n > h(9,9) > Some ideas... # h is your version def h(n,m): E=n, while (E!=())*m>0:n=h(n+1,m-1)

Re: redirecting output of process to a file using subprocess.Popen()

2008-07-10 Thread skeept
On Jul 9, 7:32 pm, [EMAIL PROTECTED] wrote: > I am trying to redirect stderr of a process to a temporary file and > then read back the contents of the file, all in the same python > script. As a simple exercise, I launched /bin/ls but this doesn't > work: > > #!/usr/bin/python > import subprocess a

Re: Terminate a python script from linux shell / bash script

2008-07-10 Thread norseman
Gros Bedo wrote: That's not how it works. If you kill one running python script it will not effect other python scripts. Each script has its own interpreter process running. GB> So, is there a way from the Linux shell or a bash script to terminate GB> just one specific Python script ?

Re: error with configure (svn 64857)

2008-07-10 Thread Martin v. Löwis
> I have the following error when I run configure: > > checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) > > what can I do ? Study config.log for the source of the problem. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python with Ecmascript

2008-07-10 Thread Daniel Fetchinson
>> Is there a way to do similar things on linux? > > NJSModule? > http://en.wikipedia.org/wiki/NJS This seems to be very good indeed. Just downloaded njs but the only njsmodule version I could find was for python 2.1. Does anyone have a recent copy? Cheers, Daniel -- Psss, psss, put it down! - h

Re: Problems Returning an HTTP 200 Ok Message

2008-07-10 Thread Guy Davidson
On Jul 10, 12:38 pm, samwyse <[EMAIL PROTECTED]> wrote: > On Jul 10, 1:50 pm, Guy Davidson <[EMAIL PROTECTED]> wrote: > > > Hi Folks, > > > I'm having some issues with an small socket based server I'm writing, > > and I was hoping I could get some help. > > > My code (attached below) us supposed to

Re: handling unexpected exceptions in pdb

2008-07-10 Thread Simon Bierbaum
Am 10.07.2008 um 20:52 schrieb R. Bernstein: Simon Bierbaum <[EMAIL PROTECTED]> writes: Hi all, I'm in an interactive session in pdb, debugging my code using pdb.runcall. Somewhere, an exception is raised and lands uncaught on stdout. Is there any way of picking up this exception and at leas

Re: You, spare time and SyntaxError

2008-07-10 Thread Daniel da Silva
I applaud your creativity. Very nice. On Wed, Jul 9, 2008 at 10:56 AM, <[EMAIL PROTECTED]> wrote: > def ine(you): >yourself = "what?" >go = list("something"), list("anything") >be = "something" >please = be, yourself >yourself = "great" >for good in yourself: >if y

Re: Terminate a python script from linux shell / bash script

2008-07-10 Thread Piet van Oostrum
> Gros Bedo <[EMAIL PROTECTED]> (GB) wrote: >GB> Yes I've seen that each python script calls its own instance of >GB> Python. But how to know which is the good one in bash ? Is there a >GB> command that gets the parameters of process, so I could use grep to >GB> select the one containing the n

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
Well, that about wraps this up...MRAB was 100% correct, that solution worked...not sure how I managed to mess it up when I tried it early. Based on the incoming values of u here is the code with the minimal number of maskings: def findit(u): mask = 0x u += 0xe91aaa35 u ^= u >>

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread ssecorp
>>> def mod(x,y): return x.append(y) >>> mod([1,2],3) >>> k=[1,2,3] >>> k [1, 2, 3] >>> l = mod(k,4) >>> l >>> k [1, 2, 3, 4] >>> l >>> k==l False >>> mod(k,5) >>> k [1, 2, 3, 4, 5] >>> mod(l,4) Traceback (most recent call last): File "", line 1, in mod(l,4) File "", line 2, in m

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread ssecorp
ty very good answer. i know i shouldn't use lambda like that, i never do i was just playing around there and then this happened which i thought was weird. On Jul 10, 8:09 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > David C. Ullrich wrote: > > In article > > <[EMAIL PROTECTED]>, > >  ssecorp

Re: python scalability

2008-07-10 Thread Tim Mitchell
Thanks for all the replies - they have all been helpful. On reflection I think our problems are probably design and people related. Cheers, Tim Michele Simionato wrote: On Jul 10, 6:32 am, Tim Mitchell <[EMAIL PROTECTED]> wrote: Hi All, I work on a desktop application that has been develo

Re: PIL: Transparent PNGs and im.paste: ValueError: bad transparency mask

2008-07-10 Thread Durand
I posted this too soon. Converting the images to png with image magick's convert did the trick...However, I'm still not sure why I need to convert the images in the first place. Are there different types of PNGs? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can anyone suggest a date peocedure...

2008-07-10 Thread Gary Herron
RLV wrote: I'd like to find a simple... (I'm a simple person) procedure to subtract a numerical number from a six char date string MMDD and then convert back to a new date string. I'm sure there's a way to do it, but the date modules haven't been much help. TIA Ron -- http://mail.python.

error with configure (svn 64857)

2008-07-10 Thread Mathieu Prevot
Hi, I have the following error when I run configure: checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) what can I do ? Mathieu -- http://mail.python.org/mailman/listinfo/python-list

PIL: Transparent PNGs and im.paste: ValueError: bad transparency mask

2008-07-10 Thread Durand
Hi! I'm trying to paste a png with a transparent layer into an image using "image.paste(tesla,(20,10), tesla)" but I'm getting this error: ValueError: bad transparency mask I have used im.paste(image,box,image) sucessfully before to paste an image with transparency, however, it doesn't seem to

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
On Jul 10, 4:04 pm, Harald Luessen <[EMAIL PROTECTED]> wrote: > On Thu, 10 Jul 2008 Jordan wrote: > > > > >On Jul 10, 1:35 pm, MRAB <[EMAIL PROTECTED]> wrote: > >> On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: > > >> > I am trying to rewrite some C source code for a poker hand evaluator > >

Can anyone suggest a date peocedure...

2008-07-10 Thread RLV
I'd like to find a simple... (I'm a simple person) procedure to subtract a numerical number from a six char date string MMDD and then convert back to a new date string. I'm sure there's a way to do it, but the date modules haven't been much help. TIA Ron -- http://mail.python.org/mailman/li

Unit Testing Techniques

2008-07-10 Thread Casey McGinty
I'm familiar with the unittest module in Python, however I'm hoping someone can point me to some examples of more advanced usages of the framework. For example: 1. Using the framework to test a package with nested sub-packages and modules without having to hard code the location/name of each test

Re: parsing incoming emails

2008-07-10 Thread Michiel Overtoom
Ahmed wrote... > I am working on a project where I need to parse incoming emails > (Microsoft outlook) I'm not sure if you are able to bypass Outlook (and have Python fetch the mail itself using poplib), but if you are, the following code might be useful. I use this to pry apart emails which mig

Re: You, spare time and SyntaxError

2008-07-10 Thread [EMAIL PROTECTED]
On 10 juil, 08:53, [EMAIL PROTECTED] wrote: > > just... great !-) > > Thanks :) Nope, really, I mean it. To me, there's a clear relation between code, mathematics and poetry. I've been wanting to write some "code poems" for a long time now but never managed to get enough time and inspiration. Whil

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Harald Luessen
On Thu, 10 Jul 2008 Jordan wrote: >On Jul 10, 1:35 pm, MRAB <[EMAIL PROTECTED]> wrote: >> On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: >> >> >> >> > I am trying to rewrite some C source code for a poker hand evaluator >> > in Python.  Putting aside all of the comments such as just using t

Can this program be shortened? Measuring program-length?

2008-07-10 Thread r.e.s.
Can the following program be shortened? ... def h(n,m): E=n, while (E!=())*m>0:n=h(n+1,m-1);E=E[:-1]+(E[-1]>0)*(E[-1]-1,)*n return n h(9,9) Note: Although it halts eventually in principle, this program can't be expected to terminate on any machine in the universe, as it computes a number lar

Re: parsing incoming emails

2008-07-10 Thread Terry Reedy
I am working on a project where I need to parse incoming emails (Microsoft outlook) with a specific subject into an excel file or a Microsoft access table. You should be able to give Outlook a rule to call a program (your Python one) when the subject matches whatever. From Python, use the

Re: Problems Returning an HTTP 200 Ok Message

2008-07-10 Thread samwyse
On Jul 10, 1:50 pm, Guy Davidson <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I'm having some issues with an small socket based server I'm writing, > and I was hoping I could get some help. > > My code (attached below) us supposed to read an HTTP Post message > coming from a power meter, parse it, an

parsing incoming emails

2008-07-10 Thread Ahmed, Shakir
HI, I am working on a project where I need to parse incoming emails (Microsoft outlook) with a specific subject into an excel file or a Microsoft access table. I am using python for my GIS works but not sure how I can use python script here to work with Microsoft outlook email. Any h

Re: Python with Ecmascript

2008-07-10 Thread Alan Isaac
Daniel Fetchinson wrote: Is there a way to do similar things on linux? NJSModule? http://en.wikipedia.org/wiki/NJS Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems Returning an HTTP 200 Ok Message

2008-07-10 Thread Joshua Kugler
Guy Davidson wrote: > Hi Folks, > > I'm having some issues with an small socket based server I'm writing, > and I was hoping I could get some help. > > My code (attached below) us supposed to read an HTTP Post message > coming from a power meter, parse it, and return a proper HTTP 200 Ok > messa

Re: sort(cmp=func)

2008-07-10 Thread Tobiah
On Wed, 09 Jul 2008 20:58:32 -0700, Daniel Fetchinson wrote: >> I have a list of objects that generate code. Some >> of them depend on others being listed first, to >> satisfy dependencies of others. >> >> I wrote a cmp function something like this: >> >> def dep_cmp(ob1, ob2): >> >> i

Re: handling unexpected exceptions in pdb

2008-07-10 Thread R. Bernstein
Simon Bierbaum <[EMAIL PROTECTED]> writes: > Hi all, > > I'm in an interactive session in pdb, debugging my code using > pdb.runcall. Somewhere, an exception is raised and lands uncaught on > stdout. Is there any way of picking up this exception and at least > read the full message, or even access

Problems Returning an HTTP 200 Ok Message

2008-07-10 Thread Guy Davidson
Hi Folks, I'm having some issues with an small socket based server I'm writing, and I was hoping I could get some help. My code (attached below) us supposed to read an HTTP Post message coming from a power meter, parse it, and return a proper HTTP 200 Ok message. The problem is that the socket fa

Re: Loading just in time

2008-07-10 Thread samwyse
On Jul 10, 9:45 am, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > I am trying to create a utility module that only loads functions when > they are first called rather than loading everything.  I have a bunch > of files in my utility directory with individual methods and for each I > have lines li

Re: Elisp Lesson on file processing (make downloadable copy of a website)

2008-07-10 Thread Sashi
On Jul 6, 4:05 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > In this week i wrote a emacs program and tutorial that does archiving > a website for offline reading. > (Seehttp://xahlee.org/emacs/make_download_copy.html) Why not use wget or curl? -- http://mail.python.org/mailman/listinfo/pyt

Re: Doubts about how implementing asynchronous timeouts through a heap

2008-07-10 Thread Josiah Carlson
On Jul 9, 4:13 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to implement an asynchronous scheduler for asyncore to call > functions at a later time without blocking the main loop. > The logic behind it consists in: > > - adding the scheduled functions into a heapified list

Re: Smal question

2008-07-10 Thread Terry Reedy
Bruno Desthuilliers wrote: Hans Müller a écrit : Hello group, I have some scripts sharing some common functions. So what I'd like to have is a modern include. Of course python does not have (with good reasons) no include statement. But I'm too lazy to create a module which has to be installed

Re: sort(cmp=func)

2008-07-10 Thread norseman
Tobiah wrote: I have a list of objects that generate code. Some of them depend on others being listed first, to satisfy dependencies of others. I wrote a cmp function something like this: def dep_cmp(ob1, ob2): if ob1.name in ob2.deps: return -1 else

Re: Changing self: if self is a tree how to set to a different self

2008-07-10 Thread Terry Reedy
Bart Kastermans wrote: I am playing with some trees. In one of the procedures I wrote for this I am trying to change self to a different tree. A tree here has four members (val/type/left/right). I found that self = SS does not work; I have to write self.val = SS.val and the same for the othe

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread Terry Reedy
David C. Ullrich wrote: In article <[EMAIL PROTECTED]>, ssecorp <[EMAIL PROTECTED]> wrote: I am never redefining the or reassigning the list when using validate but since it spits the modified list back out that somehow means that the modified list is part of the environment and not the old

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread Jordan
On Jul 10, 1:35 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: > > > > > I am trying to rewrite some C source code for a poker hand evaluator > > in Python.  Putting aside all of the comments such as just using the C > > code, or using SWIG, etc.  I have

Re: Python and decimal character entities over 128.

2008-07-10 Thread Manuel Vazquez Acosta
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > Some web feeds use decimal character entities that seem to confuse > Python (or me). For example, the string "doesn't" may be coded as > "doesn’t" which should produce a right leaning apostrophe. > Python hates decimal entiti

Fwd: [ANN] Babel 0.9.3 released

2008-07-10 Thread Jeroen Ruigrok van der Werven
- Forwarded message from Christopher Lenz <[EMAIL PROTECTED]> - From: Christopher Lenz <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [ANN] Babel 0.9.3 released Date: Thu, 10 Jul 2008 11:26:23 +0200 X-Mailer: Apple Mail (2.926) Babel 0.9.3 - Jul 9, 2007 =

using Python's AST generator for other languages

2008-07-10 Thread eliben
Hello, I'm building a parser in Python, and while pondering on the design of my ASTs had the idea to see what Python uses. I quickly got to the compiler.ast module, and understood it's automatically generated. So I went to the source, ast.txt and tools/compiler/astgen.py, where I was this unexpect

Re: error when porting C code to Python (bitwise manipulation)

2008-07-10 Thread MRAB
On Jul 10, 4:56 am, Jordan <[EMAIL PROTECTED]> wrote: > I am trying to rewrite some C source code for a poker hand evaluator > in Python.  Putting aside all of the comments such as just using the C > code, or using SWIG, etc.  I have been having problems with my Python > code not responding the sam

Re: Idiomatic Python to convert list to dict

2008-07-10 Thread James Fassett
On Jul 10, 6:13 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > my_list = ['a', 'b', 'c', 'd', 'e'] > > dup_map = {} > > for item in my_list: > >     dup_map[item] = True > > > # ... sometime later > > > for complex_dict in large_list: > >     if complex_dict["char"] not in dup_map: > >      

Re: Idiomatic Python to convert list to dict

2008-07-10 Thread craig75
On Jul 10, 10:06 am, James Fassett <[EMAIL PROTECTED]> wrote: > Hi all, > > Simple question really on a best practice. I want to avoid adding > duplicates to a list. > > my_list = ['a', 'b', 'c', 'd', 'e'] > dup_map = {} > for item in my_list: >     dup_map[item] = True > > # ... sometime later > >

Re: Determining when a file has finished copying

2008-07-10 Thread Manuel Vazquez Acosta
Cameron Simpson wrote: > On 09Jul2008 15:54, Ethan Furman <[EMAIL PROTECTED]> wrote: >> The solution my team has used is to monitor the file size. If the file >> has stopped growing for x amount of time (we use 45 seconds) the file is >> done copying. Not elegant, but it works. > > If you kn

Re: re.search much slower then grep on some regular expressions

2008-07-10 Thread Kris Kennaway
J. Cliff Dyer wrote: On Wed, 2008-07-09 at 12:29 -0700, samwyse wrote: On Jul 8, 11:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote: samwyse wrote: You might want to look at Plex. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/ "Another advantage of Plex is that it compiles all of the

Re: Idiomatic Python to convert list to dict

2008-07-10 Thread Diez B. Roggisch
James Fassett schrieb: Hi all, Simple question really on a best practice. I want to avoid adding duplicates to a list. my_list = ['a', 'b', 'c', 'd', 'e'] dup_map = {} for item in my_list: dup_map[item] = True # ... sometime later for complex_dict in large_list: if complex_dict["char"

Idiomatic Python to convert list to dict

2008-07-10 Thread James Fassett
Hi all, Simple question really on a best practice. I want to avoid adding duplicates to a list. my_list = ['a', 'b', 'c', 'd', 'e'] dup_map = {} for item in my_list: dup_map[item] = True # ... sometime later for complex_dict in large_list: if complex_dict["char"] not in dup_map:

Re: plugins using cvs/distutils?

2008-07-10 Thread Sebastian "lunar" Wiesner
Deacon <[EMAIL PROTECTED]>: > Hi. I have an open-source application development environment that I > would like to enable an automated package download system for (like > downloadable plugins), using sourceforge as its repository. My > software will have a menu-based popup window, that will list t

Re: variable question

2008-07-10 Thread norseman
Support Desk wrote: I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do stuff with variable. But the variable assignment doesn't survive outside the if stateme

installing any python module

2008-07-10 Thread Bhagwat Kolde
Hi all, What is the correct process of installing any external python module? Once we downloaded any python module, Q1) Where this module should be placed in python installation file structure? Q2) How to execute setup.py file? Thanks, Bhagwat -- http://mail.python.org/mailman/listinfo/python-

Re: Emacs/Python Essentials?

2008-07-10 Thread Sebastian "lunar" Wiesner
xkenneth <[EMAIL PROTECTED]>: > What does everyone consider essential for emacs python dev? yasnippet is worth being looked at -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list

Re: ActiveState Code: the new Python Cookbook site

2008-07-10 Thread Trent Mick
Stef Mientki wrote: one small remark, If I want to browse 200 recipes, at 10 per page ... please make something like 100 available per page, are internet is fast enough nowadays. Touche. Done: http://code.activestate.com/recipes/?paginate_by=100 Cheers, Trent -- Trent Mick trentm at

Re: Smal question

2008-07-10 Thread Bruno Desthuilliers
Hans Müller a écrit : Hello group, I have some scripts sharing some common functions. So what I'd like to have is a modern include. Of course python does not have (with good reasons) no include statement. But I'm too lazy to create a module which has to be installed into the interpreter for som

Re: re.search much slower then grep on some regular expressions

2008-07-10 Thread Sebastian "lunar" Wiesner
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>: > On Mon, 07 Jul 2008 16:44:22 +0200, Sebastian \"lunar\" Wiesner wrote: > >> Mark Wooding <[EMAIL PROTECTED]>: >> >>> Sebastian "lunar" Wiesner <[EMAIL PROTECTED]> wrote: >>> # perl -e '("a" x 10) =~ /^(ab?)*$/;' zsh: segmentation fau

Re: formatting list -> comma separated

2008-07-10 Thread norseman
Robert wrote: given d: d = ["soep", "reeds", "ook"] I want it to print like soep, reeds, ook I've come up with : print ("%s"+", %s"*(len(d)-1)) % tuple(d) but this fails for d = [] any (pythonic) options for this? Robert -- http://mail.python.org/mailman/listinfo/python-list ===

Re: Local User Control

2008-07-10 Thread Sparky
On Jul 10, 10:13 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Sparky wrote: > > On Jul 10, 9:58 am, Tim Golden <[EMAIL PROTECTED]> wrote: > >> Sparky wrote: > >>> I don't know how feasible this is, but is it possible to have users > >>> log in to access a local database file in such a way that allow

Re: a simple 'for' question

2008-07-10 Thread Ethan Furman
Tim Roberts wrote: Ethan Furman <[EMAIL PROTECTED]> wrote: Ben Keshet wrote: it didn't help. it reads the pathway "as is" (see errors for both tries). It looks like it had the write pathway the first time, but could not find it because it searched in the path/way instead of in the path\w

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, ssecorp <[EMAIL PROTECTED]> wrote: > I am never redefining the or reassigning the list when using validate > but since it spits the modified list back out that somehow means that > the modified list is part of the environment and not the old one. > i thought what

Re: Local User Control

2008-07-10 Thread Tim Golden
Sparky wrote: On Jul 10, 9:58 am, Tim Golden <[EMAIL PROTECTED]> wrote: Sparky wrote: I don't know how feasible this is, but is it possible to have users log in to access a local database file in such a way that allows the program to know what user name and password they logged in with? This wo

  1   2   >