Re: How to merge two binary files into one?

2005-04-05 Thread could ildg
I'm so glad that this this problem has so many recipes. On Apr 5, 2005 1:57 PM, Andrew Dalke <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > For large files, something like this is probably a better idea: > > Or with the little-used shutil module, and keeping your > nomenclature and block s

Re: Insert database rows from CSV file

2005-04-05 Thread Steve Holden
Dennis Lee Bieber wrote: On Mon, 4 Apr 2005 15:54:37 -0700, "3c273" <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: Thanks for the link, but this is the step I am trying to save (for someone else). Every time he goes to run a report, he must stop and import any new csv files. Sinc

Re: Decorator Maker is working. What do you think?

2005-04-05 Thread Kay Schluehr
Ron_Adam wrote: > Ok... it's works! :) > > So what do you think? Not much. As long as You do not present any nontrivial examples like Guidos MultiMethod decorator or an implementation of the dispatching "case" decorator I proposed that would benefit from factoring into pre- and postprocessing the

Re: the bugs that try men's souls

2005-04-05 Thread Jordan Rastrick
Sean McIlroy wrote: > > Wow again. I had a real "V8 moment" when I looked at your solution > (smacking my forhead, groaning ruefully, etc). You were right: my > intention was simply to hide the trivial cases from view; I completely > missed the fact that I was now testing for membership in a diffe

Re: Gnuplot.py and, _by far_, the weirdest thing I've ever seen on my computer

2005-04-05 Thread Fernando Perez
syd wrote: > I don't even know where to begin. This is just bizarre. I just picked > up the Gnuplot.py module (a light interface to gnuplot commands) and > was messing around with it today. > > I've got a tiny script, but it only works from the command line about > half the time! In the python

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Kay Schluehr
Steve Holden wrote: > You have several times mentioned the possibility of a decorator taking > more than one argument, but in my understanding of decorators this just > wouldn't make sense. A decorator should (shouldn't it) take precisely > one argument (a function or a method) and return precise

Re: Eric3 under WinXP

2005-04-05 Thread Phil Thompson
> Hello NG, > > (Win XP) > > I have successfully installed pyqt, but not > qtext, which I need to run Eric3. > The PyQT demo files run fine. > > I've downloaded QScintilla, compiled via MS-VC, > but (I suppose I need the SIG), to translate or provide > the Python interface with pyd Files. > > Eric

Placing Toplevel over the parent ?

2005-04-05 Thread Pete Moscatt
When calling a dialog box using the Toplevel widget, how do I place it over the calling parent ? Currently when I call the dialog it appears to the side of the calling parent. Pete -- http://mail.python.org/mailman/listinfo/python-list

How to read a wxTreeCtrl

2005-04-05 Thread danielpm72
Hi, I want to read a wxTreeCtrl from the root since I want to store all the information in it in a python dictionary. I know that the methods I have to use are ItemHasChildren, GetFirstChild and GetNextChild and I have been success in getting the first node in this manner: while child.IsOk()

Re: monitoring folder in python

2005-04-05 Thread André Søreng
Raghul wrote: Is it possible to monitor a folder in the python?My question is if I put any file in it that particular folder my script should monitor the folder and read the file name.If so what function can I use? Thanx in advance If you do not want to poll (check for changes yourself regularly),

Re: StopIteration in the if clause of a generator expression

2005-04-05 Thread Simon Brunning
On Apr 5, 2005 2:04 AM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Steven Bethard] > > So do I read this right in preferring > > [ for in ] > > over > > list( for in ) > > Yes! Why? (Serious question. I'm sure that you have a good reason - I just can't figure out what it is.) Th

Re: Eric3 under WinXP

2005-04-05 Thread Franz Steinhaeusler
On Tue, 5 Apr 2005 09:17:05 +0100 (BST), "Phil Thompson" <[EMAIL PROTECTED]> wrote: >> Hello NG, >> >> (Win XP) >> >> I have successfully installed pyqt, but not >> qtext, which I need to run Eric3. >> The PyQT demo files run fine. >> >> I've downloaded QScintilla, compiled via MS-VC, >> but (I su

Re: Eric3 under WinXP

2005-04-05 Thread Phil Thompson
> On Tue, 5 Apr 2005 09:17:05 +0100 (BST), "Phil Thompson" > <[EMAIL PROTECTED]> wrote: > >>> Hello NG, >>> >>> (Win XP) >>> >>> I have successfully installed pyqt, but not >>> qtext, which I need to run Eric3. >>> The PyQT demo files run fine. >>> >>> I've downloaded QScintilla, compiled via MS-VC

Re: DIY Spam Filter in Python

2005-04-05 Thread Peter Ballard
Damien Wyart <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > * [EMAIL PROTECTED] (Peter Ballard) in comp.lang.python: > > Source code, and a bit of documentation, is at: > > http://members.ozemail.com.au/~pballard/diyspamfilter.html > > BTW, 2 of the 3 files are links, so missin

Is it possible to distinguish between system environment variables and the user ones?

2005-04-05 Thread could ildg
To a environment variable in Windows, can python know if it is a system environment variable or a current-user environment variable? -- 鹦鹉聪明绝顶、搞笑之极,是人类的好朋友。 直到有一天,我才发觉,我是鹦鹉。 我是翻墙的鹦鹉。 -- http://mail.python.org/mailman/listinfo/python-list

Re: setup distributed computing for two computer only

2005-04-05 Thread Irmen de Jong
Heiko Wundram wrote: Am Montag, 4. April 2005 21:27 schrieb [EMAIL PROTECTED]: Google for: Python Remote Objects ^^^ what Heiko said :) This is, assuming that the 'function' on the other computer is implemented in Python too. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: StopIteration in the if clause of a generator expression

2005-04-05 Thread Duncan Booth
Simon Brunning wrote: > On Apr 5, 2005 2:04 AM, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >> [Steven Bethard] >> > So do I read this right in preferring >> > [ for in ] >> > over >> > list( for in ) >> >> Yes! > > Why? (Serious question. I'm sure that you have a good reason - I ju

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread Franz Steinhaeusler
On Tue, 05 Apr 2005 01:53:25 +0200, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >Fredrik Lundh wrote: > >> I'm not aware of any other tool that solves that specific problem. > >notepad does a fine job at creating batch files, IMO. > >Of course, it is not all that clear what the OP actually wanted

Re: Super Newbie Question

2005-04-05 Thread Joey C.
To reply to many of your messages (I'm using Google right now due to lack of a better newsreader at the moment), the issue with the temporary file is that when I write something new to it, if the old contents of the file was larger, not all of it will be overwritten. So, the truncate() method will

Re: Simple thread-safe counter?

2005-04-05 Thread Michael Hudson
Paul Rubin writes: > Tim Peters <[EMAIL PROTECTED]> writes: > > The GIL is your friend here: > > > > import itertools > > f = itertools.count().next > > Thanks, I was hoping something like this would work but was not sure I > could rely on it. > > > A similar

Re: setup distributed computing for two computer only

2005-04-05 Thread Heiko Wundram
Am Dienstag, 5. April 2005 11:22 schrieb Irmen de Jong: > > Python Remote Objects > > ^^^ what Heiko said :) *biggrin* -- --- Heiko. listening to: Tool - Lateralus - 1 The Grudge.mp3 see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/ pgpKv3ALoPbZi.pgp Description: PGP signature

Re: Eric3 under WinXP

2005-04-05 Thread Franz Steinhaeusler
On Tue, 5 Apr 2005 10:14:48 +0100 (BST), "Phil Thompson" <[EMAIL PROTECTED]> wrote: >> On Tue, 5 Apr 2005 09:17:05 +0100 (BST), "Phil Thompson" >> <[EMAIL PROTECTED]> wrote: >> >> What steps are missing? > >If you are using the evaluation version of Qt then you need the evaluation >version of PyQt

Python Google Server

2005-04-05 Thread fuzzyman
I've hacked together a 'GoogleCacheServer'. It is based on SimpleHTTPServer. Run the following script (hopefully google groups won't mangle the indentation) and set your browser proxy settings to 'localhost:8000'. It will let you browse the internet using google's cache. Obviously you'll miss image

passing dictionary objects with soap

2005-04-05 Thread vivek khurana
Hi! all, How can i return dictionary type element from a soap server to a client. What should be the entry section of a wsdl file. Regards VK Hug the REALITY ;-) Disclaimer The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw...

Re: monitoring folder in python

2005-04-05 Thread Davide Salomoni
A straw-man solution in Python that monitors a directory for changes (Linux only): #!/usr/bin/env python2 import sys import os if sys.platform not in ("linux2",): sys.exit("%s only runs on Linux" % os.path.basename(sys.argv[0])) # TODO: we should check that kernel version >= 2.4.19 # e.g. w

Re: Eric3 under WinXP

2005-04-05 Thread Phil Thompson
> On Tue, 5 Apr 2005 10:14:48 +0100 (BST), "Phil Thompson" > <[EMAIL PROTECTED]> wrote: > >>> On Tue, 5 Apr 2005 09:17:05 +0100 (BST), "Phil Thompson" >>> <[EMAIL PROTECTED]> wrote: >>> >>> What steps are missing? >> >>If you are using the evaluation version of Qt then you need the >> evaluation >>

Re: Python Google Server

2005-04-05 Thread vegetax
[EMAIL PROTECTED] wrote: lol ,cool hack!! make a slashdot article about it!! > I've hacked together a 'GoogleCacheServer'. It is based on > SimpleHTTPServer. Run the following script (hopefully google groups > won't mangle the indentation) and set your browser proxy settings to > 'localhost:8000'

Re: Eric3 under WinXP

2005-04-05 Thread Franz Steinhaeusler
On Tue, 5 Apr 2005 11:43:38 +0100 (BST), "Phil Thompson" <[EMAIL PROTECTED]> wrote: >>[...] >> Or doesn't it fit with "Qt 3.3.4 Evaluation" >> >> Any hints? > >What version of Python do you have installed? The binary is built against >v2.4. > Oh sorry, I think, there was a mix between Python2.3 an

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Bengt Richter
On 5 Apr 2005 00:54:25 -0700, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: > >> You have several times mentioned the possibility of a decorator >taking >> more than one argument, but in my understanding of decorators this >just >> wouldn't make sense. A decorator should (shouldn'

Re: Python Google Server

2005-04-05 Thread vegetax
it works on opera and firefox on linux, but you cant search in the cached google! it would be more usefull if you could somehow search "only" in the cache instead of putting the straight link. maybe you could put a magic url to search in the cache, like search:"search terms" [EMAIL PROTECTED] wrot

Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread [EMAIL PROTECTED]
Hi ! I search for an IDE that working in Windows, and knows these functions: A.) Automatic name searching/showing/extending on classes with keypressing (like Netbeans, or Delphi Ctrl+Space). B.) Debugging: breakpoints, step on lines (code), watch variables. Or A and B both. Please help me. Thanx:

Re: playing with pyGoogle - strange codec error

2005-04-05 Thread Richard Brodie
"Brian Blazer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Everything works fine until I get to r.snippet. Here is the error: > > UnicodeEncodeError: 'ascii' codec can't encode character '\ua9' in > position 119: ordinal not in range(128) You have a character there (the copyri

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread rbt
Martin v. Löwis wrote: Of course, it is not all that clear what the OP actually wanted. For all we know, he wanted to "alternate quickly (with batch file or similary) between python23 and python24"... Maybe off-topic for this thread, but I noticed that when installing 2.4.1 that 2.4.0 is automatic

Re: copying a file in the python script

2005-04-05 Thread Larry Bates
If you are moving the file to another directory on the same hard drive (e.g. same filesystem) you can use os.rename(old, new) and the file doesn't have to be copied at all. This is more efficient. If you are copying to another filesystem, you must use shutil.copy and os.remove (or os.unlink). Larr

Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread Larry Bates
Take a look at ActiveState: http://www.activestate.com/Products/ActivePythonFamily/?_x=1 or for something more general: http://www.eclipse.org/ Larry Bates [EMAIL PROTECTED] wrote: > Hi ! > > I search for an IDE that working in Windows, and knows these functions: > > A.) Automatic name sear

Re: playing with pyGoogle - strange codec error

2005-04-05 Thread Brian Blazer
On 2005-04-05 07:32:12 -0500, "Richard Brodie" <[EMAIL PROTECTED]> said: "Brian Blazer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Everything works fine until I get to r.snippet. Here is the error: UnicodeEncodeError: 'ascii' codec can't encode character '\ua9' in position 119: or

check interpreter version before running script

2005-04-05 Thread rbt
Is there a recommended or 'Best Practices' way of checking the version of python before running scripts? I have scripts that use the os.walk() feature (introduced in 2.3) and users running 2.2 who get errors. Instead of telling them, 'Upgrade you Python Install, I'd like to use sys.version or s

Re: copying a file in the python script

2005-04-05 Thread Peter Otten
Larry Bates wrote: > If you are moving the file to another directory on the same hard > drive (e.g. same filesystem) you can use os.rename(old, new) and > the file doesn't have to be copied at all. This is more efficient. > If you are copying to another filesystem, you must use shutil.copy > and o

Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread Franz Steinhaeusler
On Tue, 05 Apr 2005 14:07:14 +0200, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >I search for an IDE that working in Windows, and knows these functions: > >A.) Automatic name searching/showing/extending on classes with >keypressing (like Netbeans, or Delphi Ctrl+Space). >B.) Debugging: break

Re: check interpreter version before running script

2005-04-05 Thread Peter Otten
rbt wrote: > Is there a recommended or 'Best Practices' way of checking the version > of python before running scripts? I have scripts that use the os.walk() > feature (introduced in 2.3) and users running 2.2 who get errors. > Instead of telling them, 'Upgrade you Python Install, I'd like to use

Re: check interpreter version before running script

2005-04-05 Thread F. Petitjean
Le Tue, 05 Apr 2005 08:57:12 -0400, rbt a écrit : > Is there a recommended or 'Best Practices' way of checking the version > of python before running scripts? I have scripts that use the os.walk() > feature (introduced in 2.3) and users running 2.2 who get errors. > Instead of telling them, 'Upg

Re: Eric3 under WinXP

2005-04-05 Thread Phil Thompson
> On Tue, 5 Apr 2005 11:43:38 +0100 (BST), "Phil Thompson" > <[EMAIL PROTECTED]> wrote: > >>>[...] >>> Or doesn't it fit with "Qt 3.3.4 Evaluation" >>> >>> Any hints? >> >>What version of Python do you have installed? The binary is built against >>v2.4. >> > Oh sorry, I think, there was a mix betwe

Re: Super Newbie Question

2005-04-05 Thread Peter Hansen
Joey C. wrote: To reply to many of your messages (I'm using Google right now due to lack of a better newsreader at the moment), the issue with the temporary file is that when I write something new to it, if the old contents of the file was larger, not all of it will be overwritten. That's not likel

Re: StopIteration in the if clause of a generator expression

2005-04-05 Thread Raymond Hettinger
> > [Steven Bethard] > > > So do I read this right in preferring > > > [ for in ] > > > over > > > list( for in ) [Raymond Hettinger] > > Yes! [Simon Brunning] > Why? (Serious question. I'm sure that you have a good reason - I just > can't figure out what it is.) > > The generator exp

Re: raw sockets please

2005-04-05 Thread Peter Hansen
ionel wrote: anyone got any idea how the get raw sockets working on win32 ? (on python 2.4) No, but I'm certain this has been asked and answered many times in the past. Maybe you could use Google Groups and search the list archives, posting here only when you get insufficient results (and telling

Re: Placing Toplevel over the parent ?

2005-04-05 Thread Peter Hansen
Pete Moscatt wrote: When calling a dialog box using the Toplevel widget, how do I place it over the calling parent ? Currently when I call the dialog it appears to the side of the calling parent. What framework? What versions? What platform? -Peter -- http://mail.python.org/mailman/listinfo/pytho

Re: Python Google Server

2005-04-05 Thread Fuzzyman
vegetax wrote: > it works on opera and firefox on linux, but you cant search in the cached > google! it would be more usefull if you could somehow search "only" in the > cache instead of putting the straight link. maybe you could put a magic url > to search in the cache, like search:"search terms"

Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread Markus Wankus
More specifically, check out the pydev plugin for Eclipse. pydev.sourceforge.net M. Larry Bates wrote: Take a look at ActiveState: http://www.activestate.com/Products/ActivePythonFamily/?_x=1 or for something more general: http://www.eclipse.org/ Larry Bates [EMAIL PROTECTED] wrote: Hi ! I search f

Re: Is it possible to distinguish between system environment variables and the user ones?

2005-04-05 Thread Peter Hansen
could ildg wrote: > To a environment variable in Windows, can python know if it is a > system environment > variable or a current-user environment variable? Not just by using the "os.environ" approach. You would have to resort to the "pywin32" extensions. Check the Python Cookbook using Google fo

Re: check interpreter version before running script

2005-04-05 Thread Peter Hansen
rbt wrote: Is there a recommended or 'Best Practices' way of checking the version of python before running scripts? I have scripts that use the os.walk() feature (introduced in 2.3) and users running 2.2 who get errors. Instead of telling them, 'Upgrade you Python Install, I'd like to use sys.v

Re: check interpreter version before running script

2005-04-05 Thread Martin Franklin
F. Petitjean wrote: Le Tue, 05 Apr 2005 08:57:12 -0400, rbt a écrit : Is there a recommended or 'Best Practices' way of checking the version of python before running scripts? I have scripts that use the os.walk() feature (introduced in 2.3) and users running 2.2 who get errors. Instead of tellin

start python web programming

2005-04-05 Thread Andre Nobre
I should implement a simple http/database page, based on python. I read some texts and it´s strange how python deal with html output. It´s something like Servlet... is there any diferent way to do that? Something like just bussiness code, applied in an MVC framework, or just like it. Thanks and sor

Re: Python IDE like NetBeans/Delphi IDE

2005-04-05 Thread JZ
Dnia Tue, 05 Apr 2005 14:07:14 +0200, [EMAIL PROTECTED] napisał(a): > Hi ! > > I search for an IDE that working in Windows, and knows these functions: > > A.) Automatic name searching/showing/extending on classes with > keypressing (like Netbeans, or Delphi Ctrl+Space). > B.) Debugging: breakpo

Re: boring the reader to death (wasRe: Lambda: the Ultimate DesignFlaw

2005-04-05 Thread Warren Postma
Donn Cave wrote: That's an odd thing to say. Poetry is verbose, florid? Python is Dutch. Ha. I'm vaguely dutch, whatever that means. I would say if there is a sister word for "Programming" in the english language, it isn't Poetry and it surely isn't Prose. It's Dialectic. I appreciate the idea of

Re: How to merge two binary files into one?

2005-04-05 Thread Grant Edwards
On 2005-04-05, Andrew Dalke <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> For large files, something like this is probably a better idea: > > Or with the little-used shutil module, and keeping your > nomenclature and block size of 65536 I knew I should have looked through shutil to see if t

Re: check interpreter version before running script

2005-04-05 Thread Josef Meile
Is there a recommended or 'Best Practices' way of checking the version of python before running scripts? I have scripts that use the os.walk() feature (introduced in 2.3) and users running 2.2 who get errors. Instead of telling them, 'Upgrade you Python Install, I'd like to use sys.version or s

Re: Python Google Server

2005-04-05 Thread Fuzzyman
Another change - change the line `dotloc = url.find('.') + 1` to `dotloc = url.rfind('.') + 1` This makes it find the last '.' in the url Best Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread Thomas Heller
rbt <[EMAIL PROTECTED]> writes: > Martin v. Löwis wrote: > >> Of course, it is not all that clear what the OP actually wanted. >> For all we know, he wanted to "alternate quickly (with batch >> file or similary) between python23 and python24"... > > Maybe off-topic for this thread, but I noticed t

Class, object question.

2005-04-05 Thread Jeffrey Maitland
Hello folks,   The question I am having is something like this.   # ignore the precursing ….  I am using them for easy message formatting   from point import *   Class vector(point): ..def __init___(self, point1, point2): …..self.i = point2.get_x() - point1.get_x()

SSL and Proxy problem with urllib2 ?

2005-04-05 Thread Robert
using a proxy and https/SSL together I get the following SSL error : File "dscore.pyo", line 2257, in UrlOpenEx File "ClientCookie\_urllib2_support.pyo", line 572, in open File "ClientCookie\_urllib2_support.pyo", line 472, in http_response File "ClientCookie\_urllib2_support.pyo", line 58

Re: unittest vs py.test?

2005-04-05 Thread Michael Hudson
Roy Smith <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bengt Richter) > > Is there a package that is accessible without svn? > > That seems to be its weak point right now. > > Fortunately, you can get pre-built svn clients for many platforms > (http://subver

"unknown protocol" error in httplib using HTTPS

2005-04-05 Thread Robert
did you solve this problem? It seems to be still present here with py2.3.5. Robert -- From: Manish Jethani <[EMAIL PROTECTED]> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.p

Re: unittest vs py.test?

2005-04-05 Thread Michael Hudson
Peter Hansen <[EMAIL PROTECTED]> writes: > Raymond Hettinger wrote: > > [Peter Hansen] > > > >>This is pretty, but I *want* my tests to be contained > >>in separate functions or methods. > > In py.test, those would read: > > def test1(): > > assert a == b > > def test2(): > > raises(Error

Re: IronPython 0.7 released!

2005-04-05 Thread Thomas Gagne
Does the Python community think Microsoft's embrace is a good or bad thing? James wrote: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 -- http://mail.python.org/mailman/listinfo/python-list

cross platform printing

2005-04-05 Thread David Isaac
"Alan Isaac" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd like to try personal financial management using Python. > I just found PyCheckbook, but it does not support check printing. > Is there a Python check printing application kicking around? OK, I'll assume silence means "

Re: pagecrawling websites with Python

2005-04-05 Thread writeson
Swaroop, Thanks for the reply, I'll take a look at HarvestMan and see if we can use it directly, or get some ideas from the source code. :) Doug -- http://mail.python.org/mailman/listinfo/python-list

Re: change extensions

2005-04-05 Thread Peter Hansen
Bob Then wrote: how can i change all files from one extension to another within a direcory? Using Jason Orendorff's path.py module: # change all .py files in '.' to extension .new from path import path for f in path('.').files(): if f.endswith('.py'): f.rename(f.splitext()[0] + '.new')

Python & MySQL

2005-04-05 Thread [EMAIL PROTECTED]
Hi all, I've got a weird problem. I was running Python 2.3 and MySQLdb and had everything running fine. Cutting to the chase: After upgrading to 2.4 (and latest modules) the MySQLdb functions in Python can connect to the database, do queries and do inserts. Or rather, it seems to do inserts. I

RE: change extensions

2005-04-05 Thread Jeffrey Maitland
That approach works, but so does this one. import os, glob input_file_list = glob.glob('*.txt') for in_file in input_file_list: name = in_file.split('.') os.rename(in_file, str(name[0]) + '.' + 'text')) # I could have put the text extension with the period but if you use a variable (st

authentication in zope server & Python

2005-04-05 Thread Raghul
Hi I am trying to execute a sample python script using zope server.The problem is I need to execute a python script in the linux machine. When I call that function through the zope server,It shows me the error regarding authentication that is 'access denied for myfunction' In my function jus

Re: unittest vs py.test?

2005-04-05 Thread Peter Hansen
Michael Hudson wrote: Peter Hansen <[EMAIL PROTECTED]> writes: Where was all that weight that unittest supposedly has? For PyPy we wanted to do some things that the designers of unittest obviously hadn't expected[1], such as formatting tracebacks differently. This was pretty tedious to do[2], I'd

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread Brian van den Broek
rbt said unto the world upon 2005-04-05 08:39: Martin v. Löwis wrote: Of course, it is not all that clear what the OP actually wanted. For all we know, he wanted to "alternate quickly (with batch file or similary) between python23 and python24"... Maybe off-topic for this thread, but I noticed tha

Re: change extensions

2005-04-05 Thread Bill Mill
On Apr 5, 2005 10:43 AM, Jeffrey Maitland <[EMAIL PROTECTED]> wrote: > That approach works, but so does this one. > > import os, glob > > input_file_list = glob.glob('*.txt') > for in_file in input_file_list: > name = in_file.split('.') > os.rename(in_file, str(name[0]) + '.' + 'text')) >

Re: Python & MySQL

2005-04-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi all, I've got a weird problem. I was running Python 2.3 and MySQLdb and had everything running fine. Cutting to the chase: After upgrading to 2.4 (and latest modules) the MySQLdb functions in Python can connect to the database, do queries and do inserts. Or rather, it s

Re: Python & MySQL

2005-04-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi all, I've got a weird problem. I was running Python 2.3 and MySQLdb and had everything running fine. Cutting to the chase: After upgrading to 2.4 (and latest modules) the MySQLdb functions in Python can connect to the database, do queries and do inserts. Or rather, it s

Re: Insert database rows from CSV file

2005-04-05 Thread 3c273
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 4 Apr 2005 15:54:37 -0700, "3c273" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > Thanks for the link, but this is the step I am trying to save (for someone > > else). Every time he

Re: Insert database rows from CSV file

2005-04-05 Thread 3c273
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dennis Lee Bieber wrote: > > On Mon, 4 Apr 2005 15:54:37 -0700, "3c273" <[EMAIL PROTECTED]> declaimed > > the following in comp.lang.python: > > > > > >>Thanks for the link, but this is the step I am trying to save (for s

Re: check interpreter version before running script

2005-04-05 Thread djo
Josef Meile wrote: What's about: >>> import sys >>> print sys.version_info (2, 1, 3, 'final', 0) Python 1.5.2 (#1, Mar 3 2001, 01:35:43) [GCC 2.96 2731 (Red Hat Linux 7.1 2 on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import sys >>> sys.version_info Trace

Re: Python Google Server

2005-04-05 Thread vegetax
Fuzzyman wrote: > Add the follwoing two lines to the start of the code : > > import urllib2 > txheaders = { 'User-agent' : 'Mozilla/4.0 (compatible; MSIE 6.0; > Windows NT 5.1; SV1; .NET CLR 1.1.4322)' } > > Then change the start of the send_head method to this : > > def send_head(self): >

Real ython Poetry [was: Re: boring the reader to death...]

2005-04-05 Thread Steve Holden
Scott David Daniels wrote: Sunnan wrote: ...Because what is "boring"? The opposite of dense, tense, intense. Utterly predictable; it's like the combination of all my prejudices. Even before I knew, I thought "Bet Python separates statements from expressions". Python is for terse, pithy prose; P

Re: Python Google Server

2005-04-05 Thread Fuzzyman
Of course - sorry. Thanks for the fix. Out of interest - why are you using this... just for curiosity, or is it helpful ? Regards, Fuzzy http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list

Re: Web application toolkit recommendation?

2005-04-05 Thread PA
On Apr 05, 2005, at 02:01, Stewart Midwinter wrote: I don't want to hear anything about Zope - it's way too complex for my needs or desires. Other than that, fire away! I have an inexplicable attraction to CherryPy. Perhaps something to do with its name 8^) http://www.cherrypy.org/ http://www.che

Re: re module non-greedy matches broken

2005-04-05 Thread Fredrik Lundh
"lothar" wrote: > with respect to the documentation, the module is broken. nope. > the module does not necessarily deliver a "minimal length" match for a > non-greedy pattern. it isn't supposed to: a regular expression describes a *set* of matching strings, and the engine is free to return any

Re: Change between Python 2.3 and 2.4 under WinXP

2005-04-05 Thread Fredrik Lundh
"Martin v. Löwis" wrote: >> I'm not aware of any other tool that solves that specific problem. > > notepad does a fine job at creating batch files, IMO. have you used exemaker? have you compared the behaviour of the resulting executables to batch files using different environments, shells, and O

regexp weirdness (bug?)

2005-04-05 Thread Sergey Schetinin
Here's the session log: >>> _re_pair="(?(plus).|-)" >>> _re1=("(?P\+)"+_re_pair) >>> _re2=("((?P\+))"+_re_pair) >>> _re3=("(?:(?P\+))"+_re_pair) >>> _re4="(%s)"%_re3 >>> import re >>> print [re.match(_re, "+a") and 'match' for _re in [_re1, _re2, _re3, _re4]] ['match', None, 'match', None] this i

Re: Python Google Server

2005-04-05 Thread Paul Rubin
[EMAIL PROTECTED] writes: > (This is actually an 'inventive' short term measure to get round a > restrictive internet policy at work :-) If that means what I think, you're better off setting up a url-rewriting proxy server on some other machine, that uses SSL on the browser side. There's one wri

Re: Python & MySQL

2005-04-05 Thread [EMAIL PROTECTED]
Okay, I had the brilliant idea right after posting to google the newsgroups on this. db = MySQLdb.connect(user=database_user,passwd=database_password) db.autocommit(True) <--- One little line! There ya go. Works like a champ. I swear I was pulling my hair out yesterday over this. -- http

Re: Python Google Server

2005-04-05 Thread Fuzzyman
Note - there are a couple of *minor* chanegs to this. See the online python cookbok, the thread on comp.lang.python or http://www.voidspace.org.uk/python/weblog/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

Re: terminating an inactive process

2005-04-05 Thread fred.dixon
if you have pywin32 then check out a download from MS download called script-o-matic2. it will write some boilerplate code that is usefull for killing processes. its wmi based but works nicely. i have a script that i run on my home computer if you want a sample. -- http://mail.python.org/mailma

Re: Python Google Server

2005-04-05 Thread Fuzzyman
The difficulty is 'on some other machine'... there's a fantastic python CGI proxy called approx - http://www.voidspace.org.uk/python/cgi.shtml#approx The trouble is the current policy is 'whitelist only'... so I need the proxy installed on a server that is *on the whitelist*... which will take a l

os.path query functions behavior incorrect?

2005-04-05 Thread Beman Dawes
The docs for os.path.exists(), isdir(), and the like, do not describe behavior when an I/O error occurs. Testing on Windows XP SP2 with Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32, on a machine with no a: drive, c: is a hard disk with a top level directory nam

Re: re module non-greedy matches broken

2005-04-05 Thread lothar
a non-greedy match - as implicitly defined in the documentation - is a match in which there is no proper substring in the return which could also match the regex. you are skirting the issue as to why a matcher should not be able to return a non-greedy match. there is no theoretical reason why it

Re: re module non-greedy matches broken

2005-04-05 Thread lothar
give an re to find every innermost "table" element: innertabdoc = """ n y z """ give an re to find every "pre" element directly followed by an "a" element: preadoc = """ a r n l y r f g z m b u c v u """ "John Ridley" <[EMAIL

Re: regexp weirdness (bug?)

2005-04-05 Thread Andrà Malo
* Sergey Schetinin wrote: > Here's the session log: > _re_pair="(?(plus).|-)" _re1=("(?P\+)"+_re_pair) _re2=("((?P\+))"+_re_pair) _re3=("(?:(?P\+))"+_re_pair) _re4="(%s)"%_re3 import re print [re.match(_re, "+a") and 'match' for _re in [_re1, _re2, > _re3, _re4]

Re: re module non-greedy matches broken

2005-04-05 Thread lothar
a non-greedy match is implicitly defined in the documentation to be one such that there is no proper substring in the return which could also match the regex. the documentation implies the module will return a non-greedy match. the module does not return a non-greedy match. "Fredrik Lundh" <[EM

Re: re module non-greedy matches broken

2005-04-05 Thread Andrà Malo
* lothar wrote: > a non-greedy match - as implicitly defined in the documentation - is a > match in which there is no proper substring in the return which could also > match the regex. Your argumentation is starting at the wrong place. The documentation doesn't define the bahviour, it tries to de

Re: check interpreter version before running script

2005-04-05 Thread Fredrik Lundh
"rbt" <[EMAIL PROTECTED]> wrote: > Is there a recommended or 'Best Practices' way of checking the version of > python before running > scripts? I have scripts that use the os.walk() feature (introduced in 2.3) > and users running 2.2 > who get errors. Instead of telling them, 'Upgrade you Pyth

Re: regexp weirdness (bug?)

2005-04-05 Thread Fredrik Lundh
André Malo wrote: > No, I suppose they shouldn't compile. > _re_pair should be (?P=plus). the (?(NAME)RE|RE) form was added in 2.4. looks like a bug to me; the "plus" group is set to "+" in all four cases, so the final pattern should match. but I might be missing something... -- http://m

Re: re module non-greedy matches broken

2005-04-05 Thread Georg Brandl
lothar wrote: > give an re to find every innermost "table" element: > > innertabdoc = """ > > > >n > > > > > > > > > >y z > > > > > > > > > > > > > """ REs are Regular Expressions, not parsers. There are problems for which there is no RE

Reminder: Vanouver Python Meeting Tonight

2005-04-05 Thread Paul Prescod
DateTime: April 5, 2005, 7:00 PM Place: http://www.vanpyz.org/ActiveState Topic: Python Quirks, Warts and Complaints Nothing is perfect: even Python. This meeting will be an opportunity for Python programmers to get together and learn from each other. We'll go through issues we've run into and th

  1   2   >