Re: How do I create an array of functions?

2007-02-19 Thread Rob Wolfe
Steven W. Orr wrote: > I have a table of integers and each time I look up a value from the table > I want to call a function using the table entry as an index into an array > whose values are the different functions. I haven't seen anything on how > to do this in python. Do you mean something li

Re: How do I create an array of functions?

2007-02-19 Thread Rob Wolfe
Steven D'Aprano wrote: > On Mon, 19 Feb 2007 00:16:39 -0800, Rob Wolfe wrote: > > > > > Steven W. Orr wrote: > >> I have a table of integers and each time I look up a value from the table > >> I want to call a function using the table entry as an inde

Re: Sorting directory contents

2007-02-20 Thread Rob Wolfe
Wolfgang Draxinger wrote: > However this code works (tested) and behaves just like listdir, > only that it sorts files chronologically, then alphabetically. > > def listdir_chrono(dirpath): > import os > files_dict = dict() > for fname in os.listdir(dirpath): >

Re: Trouble with subprocess.call(...) and zsh script (OSError: [Errno 8] Exec format error)

2007-11-11 Thread Rob Wolfe
Michael George Lerner <[EMAIL PROTECTED]> writes: > Hi, > > (Python 2.5, OS X 10.4.10) > I have a program called pdb2pqr on my system. It is installed so that > "pdb2pqr" is in my path and looks like: > > #\!/bin/zsh -f Are you sure that this shebang is correct? I've tested that on bash and hav

Re: pipeline encoding

2007-12-06 Thread Rob Wolfe
Tomasz Toczyski <[EMAIL PROTECTED]> writes: > My locale is set to UTF-8. The command: > python -c "print u'\u03A9'" > gives me the desired result and doesn't produce any error. > > But when I want to redirect the output to a file I invoke: > python -c "print u'\u03A9'" > file.txt > I get an error:

Re: pipeline encoding

2007-12-06 Thread Rob Wolfe
Tomek Toczyski <[EMAIL PROTECTED]> writes: > Are there any command line option for telling python what encoding to > use for stdout? > > To be honest I have a more complicated program than the example that I > have presented - there are many print commands inside and it is not > very feasible for

Re: Python; jump to a concrete line

2007-12-20 Thread Rob Wolfe
Horacius ReX <[EMAIL PROTECTED]> writes: > Hi, sorry but after looking for information, I still did not get how, > when reading a text file in python, can one jump to a concrete line > and then read the different data (separated by spaces). In each line > there is different number of columns so so

Re: convert pdf to png

2007-12-25 Thread Rob Wolfe
Carl K <[EMAIL PROTECTED]> writes: > I need to take the take the pdf output from reportlab and create a > preview image for a web page. so png or something. I am sure > ghostscript will be involved. I am guessing PIL or ImageMagic ? > > all sugestions welcome. Did you try to use `reportPM` from

Re: urllib2 disable proxy

2008-01-02 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > Hello list, > > I've been looking for a way to explicitly disable the use of proxies with > urllib2, no matter what the environment dictates. Unfortunately I can't find > a way in the documentation, and reading the source leads me to believe tha

Re: urllib2 disable proxy

2008-01-03 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > On Wed, 2 Jan 2008, Rob Wolfe wrote: > >> Dimitrios Apostolou <[EMAIL PROTECTED]> writes: >> >>> Hello list, >>> >>> I've been looking for a way to explicitly disable the use of pro

Re: New Tk look (aka Ttk or Tile widgets)

2008-01-10 Thread Rob Wolfe
Robert Hicks napisał(a): > Do I have to install something extra to use the new look? I managed to use Tile with Tk 8.4 and Python 2.5. After installing Tile I followed these advices: http://tkinter.unpythonic.net/wiki/UsingTile and used this code: http://tkinter.unpythonic.net/wiki/TileWrapper A

Re: Using a proxy with urllib2

2008-01-10 Thread Rob Wolfe
"Jack" <[EMAIL PROTECTED]> writes: > I'm trying to use a proxy server with urllib2. > So I have managed to get it to work by setting the environment > variable: > export HTTP_PROXY=127.0.0.1:8081 > > But I wanted to set it from the code. However, this does not set the proxy: > httpproxy = '127

Re: urllib2 rate limiting

2008-01-10 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > P.S. And something simpler: How can I disallow urllib2 to follow > redirections to foreign hosts? You need to subclass `urllib2.HTTPRedirectHandler`, override `http_error_301` and `http_error_302` methods and throw `urllib2.HTTPError` exception.

Re: urllib2 rate limiting

2008-01-10 Thread Rob Wolfe
Dimitrios Apostolou <[EMAIL PROTECTED]> writes: > On Thu, 10 Jan 2008, Rob Wolfe wrote: > >> Dimitrios Apostolou <[EMAIL PROTECTED]> writes: >> >>> P.S. And something simpler: How can I disallow urllib2 to follow >>> redirections to fo

Re: Using a proxy with urllib2

2008-01-11 Thread Rob Wolfe
"Jack" <[EMAIL PROTECTED]> writes: > Rob, > > I tried your code snippet and it worked great. I'm just wondering if > getopener( ) call > is lightweight so I can just call it in every call to fetchurl( )? Or I > should try to share > the opener object among fetchurl( ) calls? Creating an opener

Re: Using a proxy with urllib2

2008-01-12 Thread Rob Wolfe
"Jack" <[EMAIL PROTECTED]> writes: >>> I'm trying to use a proxy server with urllib2. >>> So I have managed to get it to work by setting the environment >>> variable: >>> export HTTP_PROXY=127.0.0.1:8081 >>> >>> But I wanted to set it from the code. However, this does not set the >>> proxy: >>>

Re: examples of logger using smtp

2008-01-17 Thread Rob Wolfe
DwBear75 <[EMAIL PROTECTED]> writes: > I am hoping to find some simple examples of how to create a logger > instance using smtphandler. I don't want to create a separate ini > file. I just want to sent the smtphost, from, to right in the code > when I instantiate the logger. I can't seem to find s

Re: writing Python in Emacs

2008-01-20 Thread Rob Wolfe
Terry Jones <[EMAIL PROTECTED]> writes: >> "Richard" == Richard Szopa <[EMAIL PROTECTED]> writes: I don't see Richard's original post, so I reply to Terry. > > Richard> I am a devoted Emacs user and I write a lot in Python. > > Me too. The good news is that I managed to configure completion

Re: Set ulimit when using subprocess.Popen?

2008-01-28 Thread Rob Wolfe
Jarek Zgoda napisał(a): > Hi, all, > > anybody has an idea on how to set ulimit (-v in my case, linux) for > process started using subprocess.Popen? What about: from subprocess import call call('ulimit -v 1000 && ulimit -v && ls', shell=True) HTH, Rob -- http://mail.python.org/mailman/listinf

Re: Set ulimit when using subprocess.Popen?

2008-01-28 Thread Rob Wolfe
Jarek Zgoda napisał(a): > Rob Wolfe napisa�(a): > > > > Jarek Zgoda napisa�(a): > >> Hi, all, > >> > >> anybody has an idea on how to set ulimit (-v in my case, linux) for > >> process started using subprocess.Popen? > > > > What

Re: Telnet Program

2008-01-29 Thread Rob Wolfe
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I am having some issues writing a telnet program, using telnetlib. I > am not sure if it is the telnet on the connections end or it is my > program. > > A little background, when I log in straight from the Linux Command > prompt. The only thing I g

Re: Write ooxml .ods (spreadsheat) from python?

2008-02-14 Thread Rob Wolfe
Neal Becker napisał(a): > I'd like to output some data directly in .ods format. This format appears > to be quite complex. Is there any python software available to do this? I > did look at pyuno briefly. It looks pretty complicated also, and it looks > like it uses it's own private version o

Re: Looking for up to date documentation for Python/Tkinter

2008-02-21 Thread Rob Wolfe
Daniel Mahoney <[EMAIL PROTECTED]> writes: > On Thu, 21 Feb 2008 07:47:35 -0800, Kintaro wrote: > >> Oh wise usenet users, >> >> Please speak unto me the URL which contain the latest documentation on >> Python/Tkinter programming. >> >> I have seen Fredrik Lundh's introduction to tkinter (and ot

Re: Tkinter Menu Item Activation

2008-02-22 Thread Rob Wolfe
[EMAIL PROTECTED] writes: > Tkinter definitely deserves more respect! I'm making rapid progress > and it looks good. > > But am stuck on this: I want the File/Save state to change from > disabled to enabled, depending on whether or not there is something to > save (Text modified). Google returns r

Re: n00b with urllib2: How to make it handle cookie automatically?

2008-02-22 Thread Rob Wolfe
est <[EMAIL PROTECTED]> writes: > Hi all, > > I need urllib2 do perform series of HTTP requests with cookie from > PREVIOUS request(like our browsers usually do ). Many people suggest I > use some library(e.g. pycURL) instead but I guess it's good practise > for a python beginner to DIY something

Re: OOP books?

2008-10-15 Thread Rob Wolfe
Ken D'Ambrosio <[EMAIL PROTECTED]> writes: > Is there an intro-to-Python book where the emphasis isn't so > much on the language, but on OOP, itself? Or, failing that, at least > a Python book which doesn't just introduce the language, but gives > equal billing to OOP practices, etc. Take a look

Re: Emacs users: feedback on diffs between python-mode.el and python.el?

2008-10-18 Thread Rob Wolfe
Alberto Griggio <[EMAIL PROTECTED]> writes: > Hello, > >> I second Bruno's points, the older python-mode.el is much >> better, > > I agree too. I can't really say what's missing from python.el, but I'm > much more comfortable with python-mode.el. The triple-quote highlight is > better in python.e

Re: Emacs users: feedback on diffs between python-mode.el and python.el?

2008-10-18 Thread Rob Wolfe
Alberto Griggio <[EMAIL PROTECTED]> writes: > Hello, > >> I second Bruno's points, the older python-mode.el is much >> better, > > I agree too. I can't really say what's missing from python.el, but I'm > much more comfortable with python-mode.el. The triple-quote highlight is > better in python.e

Re: Logger Configuration

2008-07-08 Thread Rob Wolfe
"Robert Rawlins" <[EMAIL PROTECTED]> writes: > Hello guys, > > > > I?ve attached an example of my logging configuration file for you to look at. > The problem I?m experiencing is that the log files are not rotating as I would > expect them to, they just keep growing and growing. > > > > Can yo

Re: Logging to zero or more destinations

2008-07-08 Thread Rob Wolfe
samwyse <[EMAIL PROTECTED]> writes: > In the Python 2.5 Library Reference, section 14.5.3 (Logging to > multiple destinations), an example is given of logging to both a file > and the console. This is done by using logging.basicConfig() to > configure a log file, and then calling > logging.getLog

Re: FOSS projects exhibiting clean/good OOP?

2008-07-09 Thread Rob Wolfe
Phillip B Oldham <[EMAIL PROTECTED]> writes: > I'm wondering whether anyone can offer suggestions on FOSS projects/ > apps which exhibit solid OO principles, clean code, good inline > documentation, and sound design principles? > > I'm devoting some time to reviewing other people's code to advance

Re: logging via SocketHandler and TCPserver

2008-07-15 Thread Rob Wolfe
Larry Bates <[EMAIL PROTECTED]> writes: > Can multiple applications send SocketHandler logging records to the > same socket server on the same port simultaneously? Of course they can. Server can accept requests from many clients. You have used `SocketServer.ThreadingTCPServer`. That server for

Re: Help Tracing urllib2 Error, Please?

2008-07-20 Thread Rob Wolfe
Larry Hale <[EMAIL PROTECTED]> writes: > Since it seems I have a "unique" problem, I wonder if anyone could > point me in the general/right direction for tracking down the issue > and resolving it myself. > > See my prior post @ > http://groups.google.com/group/comp.lang.python/browse_thread/thre

Re: Problem with urllib2 and authentification

2008-04-22 Thread Rob Wolfe
"Miguel Beltran R." <[EMAIL PROTECTED]> writes: > Using this script for connect to Zope I have this error You forgot to add the authentication handler to the list of handlers. See below. > > ---script: > import urllib2 > > protocolo='http://' > servidor='10.28.1.239/' > pagina='manage' > fullur

Re: Problem with urllib2 and authentification

2008-04-22 Thread Rob Wolfe
Rob Wolfe <[EMAIL PROTECTED]> writes: >> ---script: >> import urllib2 >> >> protocolo='http://' >> servidor='10.28.1.239/' >> pagina='manage' >> fullurl=protocolo+servidor+pagina >> >> aut=urlli

Re: logging exceptions

2008-08-26 Thread Rob Wolfe
Alexandru Mosoi napisał(a): > why doesn't logging throw any exception when it should? how do I > configure logging to throw exceptions? > > >>> try: > ... logging.fatal('asdf %d', '123') > ... except: > ... print 'this line is never printed' > ... [...] You need to subclass your handler and

Re: Memory Leak?

2008-08-27 Thread Rob Wolfe
Kevin McKinley napisał(a): > So i've complete my first program with a GUI interface. I've noticed > that everytime i click a tab or button the amount of memory the program > takes up goes up by 50-200 kb. The program will start off at 4.5mb and > by the time i'm done it can get up over 10 or 1

Re: logging exceptions

2008-08-27 Thread Rob Wolfe
Vinay Sajip napisał(a): > On Aug 26, 10:36 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote: > > why doesn'tloggingthrow any exception when it should? how do I > > configureloggingto throw exceptions? > > > > >>> try: > > > > ... logging.fatal('asdf %d', '123') > > ... except: > > ... print 'thi

Re: Python svn bindings for Subversion?

2008-08-28 Thread Rob Wolfe
Mike B <[EMAIL PROTECTED]> writes: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the > following fails. > > from svn import fs, repos, core, delta > > As far as I can tell there are two Python Subversion libraries, 'pysvn' and > 'svn': > 'pysvn' from http://pysvn.tigri

Re: Cython dynamic library problem

2008-09-18 Thread Rob Wolfe
Tommy Grav <[EMAIL PROTECTED]> writes: > I am trying to learn how to use cython, and while I am following the > cython-dev > mailing list I didn't feel like this question was totally appropriate > for its audience > so I am trying here first. [...] > Does anyone know what the ImportError means a

<    1   2