Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
Thanks Tim and Gerard for recommending karrigell. I just checked it out. It is indeed a nice package. However, I didn't find it easier to learn or use than CherryPy though. I read through CherryPy tutorials and have got a good idea how to use it. I also read Karrigell docs. The way Karrigell use

Re: Out of the box database support

2006-07-07 Thread Shane Hathaway
Alex Biddle wrote: > Ah, so separate downloads then. At least now I know. > > Ergh... I checked the version of Python my current host is running and its > 2.2. > > ...ergh This is why you really want a VPS (virtual private server). The cost is similar to a web host but you get to choose yo

Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Shane Hathaway
Gregory Piñero wrote: > I was just idley curious on what it would take to make a web plug-in > for Pygame. I'm picturing it working the way my browser currently > shows flash games. Is such an idea even possible? Has anyone > attempted this? I once played with a similar idea. Yes, it's possibl

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
I'm using CherryPy 2.2.1. I just ran benchmark.py multiple times. The fastest it got is 195 req/sec, with 50 threads. Python was taking 50+% CPU when the test was running. > It would be good to know which version of CherryPy you are using. That > wiki page is talking about the CP 2.0 branch; 2.1

Re: 2 problems

2006-07-07 Thread symonlandor
Mike Kent wrote: > [EMAIL PROTECTED] wrote: > > Hello,Im using Python 2.4.2 and I'm starting a few very basic > > programs,but theres two problems I've not found the answers for. > > My first problem is I need code that will count the number of letters > > in a string and return that number to a v

Re: Out of the box database support

2006-07-07 Thread Shane Hathaway
Alex Biddle wrote: > Ah, so separate downloads then. At least now I know. > > Ergh... I checked the version of Python my current host is running and its > 2.2. > > ...ergh This is why you really want a VPS (virtual private server). The cost is similar to a web host but you get to choose yo

Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Shane Hathaway
Gregory Piñero wrote: > Are there security issues too? Would you remove potentially harmful > Python libraries for the plugin, not allow system calls, etc? Would > you only allow file system access in one area? Ah, so you also want to distribute untrusted Python code. That's fairly hard. There

Re: Augument assignment versus regular assignment

2006-07-07 Thread Kirk McDonald
nagy wrote: > I do the following. First create lists x,y,z. Then add an element to x > using the augumented assignment operator. This causes all the other > lists to be changed also. > But if I use the assignment x=x+[4] instead of using the augumented > assignment, the y and z lists do not change.

check uploaded file's file size?

2006-07-07 Thread h3m4n
i have a short script that allows users to upload files, but when i try to check for a valid filesize (using fileitem) i get '-1' i can't find information about using filesize anywhere. any ideas? code: form = cgi.FieldStorage() fileitem = form["datafile"] print str(fileitem.filesize) -h3m4n

Augument assignment versus regular assignment

2006-07-07 Thread nagy
I do the following. First create lists x,y,z. Then add an element to x using the augumented assignment operator. This causes all the other lists to be changed also. But if I use the assignment x=x+[4] instead of using the augumented assignment, the y and z lists do not change. Why is that? This doe

python guru for urllib/mechanize

2006-07-07 Thread bruce
hi... i'm trying to get the pages from a site "axess.stanford.edu", and i'm running into problems. i've got some test code that allows me to get the 1st few pages. i'm having an issue when i run into a page that somehow interprets a url from a src of a frameset. i can't seem to mimic/implement thi

Re: multithreading and shared dictionary

2006-07-07 Thread Alex Martelli
Istvan Albert <[EMAIL PROTECTED]> wrote: > Stéphane Ninin wrote: > > > Is a lock required in such a case ? > > I believe that assignment is atomic and would not need a lock. Wrong, alas: each assignment *could* cause the dictionary's internal structures to be reorganized (rehashed) and impact a

Re: Attaching functions to objects as methods

2006-07-07 Thread Steven Bethard
John Machin wrote: > Injecting a "private" method into a particular instance is not much more > complicated: > > >>> def own(self, arg): > ...print "own" > ...self.ozz = arg > ... > >>> p = K() > >>> import types > >>> p.metho = types.MethodType(own, p) > >>> p.metho("plugh") > own >

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Steven D'Aprano
On Fri, 07 Jul 2006 09:39:38 -0700, Ant wrote: > >> [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] >> [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] >> # line injected by a malicious user >> "__import__('os').system('echo if I were bad I could do worse')" >> [('recId', 7 ), ('pars

Detecting 64bit vs. 32bit Linux

2006-07-07 Thread dwelch91
I need to detect whether the operating system I am running on (not the Python version) is 64bit or 32bit. One requirement is that I need to include support for non-Intel/AMD architectures. The 2 ways I have thought detecting 64bit are: 1. struct.calcsize("P") == 8 2. '64' in os.uname()[4] I'm

Re: 2 problems

2006-07-07 Thread Simon Forman
[EMAIL PROTECTED] wrote: > Hello,Im using Python 2.4.2 and I'm starting a few very basic > programs,but theres two problems I've not found the answers for. > My first problem is I need code that will count the number of letters > in a string and return that number to a variable. Do you mean like t

Re: Attaching functions to objects as methods

2006-07-07 Thread John Machin
On 8/07/2006 11:01 AM, tac-tics wrote: > Experimenting, I found that > x.fun = lambda: fun(x) > > works as well. Any comments on this way? > Appears to work. Less typing for a no-argument method, but you need to specify the argument list *twice* compared with *zero* times with the types

Re: Tkinter problem

2006-07-07 Thread Simon Forman
Jim Anderson wrote: > I'm running Kubuntu a derivative of Debian Linux. I'm using > Python 2.4 and tcl/tk 8.4. I'm running Tkinter programs and > they were running about a month ago. When I tried them again > yesterday, I got the following message: > > > python ~/prog/python/iodef/iodef.py > > Tr

Re: Launching multiple instances of a program with win32com.client.Dispatch?

2006-07-07 Thread tyler . schlosser
Bump...not sure if it's bad etiquette here, I apologize if it is. [EMAIL PROTECTED] wrote: > Hi Roger, > > Thanks for the response, but DispatchEx seems to do the exact same > thing as Dispatch in my case; there is still only one processID and one > instance of my program (I forgot to mention tha

Re: Attaching functions to objects as methods

2006-07-07 Thread tac-tics
Experimenting, I found that >>> x.fun = lambda: fun(x) works as well. Any comments on this way? -- http://mail.python.org/mailman/listinfo/python-list

Re: I thought I'd 'got' globals but...

2006-07-07 Thread Luis M. González
Markus Wankus wrote: > On Fri, 07 Jul 2006 19:41:36 -0400, Luis M. González <[EMAIL PROTECTED]> > wrote: > . > . > > OK, so I should include the global only if I plan to modify it. > > Otherwise, I don't need to include it. Am I right? > > > > Correct. Globals are always available to read from.

Re: Attaching functions to objects as methods

2006-07-07 Thread John Machin
On 8/07/2006 9:29 AM, tac-tics wrote: > Python is a crazy language when it comes to object versatility. I know > I can do: > class test: > ...def __init__(self): > ... pass x = test() def fun(): > ... print "fun" x.fun = fun x.fun() > fun > > However, expe

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Steven D'Aprano
On Fri, 07 Jul 2006 19:57:02 +0200, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> Personally, I would never use eval on any string I didn't write myself. If >> I was thinking about evaluating a user-string, I would always write a >> function to parse the string and accept only the specific s

Re: inheritance, types, operator overload, head ache

2006-07-07 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I'm working with the following code. I included some tests to make it > easy to see--if you run the code--what troubles I'm having. > > Can some one *please* splain me why str(obj) works but not print obj, May have something to do with escape chars... I tried with:

Re: I thought I'd 'got' globals but...

2006-07-07 Thread Markus Wankus
On Fri, 07 Jul 2006 19:41:36 -0400, Luis M. González <[EMAIL PROTECTED]> wrote: . . > OK, so I should include the global only if I plan to modify it. > Otherwise, I don't need to include it. Am I right? > Correct. Globals are always available to read from. You need to declare them if you wan

Re: strange i/o delay problem in socket

2006-07-07 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >while in most cases, the time needed for a handler thread to read the >request line from the socket is below 1 millisecond, there are some >cases this time is over severl thousand (or even higher) milliseconds. >I'm j

Re: Attaching functions to objects as methods

2006-07-07 Thread tac-tics
> Functions are descriptors[1], and their __get__ method is used to bind > them to a particular instance:: Thank you muchly. -- http://mail.python.org/mailman/listinfo/python-list

Re: I thought I'd 'got' globals but...

2006-07-07 Thread nate
> OK, so I should include the global only if I plan to modify it. > Otherwise, I don't need to include it. Am I right? I guess you could say that's true. I'm hardly an expert so I couldn't say there aren't other potential ramifications. (anyone?) But, as a rule I would declare the global varia

Re: Attaching functions to objects as methods

2006-07-07 Thread Steven Bethard
tac-tics wrote: > Python is a crazy language when it comes to object versatility. I know > I can do: > class test: > ...def __init__(self): > ... pass x = test() def fun(): > ... print "fun" x.fun = fun x.fun() > fun > > However, experimenting shows that t

Re: I thought I'd 'got' globals but...

2006-07-07 Thread Luis M. González
nate wrote: > try this: > > gname = 'nate' > def test(): >gname = 'amy' >print gname > > test() > print gname > > outputs: > 'amy' > 'nate' > > whereas this: > gname = 'nate' > def test(): >global gname >gname = 'amy' >print gname > > test() > print gname > > outputs: > 'amy' >

Re: I thought I'd 'got' globals but...

2006-07-07 Thread nate
try this: gname = 'nate' def test(): gname = 'amy' print gname test() print gname outputs: 'amy' 'nate' whereas this: gname = 'nate' def test(): global gname gname = 'amy' print gname test() print gname outputs: 'amy' 'amy' Luis M. González wrote: > Bruno Desthuilliers wrote:

Re: how can I avoid abusing lists?

2006-07-07 Thread Bruno Desthuilliers
Peter Otten a écrit : (snip) > I don't think your code is ugly. Anyway, here are two more alternatives: > > types = [0] * 3 dispatch = [0, 0, 2, 0, 1] for value in [1, 1, 0, 4]: > ... types[dispatch[value]] += 1 > ... > types > > [3, 1, 0] I wonder why I'm still pretendin

Attaching functions to objects as methods

2006-07-07 Thread tac-tics
Python is a crazy language when it comes to object versatility. I know I can do: >>> class test: ...def __init__(self): ... pass >>> x = test() >>> def fun(): ... print "fun" >>> x.fun = fun >>> x.fun() fun >>> However, experimenting shows that these attached functions are not bou

Re: Nested scopes, and augmented assignment

2006-07-07 Thread Piet van Oostrum
> Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >AP> On 2006-07-07, Piet van Oostrum <[EMAIL PROTECTED]> wrote: Antoon Pardon <[EMAIL PROTECTED]> (AP) wrote: >>> >AP> Could you maybe clarify what problem we are discussing? All I wrote >AP> was that with an assignment the search for t

Re: I thought I'd 'got' globals but...

2006-07-07 Thread Luis M. González
Bruno Desthuilliers wrote: > > def doIt(name=None): > global gname > if name is None: > name = gname > else: > gname = name > Sorry for this very basic question, but I don't understand why I should add the global into the function body before using it. This function works even if I

Re: 2 problems

2006-07-07 Thread Mike Kent
[EMAIL PROTECTED] wrote: > Hello,Im using Python 2.4.2 and I'm starting a few very basic > programs,but theres two problems I've not found the answers for. > My first problem is I need code that will count the number of letters > in a string and return that number to a variable. >>> s = "hello" >

RE: IRC questions!! (off topic)

2006-07-07 Thread bruce
hi jon i can sortof connect however, to join "irc.freenode.net", it states i have to register... the docs that i've seen say i have to : /msg nickserv register if my nickname is tom, do i do /msg tom register(if foo is the passwd i want) -or- /msg tom register foo or is there s

Re: Parsing HTML--looking for info/comparison of HTMLParser vs. htmllib modules.

2006-07-07 Thread wes weston
from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.TokenList = [] def handle_data( self,data): data = data.strip() if data and len(data) > 0: self.TokenList.append(data)

2 problems

2006-07-07 Thread symonlandor
Hello,Im using Python 2.4.2 and I'm starting a few very basic programs,but theres two problems I've not found the answers for. My first problem is I need code that will count the number of letters in a string and return that number to a variable. My second problem stems from the first as I need a f

Re: Finding Return Code From GPG

2006-07-07 Thread Piet van Oostrum
> Nomen Nescio <[EMAIL PROTECTED]> (NN) wrote: >NN> Thanks, I used the popen function which did some of what I want. Here is >NN> the code I used: >NN> from subprocess import * >NN> output = Popen(["gpg", "--output", "--verify", "sigtest"], >stdout=PIPE).communicate()[0] You need a filenam

Re: split a line, respecting double quotes

2006-07-07 Thread vbgunz
> > Is there some easy way to split a line, keeping together double-quoted > > strings? > import re > rex = re.compile(r'(".*?"|\S)') > sub = 'a b c "d e"' > res = [x for x in re.split(rex, sub) if not x.isspace()][1:-1] > print res # -> ['a', 'b', 'c', '"d e"'] instead of slicing the result out,

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread thorley
Just thought I'd mention it. As stated in some posts I put on the list in the last few days, I'm working on a FastCGI server for python. Of course its not as fast as lighttpd, but I think it still has many applications. I've currently got a *very* simple prototype, but I expect the finished module

Re: split a line, respecting double quotes

2006-07-07 Thread Steven Bethard
Jim wrote: > Is there some easy way to split a line, keeping together double-quoted > strings? > > I'm thinking of > 'a b c "d e"' --> ['a','b','c','d e'] > . I'd also like > 'a b c "d \" e"' --> ['a','b','c','d " e'] > which omits any s.split('"')-based construct that I could come up with.

Re: split a line, respecting double quotes

2006-07-07 Thread faulkner
sorry, i didn't read all your post. def test(s): res = [''] in_dbl = False escaped = False for c in s: if in_dbl: if escaped: res[-1] += c if c != '\\': escaped = False else: res[-1]

Tkinter problem

2006-07-07 Thread Jim Anderson
I'm running Kubuntu a derivative of Debian Linux. I'm using Python 2.4 and tcl/tk 8.4. I'm running Tkinter programs and they were running about a month ago. When I tried them again yesterday, I got the following message: > python ~/prog/python/iodef/iodef.py > Traceback (most recent call last):

Re: split a line, respecting double quotes

2006-07-07 Thread vbgunz
Jim wrote: > Is there some easy way to split a line, keeping together double-quoted > strings? using the re module I find this to probably be the easiest but in no way is this gospel :) import re rex = re.compile(r'(".*?"|\S)') sub = 'a b c "d e"' res = [x for x in re.split(rex, sub) if not x.iss

inheritance, types, operator overload, head ache

2006-07-07 Thread thorley
I'm working with the following code. I included some tests to make it easy to see--if you run the code--what troubles I'm having. Can some one *please* splain me why str(obj) works but not print obj, and why obj.__int__() works, but not int(obj). I just don't get it. :( BTW: The reason I'm going

Re: split a line, respecting double quotes

2006-07-07 Thread faulkner
import re re.findall('\".*\"|\S+', raw_input()) Jim wrote: > Is there some easy way to split a line, keeping together double-quoted > strings? > > I'm thinking of > 'a b c "d e"' --> ['a','b','c','d e'] > . I'd also like > 'a b c "d \" e"' --> ['a','b','c','d " e'] > which omits any s.split

Re: Finding Return Code From GPG

2006-07-07 Thread Nomen Nescio
On Tue, 04 Jul 2006 19:00:23 +0200, Dennis Benzinger wrote: > Nomen Nescio wrote: >> I'm running gpg in python to verify a signature. I can see that it is >> working, because gpg is displaying the results. >> >> But I need a way to let the python script know this. According to the >> gpg manual t

Re: multithreading and shared dictionary

2006-07-07 Thread Istvan Albert
Stéphane Ninin wrote: > Is a lock required in such a case ? I believe that assignment is atomic and would not need a lock. yet most of the other dictionary use cases are not threadsafe. For example I suspect that you'd get an error if you were iterating through the dictionary while another threa

split a line, respecting double quotes

2006-07-07 Thread Jim
Is there some easy way to split a line, keeping together double-quoted strings? I'm thinking of 'a b c "d e"' --> ['a','b','c','d e'] . I'd also like 'a b c "d \" e"' --> ['a','b','c','d " e'] which omits any s.split('"')-based construct that I could come up with. Thank you, JIm -- http:

Re: template is calling 2 times

2006-07-07 Thread Bruno Desthuilliers
sanjeevdivekar a écrit : > hi, > > i am newbie to python so i am trying to learn mod_python as my new > development kit for my small web apps. > > i am getting strange result Nothing strange here AFAICT. > can anybody explain me. > index.py >

Re: how can I avoid abusing lists?

2006-07-07 Thread Simon Forman
Thomas Nelson wrote: > Thanks to everyone who posted. First, I don't think my question was > clear enough: Rob Cowie, Ant, Simon Forman, [EMAIL PROTECTED], and Jon > Ribbens offered solutions that don't quite work as-is, because I need > multiple values to map to a single type. Tim Chase and Brun

Re: how can I avoid abusing lists?

2006-07-07 Thread Rob Cowie
No, your question was clear. With hindsght and a more thorough read of your post I see my error ;^) -- http://mail.python.org/mailman/listinfo/python-list

Re: pyXLWriter - grid lines and if formula

2006-07-07 Thread John Machin
On 8/07/2006 3:43 AM, Luis P. Mendes wrote: > Hi, > > I know that pyExelerator is the supported project now, but I can't use > it because I'd need it to generate files from a web platform. Since I > can not save a file to a file-like object, I have to use pyXLWriter. > > The problems are: > 1- ho

[ANNOUNCE] Thirty-third release of PythonCAD now available

2006-07-07 Thread Art Haas
Hi. I'm pleased to announce the thirty-third development release of PythonCAD, a CAD package for open-source software users. As the name implies, PythonCAD is written entirely in Python. The goal of this project is to create a fully scriptable drafting program that will match and eventually exceed

Re: Nested scopes, and augmented assignment

2006-07-07 Thread Terry Reedy
"Antoon Pardon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > others might be helped if you took the trouble of explaining > what was wrong. Aside from F., I tried to explain what I think you said wrong. Did you read it? Did it help any? tjr -- http://mail.python.org/mai

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
You are right. Load test can be complicated because of the various patterns of web applications and usages. The simple tests I mentioned and conducted just give myself some idea about the performance. Given the same set up, some numbers should be comparable and reveal some aspects on web servers'

Re: how can I avoid abusing lists?

2006-07-07 Thread Thomas Nelson
Thanks to everyone who posted. First, I don't think my question was clear enough: Rob Cowie, Ant, Simon Forman, [EMAIL PROTECTED], and Jon Ribbens offered solutions that don't quite work as-is, because I need multiple values to map to a single type. Tim Chase and Bruno Destuilliers both offer ver

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Istvan Albert
> >> I will have to install lighttpd or other web servers. > If it is a Python web server, it would be nice to extend it by putting code > right into the web server. The performance should be better than FastCGI > because it removes the cost to send the requests/replies back and forth. you'll nee

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread fumanchu
Jack wrote: > I wrote the last posting at late late night and I didn't know what I was > typing at that time ;-p > > I didn't mean the test with CherryPy was not concurrent > connections, or the test with lighttpd was all concurrent > connections. I actually tried both concurrent (-c in ab command

RE: IRC questions!!

2006-07-07 Thread bruce
given that nothing appears to be connecting.. should i have anything in the "group" window/dialog of the server setting... -bruce -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jon Clements Sent: Friday, July 07, 2006 10:57 AM To: python-list@python.org S

Re: how can I avoid abusing lists?

2006-07-07 Thread Simon Forman
Tim Chase wrote: > > You'll notice that the OP's code had multiple references to the > same counter (0, 1, and 3 all mapped to type1) > > The OP's method was about as good as it gets. One might try to D'oh! Didn't notice that. Yeah, Thomas, if you really do want more than "type code" (i.e. k

Re: multinormal distribution

2006-07-07 Thread Robert Kern
TG wrote: > hi there. > > I'm struggling with a function of numpy. Here it is : > > import numpy as NP > mean = NP.array([0,0]) > cov = NP.array([[1,0.25],[0.25,1]]) > v = NP.random.multivariate_normal(mean,cov) > > Quite simple code : it is supposed to generate an array of two random > values t

Re: Idea/request for new python mailing list/newsgroup.

2006-07-07 Thread Simon Forman
Kenneth McDonald wrote: > Would a mailing list and newsgroup for "python contributions" be of > interest? I currently have a module which is built on top of, and is ... > I'd very much likes a ML/newsgroup wherein potential python contributors > could > > * Post alphas/betas and seek feedback. > *

Re: how can I avoid abusing lists?

2006-07-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Thomas Nelson wrote: > This is exactly what I want to do: every time I encounter this kind of > value in my code, increment the appropriate type by one. Then I'd like > to go back and find out how many of each type there were. This way > I've written seems simple e

Re: import

2006-07-07 Thread David Jackson
Indeed you are correct...that is indeed TWO underscores and everything works fine now. Thanks for pointing out the obvious...I thought it was a simple problem. --DJ "faulkner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > that should be __init__.py [TWO underscores]. > and you

Idea/request for new python mailing list/newsgroup.

2006-07-07 Thread Kenneth McDonald
Would a mailing list and newsgroup for "python contributions" be of interest? I currently have a module which is built on top of, and is intended to semantically replace, the 're' module. I use it constantly to great advantage, but have not made it public for the following reasons: * The API sh

Parsing HTML--looking for info/comparison of HTMLParser vs. htmllib modules.

2006-07-07 Thread Kenneth McDonald
I'm writing a program that will parse HTML and (mostly) convert it to MediaWiki format. The two Python modules I'm aware of to do this are HTMLParser and htmllib. However, I'm currently experiencing either real or conceptual difficulty with both, and was wondering if I could get some advice. T

Re: Amara: Where's my attribute?

2006-07-07 Thread uche . ogbuji
AdSR wrote: > [EMAIL PROTECTED] wrote: > > What is the actual problem you're trying to solve? If you just want to > > force a namespace declaration in output (this is sually to support > > QNames in content) the most well-known XML hack is to create a dummy > > attribute with the needed prefix and

Re: pyXLWriter - grid lines and if formula

2006-07-07 Thread Gregory Piñero
On 7/7/06, Luis P. Mendes <[EMAIL PROTECTED]> wrote: > Hi, > > I know that pyExelerator is the supported project now, but I can't use > it because I'd need it to generate files from a web platform. Since I > can not save a file to a file-like object, I have to use pyXLWriter. I don't really know w

Re: Error type for shelve.open()

2006-07-07 Thread aomighty
Yes, the problem was that I hadn't imported anydbm.error... it's working now. As for the AttributeError at the end, I talked to someone else, and he looked at the source and said it was a bug in shelve. I think I will report it to python.org. Anyway, thanks :). Simon Forman wrote: > [EMAIL PROTEC

Re: IRC questions!!

2006-07-07 Thread Jon Clements
bruce wrote: > hi... > > i'm trying to figure out what i have to do to setup mIRC to get the #python > channel on IRC!! > > any pointers. the mIRC docs didn't get me very far. > > is there an irc.freenode.net that i need to connect to? how do i do it? > > thanks.. > > -bruce Assuming you're famil

template is calling 2 times

2006-07-07 Thread sanjeevdivekar
hi, i am newbie to python so i am trying to learn mod_python as my new development kit for my small web apps. i am getting strange result can anybody explain me. * index.py

Re: how can I avoid abusing lists?

2006-07-07 Thread Peter Otten
Thomas Nelson wrote: > I have this code: > type1 = [0] > type2 = [0] > type3 = [0] > map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} # the real map is > longer than this > > def increment(value): > map[value][0] += 1 > > increment(1) > increment(1) > increment(0) > increment(4) > #increment

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Fredrik Lundh
Steven D'Aprano wrote: > Personally, I would never use eval on any string I didn't write myself. If > I was thinking about evaluating a user-string, I would always write a > function to parse the string and accept only the specific sort of data I > expected. In your case, a quick-and-dirty unteste

Re: How can I avoid abusing lists?

2006-07-07 Thread Klaus Alexander Seistrup
[EMAIL PROTECTED] wrote: > if histogram.has_key(s): > histogram[s] += 1 > else: > histogram[s] = 1 I wonder if histogram[s] = histogram.get(s, 0) + 1 would be more efficient... Cheers, -- Klaus Alexander Seistrup

IRC questions!!

2006-07-07 Thread bruce
hi... i'm trying to figure out what i have to do to setup mIRC to get the #python channel on IRC!! any pointers. the mIRC docs didn't get me very far. is there an irc.freenode.net that i need to connect to? how do i do it? thanks.. -bruce -- http://mail.python.org/mailman/listinfo/python-lis

pyXLWriter - grid lines and if formula

2006-07-07 Thread Luis P. Mendes
Hi, I know that pyExelerator is the supported project now, but I can't use it because I'd need it to generate files from a web platform. Since I can not save a file to a file-like object, I have to use pyXLWriter. The problems are: 1- how to turn off/on the grid lines of each sheet? 2- I tried to

Re: how can I avoid abusing lists?

2006-07-07 Thread [EMAIL PROTECTED]
Thomas Nelson wrote: > I have this code: > type1 = [0] > type2 = [0] > type3 = [0] > map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} # the real map is > longer than this > > def increment(value): > map[value][0] += 1 > > increment(1) > increment(1) > increment(0) > increment(4) > #incre

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Fredrik Lundh
Ant wrote: > It seems that there must be a way to use eval safely, as there are > plenty of apps that embed python as a scripting language - and what's > the point of an eval function if impossible to use safely, and you have > to write your own Python parser!! embedding python != accepting scrip

Re: how can I avoid abusing lists?

2006-07-07 Thread Bruno Desthuilliers
Thomas Nelson wrote: > I have this code: > type1 = [0] > type2 = [0] > type3 = [0] > map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} Warning : you're shadowing the builtin map() function. > # the real map is > longer than this > > def increment(value): > map[value][0] += 1 > > incre

Re: how can I avoid abusing lists?

2006-07-07 Thread Justin Azoff
Thomas Nelson wrote: > This is exactly what I want to do: every time I encounter this kind of > value in my code, increment the appropriate type by one. Then I'd like > to go back and find out how many of each type there were. This way > I've written seems simple enough and effective, but it's ve

Re: how can I avoid abusing lists?

2006-07-07 Thread Tim Chase
> Just forget the lists... > > counters = {0:0, 1:0, 2:0, 3:0, 4:0} You'll notice that the OP's code had multiple references to the same counter (0, 1, and 3 all mapped to type1) The OP's method was about as good as it gets. One might try to redo it with an accumulator class of some sort: cl

Re: Publishing ODBC database content as PDF

2006-07-07 Thread vasudevram
Oops: The source indentation - tabs - is removed in the blog post, by the LiveJournal software. You will need to insert them at the appropriate places, for which you will need to know Python and understand the code, at least the overall logic. I'll post the code as a zip file (with some other sampl

Re: how can I avoid abusing lists?

2006-07-07 Thread Simon Forman
Thomas Nelson wrote: > I have this code: > type1 = [0] > type2 = [0] > type3 = [0] > map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} # the real map is > longer than this > > def increment(value): > map[value][0] += 1 > > increment(1) > increment(1) > increment(0) > increment(4) > #increm

Re: Python SOAP and XML-RPC performance extremely low?

2006-07-07 Thread skip
>> As someone else noted though, a five-second delay for such a small >> example doesn't seem to be an XML-RPC problem. A simple round-trip >> to my XML-RPC server running on the localhost takes about 5 >> *milli*seconds. Fredrik> even if the service you're connecting is wait

Publishing ODBC database content as PDF

2006-07-07 Thread vasudevram
Publishing ODBC database content as PDF: A blog post by me on how to do this, using my PDF conversion toolkit, xtopdf. This is sample code from my next upcoming release of xtopdf, which will support more input formats, such as CSV, XLS, TDV and ODBC data. http://jugad.livejournal.com/2006/07/07/

Re: how can I avoid abusing lists?

2006-07-07 Thread Ant
Rob Cowie wrote: > Just forget the lists... > counters = {0:0, 1:0, 2:0, 3:0, 4:0} Or perhaps just use a list: >>> counters = [0,0,0,0] >>> def inc(v): ... counters[v] += 1 ... >>> inc(1) >>> inc(1) >>> inc(3) >>> counters [0, 2, 0, 1] > The increment function should probably include a try:..

Re: Looking for a high performance web server written in Python, and supports CGI/FastCGI

2006-07-07 Thread Jack
I wrote the last posting at late late night and I didn't know what I was typing at that time ;-p I didn't mean the test with CherryPy was not concurrent connections, or the test with lighttpd was all concurrent connections. I actually tried both concurrent (-c in ab command line) and non-concurren

Re: eval to dict problems NEWB going crazy !

2006-07-07 Thread Ant
> [('recId', 3), ('parse', {'pos': u'np', 'gen': u'm'})] > [('recId', 5), ('parse', {'pos': u'np', 'gen': u'm'})] > # line injected by a malicious user > "__import__('os').system('echo if I were bad I could do worse')" > [('recId', 7 ), ('parse', {'pos': u'np', 'gen': u'm'})] I'm curious, if you

Re: how can I avoid abusing lists?

2006-07-07 Thread Rob Cowie
Just forget the lists... counters = {0:0, 1:0, 2:0, 3:0, 4:0} def increment(value): counters[value] += 1 increment(1) increment(1) increment(3) increment(4) print counters[0] >>> 0 print counters[1] >>> 2 print coutners[2] >>> 0 print counters[3] >>> 1 print coutners[4] >>> 1 The increment

how can I avoid abusing lists?

2006-07-07 Thread Thomas Nelson
I have this code: type1 = [0] type2 = [0] type3 = [0] map = {0:type1, 1:type1, 2:type3, 3:type1, 4:type2} # the real map is longer than this def increment(value): map[value][0] += 1 increment(1) increment(1) increment(0) increment(4) #increment will actually be called many times through

Re: Error type for shelve.open()

2006-07-07 Thread Simon Forman
[EMAIL PROTECTED] wrote: > I tried what you said and it looked like maybe AttributeError, but that > didn't work either. > > This code snippet: > > import shelve > from traceback import format_exc > > try: >db = shelve.open("meh", "r") > except: >print format_exc() > > Gave me this output:

Re: Python SOAP and XML-RPC performance extremely low?

2006-07-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > As someone else noted though, a five-second delay for such a small example > doesn't seem to be an XML-RPC problem. A simple round-trip to my XML-RPC > server running on the localhost takes about 5 *milli*seconds. even if the service you're connecting is waiting 5 seco

Re: what's wrong here? (search script)

2006-07-07 Thread Michael Fisher
Brendan Fay wrote: > I figured it out. Is there any way to delete your own posts? > > Brendan Fay wrote: >> Dear Someone: >> >> I have written a script that accesses the googleAPI through >> pygoogle and saves each of the ten documents as a .txt file by using a >> specific function for each

Re: Python SOAP and XML-RPC performance extremely low?

2006-07-07 Thread skip
Jack> No, I'm not using any accelerator. The code is extremely simple Jack> (from toofpy): ... To use sgmlop, just download and install it. Your code doesn't need to change. The xmlrpclib module detects its presence and uses it automatically. As someone else noted though, a five-se

Re: Launching multiple instances of a program with win32com.client.Dispatch?

2006-07-07 Thread tyler . schlosser
Hi Roger, Thanks for the response, but DispatchEx seems to do the exact same thing as Dispatch in my case; there is still only one processID and one instance of my program (I forgot to mention that I also need two unique processID's to keep track of them). I have also tried: ### AB1 = pythoncom

Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Rob Knapp
On Thu, 2006-07-06 at 14:24 -0400, Gregory Piñero wrote: > Hi guys, > > I was just idley curious on what it would take to make a web plug-in > for Pygame. I'm picturing it working the way my browser currently > shows flash games. Is such an idea even possible? Has anyone > attempted this? > A

Re: Web Browser Pygame Plug-in?

2006-07-07 Thread Gregory Piñero
Shane Wrote: > Ah, so you also want to distribute untrusted Python code. That's fairly > hard. There's a discussion about it on Python-Dev right now. Well, I want to write a game in Pygame, and people can just go to my website and play it within their browser. I guess that would be untrusted co

  1   2   >