Re: urllib (in thread) never returns

2006-07-17 Thread Rene Pijlman
Kingsley: >it just sits in either the urlopen() or read() forever. [...] >I would have thought that some urllib-internal timeout >would fix this?! Yes, but you'll need to enable it. See socket.setdefaulttimeout() : http://docs.python.org/lib/module-socket.html -- René Pijlman -- http://mail.py

Re: yet another noob question

2006-08-13 Thread Rene Pijlman
mike_wilson1333: >I would like to generate every unique combination of numbers 1-5 in >a 5 digit number [...] What would be the best way to do this? Ask the Java newsgroup to design a clever algorithm and post it here for pythonification. Ask for the pseudocode, not the Java code. -- René Pijlm

Re: yet another noob question

2006-08-13 Thread Rene Pijlman
Stargaming: >Generally, it is range(1, 5) Minus all numbers whose decimal string representation matches [0-9]*[06-9][0-9]* Briljant! -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

HTMLParser chokes on bad end tag in comment

2006-05-28 Thread Rene Pijlman
The code below results in an exception (Python 2.4.2): HTMLParser.HTMLParseError: bad end tag: "", at line 4, column 6 Should it? The end tag it chokes on is in comment, isn't it? import HTMLParser HTMLParser.HTMLParser().feed(""" """) -- René Pijlman -- htt

Re: why not in python 2.4.3

2006-05-28 Thread Rene Pijlman
Rocco: >but does not work with 2.4.3. Define "does not work". -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: HTMLParser chokes on bad end tag in comment

2006-05-29 Thread Rene Pijlman
Fredrik Lundh: >Rene Pijlman: >[end tag in html comment in script element] >The end tag it chokes on is in comment, isn't it? > >no. STYLE and SCRIPT elements contain character data, not parsed >character data, so comments are treated as characters, and the first >&qu

Re: HTMLParser chokes on bad end tag in comment

2006-05-29 Thread Rene Pijlman
Miki: >You can also check out BeautifulSoup >(http://www.crummy.com/software/BeautifulSoup/) which is less strict >than the regular HTML parser. Yes, thanks. Ik this case it was my sitechecker which checks for syntax and broken links, so it was supposed to find the syntax error. BeautifulSoup is n

Re: what is the reasonable (best?) Exception handling strategy?

2006-06-01 Thread Rene Pijlman
Petr Jakes: >What about unexpected exceptions? :( I asked a similar question some time ago: http://groups.google.nl/group/comp.lang.python/browse_thread/thread/25963b99da4b2653 -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope / Plone Groups

2006-06-01 Thread Rene Pijlman
[EMAIL PROTECTED]: >are there any specific groups for zope / plone regarding questions? Try plone-users: http://plone.org/support -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner code problem

2006-06-02 Thread Rene Pijlman
RJ: >import random >flip = random.randrange(2) >heads = 0 >tails = 0 >count = 0 >while count < 100: > if flip == 0: > heads += 1 > else: > tails += 1 > count += 1 Since flip isn't changed in the loop, this is going to report 100 heads or 100 tails, dep

Re: Python to C converter

2006-06-05 Thread Rene Pijlman
[EMAIL PROTECTED]: >I have an application return in python. I want this to be >converted to C. http://www.python.org/doc/faq/general/#can-python-be-compiled-to-machine-code-c-or-some-other-language -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing to a certain line?

2006-06-06 Thread Rene Pijlman
Tommy B: >I was wondering if there was a way to take a txt file and, while >keeping most of it, replace only one line. You'd need to read the file and parse it, to find the start position of the line you want to change. Then seek output to that position and write and flush the changes. You must k

Re: Writing to a certain line?

2006-06-06 Thread Rene Pijlman
bruno at modulix: >You can't do this in place with a text file (would be possible with a >fixed-length binary format). More precise: it's possible with any fixed-length change, in both binary and text files, with both fixed and variable formats. -- René Pijlman -- http://mail.python.org/mailman

Re: 10GB XML Blows out Memory, Suggestions?

2006-06-06 Thread Rene Pijlman
[EMAIL PROTECTED]: >I wrote a program that takes an XML file into memory using Minidom. I >found out that the XML document is 10gb. > >I clearly need SAX or something else? > >Any suggestions on what that something else is? PullDOM. http://www-128.ibm.com/developerworks/xml/library/x-tipulldom.ht

Re: CENSORSHIP - Django Project (Schema Evolution Support)

2006-06-07 Thread Rene Pijlman
Ilias Lazaridis: >What is the credibility and value of the provided "wikipedia" entry? Wikipedia always tells the Absolute Truth, because if it doesn't, we can edit it and fix it right away. -- http://mail.python.org/mailman/listinfo/python-list

Re: An error ?

2006-06-11 Thread Rene Pijlman
Bo Yang: >[Fri Jun 16 14:06:45 2006] [error] [client 10.10.110.17] malformed >header from script. Bad header=Hello World!: a.py "The output of a CGI script should consist of two sections, separated by a blank line. The first section contains a number of headers, telling the client what kind of dat

Re: Using PHP in Python

2006-06-12 Thread Rene Pijlman
Tgone: >I have some custom PHP functions that I didn't want to re-write in >Python. But maybe I should just rewrite them :) Absolutely. The alternative is one of many IPC mechanisms that are available in both Python and PHP (such as XML-RPC). But that may require more effort than rewriting the f

Re: Program slowing down with greater memory use

2006-06-23 Thread Rene Pijlman
Dan Stromberg: >What's the deal here? The sketchy information in your post doesn't rule out any possibility. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: classes and interfaces

2006-07-02 Thread Rene Pijlman
[EMAIL PROTECTED]: >In python , how to implement interface like the above? Interfaces are lacking in Python, but an even more generic proposal is on its way: http://www.artima.com/weblogs/viewpost.jsp?thread=155123 In the mean time, interfaces have already been implemented in Zope 3: http://www.

Re: classes and interfaces

2006-07-02 Thread Rene Pijlman
Bruno Desthuilliers: >Java interfaces are a workaround Troll alert. -- http://mail.python.org/mailman/listinfo/python-list

ZODB and Zope on one Linux machine, how?

2006-01-24 Thread Rene Pijlman
I have a productional Linux web server with a Python/Zope/Plone. Now I'd like to install a non-Zope Python/ZODB application on the same server. What is the recommended way of doing that? Option 1: Install ZODB in the Python installation in the usual way. Should I expect problems when I install and

Re: append to the end of a dictionary

2006-01-24 Thread Rene Pijlman
Yves Glodt: >I seem to be unable to find a way to appends more keys/values to the end >of a dictionary A dictionary has no order, and therefore no end. >mydict = {'a':'1'} > >I need to append 'b':'2' to it to have: > >mydict = {'a':'1','b':'2'} > >How to do? Like this: >>> mydict = {'a':'1'} >

Re: append to the end of a dictionary

2006-01-24 Thread Rene Pijlman
Yves Glodt: >I would need e.g. this: >(a list of ports and protocols, to be treated later in a loop) [...] >What would be the appropriate pythonic way of doing this? In the case of tcp and udp ports, it's the combination of protocol and port number that's unique, not the port number by itself. So

Trying to understand logging.Filter

2006-01-25 Thread Rene Pijlman
I'd expect the program below to put only one line with "Eat me" in the log file. However, I get this with Python 2.4.2 in WingIDE on Windows XP: Eat me Ignore me My understanding is: 1. Event "Ignore me" is logged to logger 'spam'. 2. Logger 'spam' has no handler associated with it, so this l

Re: ZODB and Zope on one Linux machine, how?

2006-01-25 Thread Rene Pijlman
Rene Pijlman: >Option 3: >Use separate Python installations for Zope and the application. Install >ZODB in the application's Python installation, not in Zope's. For the record, on zodb-dev I got this advice: "This is the only sane option". -- René Pijlm

Re: Trying to understand logging.Filter

2006-01-25 Thread Rene Pijlman
Rene Pijlman: >3. The event is dispatched to the root logger as well, Got it. The event is not dispatched to ancestor loggers, but to the handlers associated with ancestor loggers (Doc: "In addition to any handlers directly associated with a logger, all handlers associated with all ance

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

2006-01-25 Thread Rene Pijlman
Tim Chase: >When you have a set, known to be of length one, is there a "best" >("most pythonic") way to retrieve that one item? e = s.copy().pop() #:-) -- René Pijlman Wat wil jij worden? http://www.carrieretijger.nl -- http://mail.python.org/mailman/listinfo/python-list

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

2006-01-25 Thread Rene Pijlman
Peter Otten: s = set(["one-and-only"]) item, = s item >'one-and-only' > >This works for any iterable and guarantees that it contains exactly one >item. Nice! >The comma may easily be missed, though. You could write: (item,) = s But I'm not sure if this introduces additional

Re: ZODB and Zope on one Linux machine, how?

2006-01-26 Thread Rene Pijlman
Terry Hancock: >Rene Pijlman: >> Option 1: >> Install ZODB in the Python installation in the usual way. >> Should I expect problems when I install and run zope with >> that Python installation? > >I think this should work, actually. > >ZODB is just like o

Re: Question about isinstance()

2006-01-26 Thread Rene Pijlman
Mr.Rech: >Now, avoiding isinstace() I've written the following code: > >class foo(object): > ... > def __eq__(self, other): > try: > return self.an_attribute == other.an_attribute > except AttributeError: > return False This may give unexpected results when you compar

Re: Question about isinstance()

2006-01-27 Thread Rene Pijlman
Steven D'Aprano: >Rene Pijlman: >> Mr.Rech: >>> def __eq__(self, other): >>> try: >>> return self.an_attribute == other.an_attribute >>> except AttributeError: >>> return False >> >> This may

Re: Large XML Document Processing

2006-01-27 Thread Rene Pijlman
Albert Leibbrandt: >Just want to check which xml parser you guys have found to be the >quickest. I have xml documents with 250 000 records or more and the >processing of these documents are taking way to long. What type of parser are you using? Dom, minidom or sax? Sax is fastest, but somewhat m

Re: Question about isinstance()

2006-01-27 Thread Rene Pijlman
Magnus Lycka: >isinstance() wouldn't be in Python if you weren't supposed to use it, If this argument was correct, 'goto' wouldn't be in Pascal :-) -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: "Python Drive Name" is the search, what is the question?

2006-01-27 Thread Rene Pijlman
Gregory Piñero: >Just thought I'd see if you guys had an answer for this. My website >analytics page shows that people come to my site after searching for >"Python drive name" but I don't think I'm offering any help with such >a thing. > >However I would like to help since I'm getting a few people

Re: Printing HTML

2006-01-27 Thread Rene Pijlman
Max <[EMAIL PROTECTED]>: >How can I print (as in laser printer, not the python print statement) >HTML from Python Is the printer attached to your server, or are you printing over the internet? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about isinstance()

2006-01-27 Thread Rene Pijlman
Marc 'BlackJack' Rintsch: >Rene Pijlman: >> Well no, when comparing against things you didn't think of the __eq__ >> shouldn't return a false False, it should return NotImplemented. After >> all, the things you didn't think of are not (yet) implemented

Re: test whether 2 objects are equal

2006-01-31 Thread Rene Pijlman
Yves Glodt: >I need to compare 2 instances of objects to see whether they are equal >or not, This prints "equal": class Test(object): def __init__(self): self.var1 = '' self.var2 = '' def __eq__(self,other): return self.var1 == other.var1 and self.var2 == other.v

Re: redirect and python

2006-02-02 Thread Rene Pijlman
questions?: >os.system("wget http://blah blah blah") Why don't you use urllib(2) directly in Python? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Compiling

2006-02-03 Thread Rene Pijlman
Simon Faulkner: >why hasn't someone written a compiler for Python? http://www.python.org/doc/faq/general.html#can-python-be-compiled-to-machine-code-c-or-some-other-language -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract contents of html cells

2006-02-04 Thread Rene Pijlman
Robot: >I need to create a script which will extract the contents of 2 cells of >an html that contains a specified number of cells.Then I need to put >that contents in another cells of my own html page.How can i do that? http://www.python.org/doc/lib/module-htmllib.html -- René Pijlman -- http:

Re: Get System Date?

2006-02-05 Thread Rene Pijlman
Dustan: >Is it possible to get the system date on a Windows XP machine? Most certainly: http://www.python.org/doc/lib/module-time.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior with os call in cgi script

2006-02-05 Thread Rene Pijlman
sophie_newbie: >OK, interesting, but just how dow I print he environment in the >program?? Add logging to your program: http://www.python.org/doc/2.3.5/lib/module-logging.html And log the environment: http://www.python.org/dev/doc/newstyle/lib/os-procinfo.html -- René Pijlman -- http://mail.py

Re: Strange behavior with os call in cgi script

2006-02-06 Thread Rene Pijlman
Steve Holden: >Rene Pijlman: >> Add logging to your program: >> http://www.python.org/doc/2.3.5/lib/module-logging.html >> >Probably oiverkill, particularly for a beginner (is it only me that >thinks the logging module is either way over-complicated or way >under-

Re: read file problem

2006-02-06 Thread Rene Pijlman
Ernesto: >fileHandle = open(filePath, 'r').read(); Remove this: open() returns the filehandle, open().read() returns the data read from the filehandle. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: * 'struct-like' list *

2006-02-06 Thread Rene Pijlman
Ernesto: >1. How to search for the keywords "Name:", "Age:", etc. in the file... You could use regular expression matching: http://www.python.org/doc/lib/module-re.html Or plain string searches: http://www.python.org/dev/doc/devel/lib/string-methods.html >2. How to implement some organized "li

Re: threads and memory

2006-02-06 Thread Rene Pijlman
Lee Leahu: >I am trying to write a simple threaded application which will simulate 1000 >connections to a remote service in order to "stress test" that the remote >service can handle that many connections. [...] >Is there a way to accomplish what I am trying to do, perhaps in a more >memory-frie

Re: Strange behavior with os call in cgi script

2006-02-08 Thread Rene Pijlman
Vinay Sajip: >Rene Pijlman: >> It struck me as somewhat complicated as well. >You should look at later versions of Python - your points above about >easier configuration have already been addressed: here's a link from >the current (2.4) docs: > >http://docs.python

Re: by reference

2006-02-09 Thread Rene Pijlman
dirvine: >I would like to create a dictionary based on a variable [...] And what seems to be the problem? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: CGI Python FTP

2006-02-09 Thread Rene Pijlman
[EMAIL PROTECTED]: >I know PHP has support for uploading files from the browser to the >server, but does python (not mod_py) have any modules for going about >this? http://www.python.org/doc/2.3.2/lib/node403.html http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/273844 -- René Pijlman --

Re: CLI

2006-02-09 Thread Rene Pijlman
mwt: >I want to do programmatic terminal commands on unix with python - i.e. >I want my program to issue commands to start and stop scripts, other >programs, etc. I'm sure this must be fairly straightforward, but >haven't been able to find a reference for it. Any help? http://www.python.org/doc/2.

Re: Threads and Interpreter death

2006-02-09 Thread Rene Pijlman
Carl J. Van Arsdall: >I've been toying with threads a lot lately and I've noticed that if a >scripting error occurs in a thread the thread dies, but not the process >that spawned the thread. > >Is python supposed to behave this way or is this type of behavior >accidental? "start_new_thread(func

Re: pythonic exec* spawn*

2006-02-09 Thread Rene Pijlman
Daniel Nogradi: >I would like to pass the whole object at once to the second python >program which should start doing its thing with it while the original >program should keep running. os.fork() does that (on Mac and Unix). -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonic exec* spawn*

2006-02-09 Thread Rene Pijlman
Daniel Nogradi: >> os.fork() does that (on Mac and Unix). > >Okay, but how? Sorry, fork() is implemented strictly on a 'need to know' basis :-) >It seems to me that if the process which issued os.fork() ends, then >the forked process also ends. No, no, they're not a quantum mechanic photon pair

Re: installing python on a server?

2006-02-10 Thread Rene Pijlman
John Salerno: >Can anyone tell me how complicated it might be to install Python on my >server so I can use it for web apps? 2 on a scale from 1 to 10. >Is it a one-time process, or something to maintain? Both :-) I installed Python 2.2 - 2.4 from source on Linux with no problem whatsoever. I n

Re: installing python on a server?

2006-02-10 Thread Rene Pijlman
John Salerno: >Hmm, sounds easy, yet I don't know where to start. try: browser.browse(http://www.python.org/download/) package = download(yourPlatform) package.unpack() exec(README.read()) except: post specifics -- René Pijlman -- http://mail.python.org/mailman/listinfo/pyt

Re: Tracking down memory leaks?

2006-02-12 Thread Rene Pijlman
malv: >Is there any way for making Python return memory no longer needed to >the OS? Cases may arise where you indeed need a big memory block >temporarily without being able to split it up into smaller chunks. That's not really necessary. On any decent OS it's just unused address space, that doesn

Re: Writing a Web Robot in Python

2006-02-13 Thread Rene Pijlman
[EMAIL PROTECTED]: >Anybody know some good places to go to get information on >building a web robots? Some pointers: http://safari.oreilly.com/0596005776 http://www.python.org/doc/2.4.2/lib/module-HTMLParser.html http://www.crummy.com/software/BeautifulSoup/ http://www.python.org/doc/2.4.2/lib/mod

Re: hard disk activity

2006-02-13 Thread Rene Pijlman
VSmirk: >I have a task that involves knowing when a file has changed. But while >for small files this is an easy enough task, checking the modification >dates, Checking the modification time works the same way for large files. Why is that not good enough? What's your platform? -- René Pijlman

Re: Location of Python modules

2006-02-13 Thread Rene Pijlman
Byte: >where are Python modules stored in Linux? Where are eggs laid on the western hemisphere? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: is socket thread safe?

2006-02-14 Thread Rene Pijlman
[EMAIL PROTECTED]: >[code] I certainly expect socket to be threadsafe. I use it (via urllib2/httplib) in a multithreaded program, that runs fine with Python 2.3 and 2.4 on both Windows XP and Linux. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding a binary file in a python script

2006-02-15 Thread Rene Pijlman
mrstephengross: >I want to find a way to embed a tar file *in* my python script, and >then use the tarfile module to extract it. That is, instead of >distributing two files (extractor.py and archive.tar) I want to be able >to distribute *one* file (extractor-with-embedded-archive.py). Is there >a w

Re: Embedding a binary file in a python script

2006-02-15 Thread Rene Pijlman
mrstephengross: >Ok, this looks really cool, but can you explain a little more >step-by-step what's going on? What happened to "Hey thanks, I'll look into that" :-( -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Databases and python

2006-02-16 Thread Rene Pijlman
Dan Stromberg: >is there a python database interface that would allow me to define a >-lot- of tables? Like, each word becomes a table, and then the fields >in that table are just the filenames that contained that word. Give ZODB a try. http://www.zope.org/Wikis/ZODB/FrontPage http://www.pytho

Re: embedding python in HTML

2006-02-16 Thread Rene Pijlman
John Salerno: [Python alternative for PHP] >So to do this with Python, do I simply integrate it into the HTML as >above, with no extra steps? You'd need something like the PHP engine, that understands Python rather than PHP. I've used Cheetah: http://www.cheetahtemplate.org/ Our BDFL seems to

Re: define loop statement?

2006-02-17 Thread Rene Pijlman
David Isaac: >I would like to be able to define a loop statement >(nevermind why) so that I can write something like > >loop 10: >do_something > >instead of > >for i in range(10): >do_something > >Possible? If so, how? Yes. By implementing a compiler or an interpreter for your programming

Re: Databases and python

2006-02-17 Thread Rene Pijlman
Dan Stromberg: >> My first attempt would be: a BTree with the word as key, and a 'list of >> filenames' as value. >> http://www.zope.org/Wikis/ZODB/FrontPage/guide/node6.html#SECTION00063 > >This is basically what I'm doing now, Right. My second attempt would be: a BTree with the

Re: Databases and python

2006-02-17 Thread Rene Pijlman
Dan Stromberg: >Rene Pijlman: >> Right. My second attempt would be: a BTree with the word as key, and a >> BTree of filenames as value >Would ZODB let me do that? Yes. >I'm puzzled, because: >>>> d1={} >>>> d={} >>>> d[d1] = '

Re: Does Plone support distinct sets of users in subgroups?

2006-02-18 Thread Rene Pijlman
wheel: >I'm not sure if this is the right venue for Plone questions, if not, >could someone ref me to a better one? The plone-users mailing list. Highly recommended. >The discussion groups on the plone site are mailing lists and I'd >rather not subscribe quite yet. Why not? It's free, takes 1

Re: How many web framework for python ?

2006-02-18 Thread Rene Pijlman
Bo Yang: >There are very good web framework for java and ruby , >Is there one for python ? Yes. http://wiki.python.org/moin/WebProgramming >I want to write a web framework for python based on >mod_python as my course homework , could you give some >advise ? Write Zope3. -- René Pijlman -- htt

Re: editor for Python on Linux

2006-02-19 Thread Rene Pijlman
Mladen Adamovic: >I wonder which editor or IDE you can recommend me for writing Python >programs. vi -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: editor for Python on Linux

2006-02-19 Thread Rene Pijlman
F. Petitjean: >Rene Pijlman: >> vi > >I beg to disagree :-) Use ed >"Ed is the standard text editor." >http://www.gnu.org/fun/jokes/ed.msg.html That was 1991. This is 2006. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: editor for Python on Linux

2006-02-19 Thread Rene Pijlman
Sriram Krishnan: >Check out http://wiki.python.org/moin/PythonEditors. This page can't be taken seriously. vi is not listed. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple email recipients

2006-02-20 Thread Rene Pijlman
[EMAIL PROTECTED]: >was wondering how to modify the code so as i can send to multiple email >recipients using "TO"? thanks. You add RFC 2822 headers. http://www.ietf.org/rfc/rfc2822.txt ("3.6.3. Destination address fields") -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: why does close() fail miserably on popen with exit code -1 ?!

2006-02-20 Thread Rene Pijlman
Atanas Banov: >i ran onto this weirdness today: seems like close() on popen-ed >(pseudo)file fails miserably with exception instead of returning exit >code, when said exit code is -1. Not here. Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] Type "help", "copyright", "credit

Re: Regular expression gone mad

2006-02-20 Thread Rene Pijlman
fileexit: >(Search finds nothing) > a=r"MemT" pat = re.compile(a) m=pat.search(ProcMem, re.DOTALL) m >From the docs: "Compiled regular expression objects support the following methods and attributes: match( string[, pos[, endpos]])" Your re.DOTALL is seen as start position.

Re: In need of a virtual filesystem / archive

2006-02-21 Thread Rene Pijlman
Enigma Curry: >I need to store a large number of files in an archive. From Python, I >need to be able to create an archive, put files into it, modify files >that are already in it, and delete files already in it. Use the file system. That's what it's for. -- René Pijlman -- http://mail.python.o

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Rene Pijlman
Michele Simionato: >I usually do not recommend Zope, unless you want to make a career as a >Zope consultant. You have a point there. >If you have to interact with a relational database, your life with Zope >may be hard: And if you have to interact with flat files, your life with an RDBMS may

Re: Zope/Plone - Is it the right solution?

2006-02-21 Thread Rene Pijlman
kbperry: >1) Is Zope/Plone overkill for this type of project? No, Plone is an excellent CMS for your purpose. >2) Why use Plone vs. straight up Zope? Plone is an out-of-the-box CMS for non-technical editors, Zope is the underlying infrastructure for developers. >3) Is there a way to get over

Re: cookielib

2006-02-22 Thread Rene Pijlman
sri2097: >urllib2 does not support cookies. It does in 2.4. This code enables cookie support in all consequent calls through urrlib2: import cookielib, urllib2 opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) urllib2.install_opener(opener) -- René Pijlman -- http://mai

Re: Exception-handling

2006-02-24 Thread Rene Pijlman
Odd-R.: >I thought Exception would catch all exceptions. Try this: import sys try: pass # your code here except: e = sys.exc_value() Either to catch everything, or to get a hold on e. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: A C-like if statement

2006-02-24 Thread Rene Pijlman
Roy Smith: >How do you do any I/O in a functional language if side effects are >verboten? The user is a function. Output is its parameter, input its return value. The user is not allowed to maintain state ;-) >For that matter, how does a functional program ever stop running? By returning to t

Re: [ANN] httpy 0.9.0 -- a sane and robust HTTP library for Python

2006-02-24 Thread Rene Pijlman
Chad Whitacre: >I am pleased to announce the first public release of httpy -- a sane and >robust HTTP library for Python. With httpy, you write "responders," and >put them on the network with "couplers." Here is a trivial responder: > > import httpy > > class Responder: > def respond(requ

Re: ImportError in Unpickle

2006-02-26 Thread Rene Pijlman
[EMAIL PROTECTED]: >I have a python script that pickles and unpickles a give object. It >works without any problems on windows (the data was pickled on windows >first). But when I try to run the script on Linux, I get the following >error: [...] >ImportError: No module named __main__ There are som

Re: ImportError in Unpickle

2006-02-26 Thread Rene Pijlman
Rene Pijlman: >[EMAIL PROTECTED]: >>ImportError: No module named __main__ > >There are some posts in the Usenet archive Also: http://mail.python.org/pipermail/python-list/1999-April/000916.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading - will threads run in parallel?

2006-02-28 Thread Rene Pijlman
SolaFide: >(get() is a function which waits for a ping on a specific port, thus >stopping the program for a while.) > >Will these run together, Thread 2 can run while thread 1 is blocked for I/O and v.v. >Also, is it possible to split off a program for the terminal that >started it? As in I type

Re: sockets, where can I find documentation?

2006-03-03 Thread Rene Pijlman
John Pote: >I want to use python on a server to access incoming TCP port accesses. So I >need to use the socket interface which is new to me. You may also want to look at Twisted: http://twistedmatrix.com/trac/ >Where can I get the various papers mentioned in the manual? And as I like >books s

Re: socket freezes

2006-03-03 Thread Rene Pijlman
Luis P. Mendes: >I've developed a program that uses a socket to receive information 24h a >~ day. > >The problem is that the socket seems to freeze. By that I mean the >program stops getting information but doesn't raise any error. That's weird. There's probably a bug in your program. >I tried t

How to except the unexpected?

2006-03-03 Thread Rene Pijlman
One of the things I dislike about Java is the need to declare exceptions as part of an interface or class definition. But perhaps Java got this right... I've writen an application that uses urllib2, urlparse, robotparser and some other modules in the battery pack. One day my app failed with an url

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Roy Smith: >I like to create a top-level exception class to encompass all the >possible errors in a given module, then subclass that. This way, if you >want to catch anything to goes wrong in a call, you can catch the top-level >exception class without having to enumerate them all. What do you

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
James Stroud: >Which suggests that "try: except HTTPException:" will be specific enough >as a catchall for this module. > >The following, then, should catch everything you mentioned except the >socket timeout: Your conclusion may be (almost) right in this case. I just don't like this approach. B

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Peter Hansen: >Good code should probably have a very small set of real exception >handling cases, and one or two catchalls at a higher level to avoid >barfing a traceback at the user. Good point. >> A catchall seems like a bad idea, since it also catches AttributeErrors >> and other bugs in the

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Paul Rubin : >We have to get Knuth using Python. Perhaps a MIX emulator and running TeXDoctest on his books will convince him.. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Steven D'Aprano: >ExpectedErrors = (URLError, IOError) >ErrorsThatCantHappen = > >try: >process_things() >except ExpectedErrors: >recover_from_error_gracefully() >except ErrorsThatCantHappen: >print "Congratulations! You have found a program bug!" >print "For a $327.68 reward, pleas

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Jorge Godoy: >Rene Pijlman: >> my app was surprised by an >> httplib.InvalidURL since I hadn't noticed this could be raised by >> robotparser (this is undocumented). > >It isn't undocumented in my module. From 'pydoc httplib': That's cheatin

Re: How to except the unexpected?

2006-03-04 Thread Rene Pijlman
Roy Smith: >In theory, all exceptions which represent problems with the external >environment (rather than programming mistakes) should derive from >Exception, but not from StandardError. Are you sure? """ The class hierarchy for built-in exceptions is: Exception +-- StandardError

Re: How to except the unexpected?

2006-03-05 Thread Rene Pijlman
Steven D'Aprano: >The OP is doing it because catching all exceptions masks bugs. There are >certain exceptions which should be allowed through, as they indicate a bug >in the OP's code. Normally the tactic is to catch only the exceptions you >are interested in, and let everything else through, but

Re: dual CPU-mode in python

2006-03-05 Thread Rene Pijlman
Astan Chee: >I was wondering if there is a way to maximize CPU usage Fork a Java app :-) -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: automatic referencing for variables?

2006-03-06 Thread Rene Pijlman
[EMAIL PROTECTED]: >can you do something like that in python? All you did is show us some string literals, but I guess you're looking for string substitution: http://docs.python.org/lib/typesseq-strings.html This can be simplified, they say: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe

Re: Missing interfaces in Python...

2006-04-18 Thread Rene Pijlman
[EMAIL PROTECTED]: >If it looks like a duck, and quacks like a duck, then for all practical >purposes it supports the 'duck' interface. The problem with that of course, is that there's much more to being a duck than being called 'duck'. public interface JarFile { void explode(); } public inte

Re: Uniquifying a list?

2006-04-18 Thread Rene Pijlman
Tim Chase: >Is there an obvious/pythonic way to remove duplicates from a >list (resulting order doesn't matter, Use a set. http://www.python.org/doc/lib/types-set.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >