Re: Running a command line program and reading the result as it runs

2013-08-22 Thread Rob Wolfe
Ian Simcock writes: > Greetings all. > > I'm using Python 2.7 under Windows and am trying to run a command line > program and process the programs output as it is running. A number of > web searches have indicated that the following code would work. > > import subprocess > > p = subprocess.Popen(

Re: Python 3 dict question

2011-05-06 Thread Rob Wolfe
dmitrey writes: > hi all, > suppose I have Python dict myDict and I know it's not empty. > I have to get any (key, value) pair from the dict (no matter which > one) and perform some operation. > In Python 2 I used mere > key, val = myDict.items()[0] > but in Python 3 myDict.items() return iterato

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: 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: 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

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: 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: 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-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: 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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: A Python 3000 Question

2007-10-29 Thread Rob Wolfe
brad <[EMAIL PROTECTED]> writes: > Will len(a_string) become a_string.len()? I was just reading > > http://docs.python.org/dev/3.0/whatsnew/3.0.html > > One of the criticisms of Python compared to other OO languages is that > it isn't OO enough or as OO as others or that it is inconsistent. And >

Re: Normalize a polish L

2007-10-15 Thread Rob Wolfe
Peter Bengtsson <[EMAIL PROTECTED]> writes: > In UTF8, \u0141 is a capital L with a little dash through it as can be > seen in this image: > http://static.peterbe.com/lukasz.png > > I tried this: import unicodedata unicodedata.normalize('NFKD', u'\u0141').encode('ascii','ignore') > '' >

Re: why does Configparser change names to lowercase ?

2007-09-14 Thread Rob Wolfe
stef mientki <[EMAIL PROTECTED]> writes: > hello, > > Why does Configparser change names to lowercase ? > > As Python is case sensitive (which btw I don't like at all ;-) > but now when really need the casesensitivity, > because it handles about names which should be recognized by human, > it cha

Re: bool behavior in Python 3000?

2007-07-11 Thread Rob Wolfe
Marc 'BlackJack' Rintsch wrote: > On Wed, 11 Jul 2007 00:37:38 -0700, Rob Wolfe wrote: > > > Steven D'Aprano wrote: > > > >> From a purely functional perspective, bools are unnecessary in Python. I > >> think of True and False as syntactic suga

Re: bool behavior in Python 3000?

2007-07-11 Thread Rob Wolfe
Steven D'Aprano wrote: > From a purely functional perspective, bools are unnecessary in Python. I > think of True and False as syntactic sugar. But they shouldn't be > syntactic sugar for 1 and 0 any more than they should be syntactic sugar > for {"x": "foo"} and {}. But `bools` are usefull in s

Re: HTMLParser.HTMLParseError: EOF in middle of construct

2007-06-20 Thread Rob Wolfe
Sérgio Monteiro Basto wrote: > Stefan Behnel wrote: > > > Sérgio Monteiro Basto wrote: > >> but is one single error that blocks this. > >> Finally I found it , it is : > >> >> if I put : > >> >> > >> p = re.compile('"align') > >> content = p.sub('" align', content) > >> > >> I can parse the html

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Rob Wolfe
[EMAIL PROTECTED] wrote: > So, I'm writing this to have your opinion on what tools I should use > to do this and what technique I should use. Take a look at parsing example on this page: http://wiki.python.org/moin/SimplePrograms -- HTH, Rob -- http://mail.python.org/mailman/listinfo/python-l

Re: Efficient way of generating original alphabetic strings like unix file "split"

2007-06-14 Thread Rob Wolfe
py_genetic <[EMAIL PROTECTED]> writes: > Hi, > > I'm looking to generate x alphabetic strings in a list size x. This > is exactly the same output that the unix command "split" generates as > default file name output when splitting large files. > > Example: > > produce x original, but not random s

Re: SimplePrograms challenge

2007-06-13 Thread Rob Wolfe
Steven Bethard <[EMAIL PROTECTED]> writes: >> I vote for example with ElementTree (without xpath) >> with a mention of using ElementSoup for invalid HTML. > > Sounds good to me. Maybe something like:: > > import xml.etree.ElementTree as etree > dinner_recipe = ''' > > 24slicesbaguette > 2+tbspol

Re: SimplePrograms challenge

2007-06-13 Thread Rob Wolfe
Steve Howell wrote: > I suggested earlier that maybe we post multiple > solutions. That makes me a little nervous, to the > extent that it shows that the Python community has a > hard time coming to consensus on tools sometimes. We agree that BeautifulSoup is the best for parsing HTML. :) > Th

Re: SimplePrograms challenge

2007-06-12 Thread Rob Wolfe
Steven Bethard <[EMAIL PROTECTED]> writes: > I'd hate to steer a potential new Python developer to a clumsier "clumsier"??? Try to parse this with your program: page2 = ''' URLs http://domain1/page1";>some page1 http://domain2/page2";>some page2 ''' > libra

Re: SimplePrograms challenge

2007-06-12 Thread Rob Wolfe
Steve Howell wrote: > Hi, I'm offering a challenge to extend the following > page by one good example: > > http://wiki.python.org/moin/SimplePrograms What about simple HTML parsing? As a matter of fact this is not language concept, but shows the power of Python standard library. Besides, that's v

Re: subprocess call acts differently than command line call?

2007-06-07 Thread Rob Wolfe
Jim <[EMAIL PROTECTED]> writes: > Hello, > > I need a program that will traverse a directory tree to ensure that > there > are unix-style line endings on every file in that tree that is a text > file. > To tell text files from others I want to use the unix "file" command > (Python's "mimetypes" is

Re: Encoding problem with web application (Paste+Mako)

2007-06-06 Thread Rob Wolfe
[EMAIL PROTECTED] wrote: > Hi > > I have a problem with encoding non-ascii characters in a web > application. The application uses Paste and Mako. > > The code is here: http://www.webudkast.dk/demo.txt > > The main points are: > > After getting some user generated input using > paste.request.parse

Re: subprocess leaves child living

2007-06-05 Thread Rob Wolfe
Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes: > But you can't ever catch sigkill. There is no protection against sigkill. > Isn't there a way to make sure the os kills the childprocess when the > parrent dies? If the parent dies suddenly without any notification childprocesses become zombies

Re: subprocess leaves child living

2007-06-05 Thread Rob Wolfe
Thomas Dybdahl Ahle wrote: > Problem is - I can't do that when I get killed. > Isn't it possible to open processes in such a way like terminals? If I > kill the terminal, everything open in it will die too. On POSIX platform you can use signals and ``os.kill`` function. Fo example: import os,

Re: Removing NS in ElementTree

2007-05-26 Thread Rob Wolfe
"Sebastian Bassi" <[EMAIL PROTECTED]> writes: > I would like to remove the namespace information from my elements and > have just the tag without this information. This > "{http://uniprot.org/uniprot}"; is preapended into all my output. > I understand that the solution is related with "_namespace_

Re: psycopg2 & large result set

2007-05-25 Thread Rob Wolfe
Jon Clements wrote: > Hi All. > > I'm using psycopg2 to retrieve results from a rather large query (it > returns 22m records); unsurprisingly this doesn't fit in memory all at > once. What I'd like to achieve is something similar to a .NET data > provider I have which allows you to set a 'FetchSiz

Re: emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Rob Wolfe
Paul Rudin <[EMAIL PROTECTED]> writes: > Unfortunately this doesn't make any difference for me, with either > emacs 22 or 21. I guess I'll just have to dig deeper into the code. So what happens after M-x pdb? -- http://mail.python.org/mailman/listinfo/python-list

Re: emacs python debugging: pydb or pdb fringe interaction

2007-05-18 Thread Rob Wolfe
Paul Rudin <[EMAIL PROTECTED]> writes: > I can't get the gdb fringe interaction functionality to work with > either pdb or pydb. Any hints as to versions or incantations I should > try? It works for me on Debian Etch and GNU Emacs 21.4.1. I'm using this settings: (setq pdb-path '/usr/lib/python2

Re: Popen and wget, problems

2007-05-12 Thread Rob Wolfe
"Jesse" <[EMAIL PROTECTED]> writes: > Hi all, I have a problem using wget and Popen. I hope someone can help. > > > -- Problem -- > I want to use the command: > wget -nv -O "dir/cpan.txt" "http://search.cpan.org"; > and capture all it's stdout+stderr. > (Note that option -O requires 'dir' to be ex

Re: Unzip then Zip help

2007-05-09 Thread Rob Wolfe
[EMAIL PROTECTED] writes: > I am a true n00b... and I just using Python to complete some very > small uneventful task, but need help with one last thing. > > Basically, this I what I am trying to do. > > make a temp directory (this part I can do) > > Need help with: > ***unzip a JAR file with the

Re: tkinter - label widget text selection

2007-05-06 Thread Rob Wolfe
[EMAIL PROTECTED] writes: > Hi, > I guess this is a very trivial question -- > I am using a label widget to display text (black font in a white > background color). I am trying to use my mouse to scroll over the > displayed text to select it, but tkinter does not allow me to do it. > Is there a me

Re: read list of dirnames and search for filenames

2007-05-01 Thread Rob Wolfe
Rob Wolfe <[EMAIL PROTECTED]> writes: > fscked <[EMAIL PROTECTED]> writes: > >> I cannot seem to get this to work. I am hyst trying to read in a list >> of paths and see if the directory or any sub has a filename pattern. >> Here is the code: >>

Re: read list of dirnames and search for filenames

2007-05-01 Thread Rob Wolfe
fscked <[EMAIL PROTECTED]> writes: > I cannot seem to get this to work. I am hyst trying to read in a list > of paths and see if the directory or any sub has a filename pattern. > Here is the code: > > import os, sys > from path import path > > myfile = open("boxids.txt", "r") > for line in myfile

Re: I wish that [].append(x) returned [x]

2007-05-01 Thread Rob Wolfe
Tobiah <[EMAIL PROTECTED]> writes: > I wanted to do: > > query = "query text" % tuple(rec[1:-1].append(extra)) > > but the append() method returns none, so I did this: > > fields = rec[1:-1] > fields.append(extra) > query = "query text" % tuple(fields) What about this?

Re: Tutorial creates confusion about slices

2007-04-23 Thread Rob Wolfe
Antoon Pardon wrote: > The following is part of the explanation on slices in the > tutorial: > > The best way to remember how slices work is to think of the indices as > pointing between characters, with the left edge of the first character > numbered 0. Then the right edge of the last character o

Re: using tkinter to display html

2007-04-20 Thread Rob Wolfe
Stephen M. Gava wrote: > On Thu, 19 Apr 2007 06:09:33 -0700, kyosohma wrote: > > > On Apr 19, 6:29 am, "Stephen M. Gava" <[EMAIL PROTECTED]> > > wrote: > >> Hi all, > >> > >> I prefer using tkinter to wxpython (so sue me :) and i need to display > >> a lot of html in a particular app. does anyone

Re: Question about Tkinter MenuOption variable

2007-04-19 Thread Rob Wolfe
Chad wrote: > Is there anyway to set the individual options in Tkinter to a > particular variable. For example, I have a menu option(code is below) > which has January, February, March and so on, which I would like to > have corresponding values of 01, 02, 03 and so on. Can someone please > tell

Re: Boost Problem! Boost.Build not found

2007-04-16 Thread Rob Wolfe
Soren wrote: > > Try to create boost-build.jam file like this: > > > > # boost-build.jam > > boost-build C:\boost\boost_1_33_1\tools\build\v1 ; > > > Hi Rob, Thanks for the answer! > > It did solve the error.. but produced a new one: > > C:\boost\boost_1_33_1\libs\python\example\tutorial>bjam -sT

Re: Boost Problem! Boost.Build not found

2007-04-16 Thread Rob Wolfe
Soren wrote: > Unable to load Boost.Build: could not find "boost-build.jam" > --- > Attempted search from C:\boost\boost_1_33_1\libs\python\example > \tutorial up to t > he root and in these directories from BOOST_BUILD_PATH and BOOST_RO

Re: sqlite3 question

2007-04-12 Thread Rob Wolfe
Jorgen Bodde wrote: > All I can think of is a 'crappy' construction where I use the iterator > to see if there was something in there, but surely, there must be a > better way to know? > > >>> r = c.execute('select * from song where id = 2') > >>> notfound = True > >>> for s in r: > ... notfoun

Re: About Eggs

2007-04-10 Thread Rob Wolfe
Mark Elston <[EMAIL PROTECTED]> writes: > This is probably a *really* stupid question but... > I have looked at all the documentation I have for 2.4.3 > and all the docs I can download for 2.5 and I simply cannot > find anything, anywhere that documents what egg files are. > > I have read posts re

Re: real time updating of popen, bufsize=0 problems

2007-04-06 Thread Rob Wolfe
"ianaré" <[EMAIL PROTECTED]> writes: > hey all, I'm trying to get real time updates of batch file output. [...] > So I tried subprocess: > proc = subprocess.Popen('"C:/path/to/test.bat"', bufsize=0, > stdout=subprocess.PIPE) Instead of that: > for line in proc.stdout: > self.display.Writ

Re: Tkinter <> and bindtags ordering

2007-04-03 Thread Rob Wolfe
bytecolor wrote: > Hey Rob, > I actually started with that event, until I came across the modified > event. I'm working on syntax highlighting. So I need any text change. > Also, colorizing on a key release is annoyingly noticeable to the > user. I tried it :) > > I'm sure there are going to be o

Re: Tkinter <> and bindtags ordering

2007-04-03 Thread Rob Wolfe
bytecolor wrote: [...] > changing = False > root = tk.Tk() > t = tk.Text(master=root) > t.pack() > t.focus_set() > t.tk.call(t._w, 'edit', 'modified', 0) What about instead of: > t.bind('<>', text_changed) this event: t.bind('', text_changed) > root.mainloop() -- HTH, Rob -- http://ma

Re: Create new processes over telnet in XP

2007-03-24 Thread Rob Wolfe
"Godzilla" <[EMAIL PROTECTED]> writes: > Rob, I would be logging into another XP machine to do some software I was afraid of that. :) > installation... the code you provided, correct me if I'm wrong, seems > to work under Unix/Linux. This part of running and killing processes, yes. > Any idea

Re: Create new processes over telnet in XP

2007-03-23 Thread Rob Wolfe
Godzilla wrote: > Hello, > > How do you create/spawn new processes in XP over telnet using python? > I.e. I would like to create a new process and have it running in the > background... when I terminate the telnet connection, I would what the > spawned processes to keep running until I shut it off

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: 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: 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: rot13 in a more Pythonic style?

2007-02-14 Thread Rob Wolfe
"Andy Dingley" <[EMAIL PROTECTED]> writes: > I'm trying to write rot13, but to do it in a better and more Pythonic > style than I'm currrently using. What would you reckon to the > following pretty ugly thing? How would you improve it? In > particular, I don't like the way a three-way selectio

Re: calling php function from python

2007-02-14 Thread Rob Wolfe
mark wrote: > is it possible to call a php function from python and use a class from > php in python? i want to use mmslib which creates mms messages and the > only implementation is a php mmslib implementation. You can consider to use some kind of RPC (remote procedure call) for example XML-RPC.

Re: python references

2007-02-05 Thread Rob Wolfe
[EMAIL PROTECTED] wrote: > >>> from Numeric import zeros > >>> p=zeros(3) > >>> p > array([0,0,0]) > >>> p[0] > 0 > >>> x=p[0] `x' is now a reference to immutable integer object with value 0, not to first element of array `p' > >>> x=10 now `x' is a reference to immutable integer object with va

Re: PYTHONPATH or any other way to set seachpath (winXP) ?

2007-02-04 Thread Rob Wolfe
Stef Mientki <[EMAIL PROTECTED]> writes: > Is it possible to change the searchpath for modules on the flight, > under winXP ? > Most preferred is some command to extend the searchpath. > (the environment variable PYTHONPATH needs a reboot) Do you mean something like that? >>> import some_module

Re: Help needed on config files

2007-01-31 Thread Rob Wolfe
jvdb wrote: > Hi there, > > I am quite new on python programming and need some help on solving my > problem.. > > I have to make a (python) program which deletes files from > directories. I don't think deleting, etc. is the problem. The problem > is that the directories where i have to delete them

Re: string byte dump

2007-01-28 Thread Rob Wolfe
Jammer <[EMAIL PROTECTED]> writes: > Does anyone that knows python want to write me a byte dump for strings? :-) > > I am trying to modify a plugin (that someone else wrote) that uses > interprocess communication. > It works on strings without special characters but it fails on other > stings like

Re: howto redirect and extend help content ?

2007-01-28 Thread Rob Wolfe
Stef Mientki <[EMAIL PROTECTED]> writes: > I'm making special versions of existing functions, > and now I want the help-text of the newly created function to exists of > 1. an extra line from my new function > 2. all the help text from the old function > > # the old function > def triang(M,sym=1):

Re: module email

2007-01-25 Thread Rob Wolfe
Sergey Dorofeev wrote: > "Rob Wolfe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > >> p2=email.message.Message() > >> p2.set_type("message/rfc822") > >> p2.set_payload(m) > > > > Payload is a _lis

Re: module email

2007-01-24 Thread Rob Wolfe
"Sergey Dorofeev" <[EMAIL PROTECTED]> writes: > Hello. > > Why does not work? [...] > m=email.message.Message() [...] > p2=email.message.Message() > p2.set_type("message/rfc822") > p2.set_payload(m) Payload is a _list_ of Message objects (is_multipart() == True) or a _string_ object (is_multi

Re: How to respond to a confirmation prompt automatically

2007-01-12 Thread Rob Wolfe
"Coby" <[EMAIL PROTECTED]> writes: > Just to give you some background about my problem: > > I execute os.system(command), where command is a string. > > On the command line in windows, I get: > > "Continue, and unload these objects? [no]" > > I need to respond 'y' to continue, but I am uncertain o

Re: module file

2007-01-12 Thread Rob Wolfe
Imbaud Pierre <[EMAIL PROTECTED]> writes: > I am willing to retrieve the file an imported module came from; > module.__file__, or inspect.getfile(module) only gives me the > relative file name. How do I determine the path? >>> import os >>> os.path.abspath(module.__file__) -- HTH, Rob -- http:

Re: Question about compiling.

2007-01-10 Thread Rob Wolfe
Gabriel Genellina <[EMAIL PROTECTED]> writes: > At Tuesday 9/1/2007 14:56, Steven W. Orr wrote: > >>I *just* read the tutorial so please be gentle. I created a file called >>fib.py which works very nicely thank you. When I run it it does what it's >>supposed to do but I do not get a resulting .pyc

Re: get script path

2006-12-04 Thread Rob Wolfe
hg wrote: > Hi, > > must I parse argv[0] to get it, or is there an easier way (that works under > Windows and *nix)? > > Ex: > > python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test IMHO it is easy enough: >>> dname, fname = os.path.split("/home/hg/test/test.py") >>> dname '/ho

Re: Detecting recursion loops

2006-11-29 Thread Rob Wolfe
robert wrote: > My code does recursion loops through a couple of functions. Due to > problematic I/O input this leads sometimes to "endless" recursions and after > expensive I/O to the Python recursion exception. > What would be a good method to detect recursion loops and stop it by > user-Exce

Re: Question about import and sys.path

2006-11-29 Thread Rob Wolfe
Frank Millman wrote: > One small point. The docs have the following warning - > > "Important: the caller is responsible for closing the file argument, if > it was not None, even when an exception is raised. This is best done > using a try ... finally statement. " > > I have added this to my code.

Re: Question about import and sys.path

2006-11-28 Thread Rob Wolfe
Frank Millman wrote: > Hi all > > I am writing a business/accounting application. Once a user has logged > in they are presented with a menu. Each menu option has a description > and an associated file name and program name. The file name is the name > of a .py file (impName) and the program name

Re: combining the path and fileinput modules

2006-11-23 Thread Rob Wolfe
wo_shi_big_stomach wrote: > Newbie to python writing a script to recurse a directory tree and delete > the first line of a file if it contains a given string. I get the same > error on a Mac running OS X 10.4.8 and FreeBSD 6.1. > > Here's the script: > > # start of program > > # p.pl - fix broken

Re: a little about regex

2006-10-19 Thread Rob Wolfe
Fulvio wrote: > Great, it works perfectly. I found my errors. > I didn't use r ahead of the patterns and i was close to the 'allow' pattern > but didn't give positive result and KregexEditor reported wrong way. This > specially because of '<' inside the stream. I thing that is not a normal > reg

Re: a little about regex

2006-10-18 Thread Rob Wolfe
Fulvio wrote: > I'm trying to get working an assertion which filter address from some domain > but if it's prefixed by '.com'. > Even trying to put the result in a negate test I can't get the wanted result. [...] > Seem that I miss some better regex implementation to avoid that both of the > fi

Re: Looking for assignement operator

2006-10-17 Thread Rob Wolfe
Alexander Eisenhuth wrote: > Hello, > > is there a assignement operator, that i can overwrite? You can't overwrite assignment operator, but you can overwrite methods of numeric objects: http://docs.python.org/ref/numeric-types.html HTH, Rob -- http://mail.python.org/mailman/listinfo/python-li

  1   2   >