Re: DOS, UNIX and tabs

2006-12-29 Thread Tim Roberts
"Ben" <[EMAIL PROTECTED]> wrote: > >Great - that worked.Thanks! >Is that a general method in linux you can always use to redirect >standard output to a file? Works in Windows, too. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-

Re: File write() problem

2006-12-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote: >Alright, I realize this is probably very basic to be posted on this >newsgroup but I cannot figure out what is causing my problem. Here is >the code I am using below: > >from getpass import getpass > >configfile = file('config.txt', 'w') >serverPassword = configfile.readl

Re: No way to set a timeout in "urllib".

2006-12-29 Thread John Nagle
[EMAIL PROTECTED] wrote: > John> There's no way to set a timeout if you use "urllib" to open a URL. > John> "HTTP", which "urllib" uses, supports this, but the functionality > John> is lost at the "urllib" level. > > John> It's not available via "class URLopener" or "FancyURLop

Re: Easiest way to print from XP/DOS.

2006-12-29 Thread Tom Plunket
jim-on-linux wrote: > When the client runs the utility program the > output file is built but nothing prints and no > messages appear. If the file has a '.txt' extension, you could try os.system'ing "start ", which'll make the file pop open with notepad (or whatever happens to be associated wi

Re: Can I beat perl at grep-like processing speed?

2006-12-29 Thread Nick Craig-Wood
js <[EMAIL PROTECTED]> wrote: > Just my curiosity. > Can python beats perl at speed of grep-like processing? > > $ wget http://www.gutenberg.org/files/7999/7999-h.zip > $ unzip 7999-h.zip > $ cd 7999-h > $ cat *.htm > bigfile > $ du -h bigfile > du -h bigfile > 8.2M bigfile > > #!/usr/l

Re: Managing a queue of subprocesses?

2006-12-29 Thread Tom Plunket
cypher543 wrote: > self.buildPID = subprocess.Popen(buildCmd, stdout = subprocess.PIPE, stderr = > subprocess.STDOUT) Instead of calling it self.buildPID, you might just call it self.buildProcess or something. It's actually a Popen object that gets returned. So yes you can do what you want: _

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread xscottg
Paddy3118 wrote: > This month there was/is a 1000+ long thread called: > "merits of Lisp vs Python" > In comp.lang.lisp. > > If you followed even parts of the thread, AND previously > used only one of the languages AND (and this is the > crucial bit), were persuaded to have a more positive view >

Re: Starting a child process and getting its stdout?

2006-12-29 Thread Tom Plunket
Gabriel Genellina wrote: > Did you *actually* tried what Tom Plunket posted? Two tiny chars make > a difference. The sad irony is that before taking off for vacation I was struggling at work with the same problem in some sense. I couldn't figure out why for some processes I got all of the outpu

Re: textwrap.dedent replaces tabs?

2006-12-29 Thread Tom Plunket
OKB (not okblacke) wrote: > > (You dedent common leading tabs, except if preceded by common leading > > spaces (?)). > > There cannot be common leading tabs if they are preceded by > anything. If they were preceded by something, they wouldn't be > "leading". Right, but 'common leading w

Weekly Python Patch/Bug Summary

2006-12-29 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 413 open ( -7) / 3521 closed (+11) / 3934 total ( +4) Bugs: 946 open ( +2) / 6400 closed ( +9) / 7346 total (+11) RFE : 248 open ( -1) / 246 closed ( +1) / 494 total ( +0) New / Reopened Patches __ Auto-comp

Re: Starting a child process and getting its stdout?

2006-12-29 Thread Gabriel Genellina
At Friday 29/12/2006 12:22, cypher543 wrote: Thank you for the examples, but I have tried all of that before. No matter what I do, my program always hangs while it waits for the process to exit and then it prints all of the output at once. I've tried read(), readline(), readlines(), communicate(

Re: I want to see all the variables

2006-12-29 Thread Gabriel Genellina
At Friday 29/12/2006 13:17, Steven D'Aprano wrote: >>> X.__dict__ {'__module__': '__main__', '__doc__': None} >>> X.__name__ 'X' >>> X.__bases__ () Now that's interesting... if __name__ and __bases__ don't live in the class __dict__, where do they live? What other methods and attributes are inv

Re: Help with small program

2006-12-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote: > >Interesting impl in Python! I am wondering what if the requirement is >to find the minimum number of coins which added to the "fin" sum... Given the set of coins in the original problem (100, 10, 5, 1, 0.5), the solution it provides will always be optimal. Even if we c

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Kaz Kylheku
Steven Haflich wrote: > Ray wrote: > > Can one really survive knowing just > > one language these days, anyway? > > いいえ! 違います。 iie! chigaimas. No, I beg to differ! (Hey, I'm in right the middle of preparing my Kanji-drilling Lisp program for distribution). -- http://mail.python.org/mailman/lis

Re: DOS, UNIX and tabs

2006-12-29 Thread Paul McNett
Steven D'Aprano wrote: > But I think we all agree that mixing tabs and spaces is A Very Bad Thing. I like mixing tabs and spaces, actually. Tabs for indentation, and additional spaces to make the code "look pretty". Somebody please tell me why this is bad and I'll stop. class Apple(object):

Re: probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Carl Banks
Stef Mientki wrote: > Does anyone know the equivalent of the MatLab "diff" function. > The "diff" functions calculates the difference between 2 succeeding > elements of an array. > I need to detect (fast) the falling edge of a binary signal. Using numpy (or predecessors), you can do this easily wi

Re: Wow, Python much faster than MatLab

2006-12-29 Thread Beliavsky
Stef Mientki wrote: > hi All, > > instead of questions, > my first success story: > > I converted my first MatLab algorithm into Python (using SciPy), > and it not only works perfectly, > but also runs much faster: > > MatLab: 14 msec > Python: 2 msec For times this small, I wonder if timing com

Re: No way to set a timeout in "urllib".

2006-12-29 Thread skip
John> There's no way to set a timeout if you use "urllib" to open a URL. John> "HTTP", which "urllib" uses, supports this, but the functionality John> is lost at the "urllib" level. John> It's not available via "class URLopener" or "FancyURLopener", John> either.

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Steven Haflich
Ray wrote: > Can one really survive knowing just > one language these days, anyway? いいえ! 違います。 -- http://mail.python.org/mailman/listinfo/python-list

Re: textwrap.dedent replaces tabs?

2006-12-29 Thread OKB (not okblacke)
Frederic Rentsch wrote: > (You dedent common leading tabs, except if preceded by common leading > spaces (?)). There cannot be common leading tabs if they are preceded by anything. If they were preceded by something, they wouldn't be "leading". -- --OKB (not okblacke) Brendan Barnwell

Managing a queue of subprocesses?

2006-12-29 Thread cypher543
My app uses a "queue" of commands which are run one at a time. I am using the subprocess module to execute the commands in the queue. However, processes always run at the same time. How can I make one process run at a time, and then execute the next process when the first has terminated? My code is

Re: Question about the "new" module

2006-12-29 Thread Graham Dumpleton
[EMAIL PROTECTED] wrote: > Gabriele> I'm using Python 2.5 to develop a simple MVC framework based > Gabriele> on mod_python. To load my controllers, I create new modules > Gabriele> using the "new" module like this: > > Gabriele> # > Gabriele> my_module = new.module("random_na

Re: PEP 3107 Function Annotations for review and comment

2006-12-29 Thread Tony Lownds
On Dec 29, 2006, at 4:09 PM, BJörn Lindqvist wrote: I think this rationale is very lacking and to weak for such a big change to Python. I definitely like to see it expanded. The reference links to two small libraries implementing type checking using decorators and doc strings. None of which to

Re: bad marshal data in site.py in fresh 2.5 install win

2006-12-29 Thread Martin v. Löwis
TiNo schrieb: > # G:\Python25\lib\encodings\aliases.pyc matches [...] > File "F:\Python25\lib\encodings\__init__.py", line 32, in > > What can I do about this? Where does F:\Python25 come from? If you have set any PYTHON* environment variables (e.g. PYTHONPATH), unset them. Regards, Martin --

Re: Minor problem with configure (2.4.4)

2006-12-29 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > configure.in:273: error: possibly undefined macro: AC_UNDEFINE > If this token and others are legitimate, please use > m4_pattern_allow. > See the Autoconf documentation. > > Ideas? RTFM (autoconf documentation, in this case). There is no AC_UNDEFINE. Reg

Re: xml bug?

2006-12-29 Thread Martin v. Löwis
Imbaud Pierre schrieb: > But python.org was the right entry point, it sent me to the bug > tracker: http://sourceforge.net/tracker/?group_id=5470&atid=105470 > Its a bit short on explanations... And I found unsolved issues, > 3 years old! That's true, and likely to grow. Contributions are welcome!

Re: xml bug?

2006-12-29 Thread Martin v. Löwis
Imbaud Pierre schrieb: > - how do I spot the version of a given library? There is a __version__ > attribute of the module, is that it? Contrary to what others have said: for modules included in the standard library (and if using these modules, rather than using PyXML), you should use sys.version

Re: per interpreter storage for C extensions

2006-12-29 Thread Martin v. Löwis
Robin Becker schrieb: > Is there a simple/cheap way for C code to cache these sorts of module > level globals on a per interpreter basis? Is there even a way to tell > which interpreter I'm being called in? There is no cheap way to add to the interpreter state. As Chris Mellon explains, you can us

Re: Why does Python never add itself to the Windows path?

2006-12-29 Thread Martin v. Löwis
Ben Sizer schrieb: > I've installed several different versions of Python across several > different versions of MS Windows, and not a single time was the Python > directory or the Scripts subdirectory added to the PATH environment > variable. Every time, I've had to go through and add this by hand,

Re: PEP 3107 Function Annotations for review and comment

2006-12-29 Thread BJörn Lindqvist
On 12/29/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > Rationale > = > > Because Python's 2.x series lacks a standard way of annotating a > function's parameters and return values (e.g., with information about > what type a function's return value should be), a variety of tools > and librari

Re: Easiest way to print from XP/DOS.

2006-12-29 Thread jim-on-linux
Did you run from a file or type in from keyboard? When the client runs the utility program the output file is built but nothing prints and no messages appear. When I typed from keyboard on an xp pro at c:\, I got the message. Is it possible that virus detector or some self.defense software

mmmmmmmmmmm

2006-12-29 Thread Janez ROM
-- http://mail.python.org/mailman/listinfo/python-list

PEP 3107 Function Annotations for review and comment

2006-12-29 Thread Tony Lownds
(Note: PEPs in the 3xxx number range are intended for Python 3000) PEP: 3107 Title: Function Annotations Version: $Revision: 53169 $ Last-Modified: $Date: 2006-12-27 20:59:16 -0800 (Wed, 27 Dec 2006) $ Author: Collin Winter <[EMAIL PROTECTED]>, Tony Lownds <[EMAIL PROTECTED]> Status: Draf

Re: Easiest way to print from XP/DOS.

2006-12-29 Thread Larry Bates
jim-on-linux wrote: > > This is the situation I'm in. > > I've built a single file utility using py2exe. I > zip the dist directory and send it to the client. > > For clients that use win95, win98 machines, > They unpack the zip file and run the exe. > > The utility creates a text file that i

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 12:04:11 -0800, johnf wrote: > Ok then how do debug when I have something like "__source" and I need to > know what is available for the object? Outside of a class, objects with two leading underscores are just ordinary objects with no special behaviour: >>> __source = 2 >>>

Easiest way to print from XP/DOS.

2006-12-29 Thread jim-on-linux
This is the situation I'm in. I've built a single file utility using py2exe. I zip the dist directory and send it to the client. For clients that use win95, win98 machines, They unpack the zip file and run the exe. The utility creates a text file that is sent to the printer with the stateme

Wow, Python much faster than MatLab

2006-12-29 Thread Stef Mientki
hi All, instead of questions, my first success story: I converted my first MatLab algorithm into Python (using SciPy), and it not only works perfectly, but also runs much faster: MatLab: 14 msec Python: 2 msec After taking the first difficult steps into Python, all kind of small problems as yo

No way to set a timeout in "urllib".

2006-12-29 Thread John Nagle
There's no way to set a timeout if you use "urllib" to open a URL. "HTTP", which "urllib" uses, supports this, but the functionality is lost at the "urllib" level. It's not available via "class URLopener" or "FancyURLopener", either. There is a non-thread-safe workaround from 2003 at

Re: Python-list Digest, Vol 39, Issue 465

2006-12-29 Thread Chris Mellon
On 12/29/06, Ray Schumacher <[EMAIL PROTECTED]> wrote: > > At 10:50 AM 12/29/2006, you wrote: > > In addition to what Chris said, is there a reason why you're reinventing > the wheel instead of using available components? > Hi Carsten, > The eventual goal here is towards a streaming two-way ser

Re: Python-list Digest, Vol 39, Issue 465

2006-12-29 Thread Ray Schumacher
At 10:50 AM 12/29/2006, you wrote: In addition to what Chris said, is there a reason why you're reinventing the wheel instead of using available components? Hi Carsten, The eventual goal here is towards a streaming two-way server, which wouldn't use the http, but something more like RTP/RTCP/H.3

Re: probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Marcus Goldfish
On 12/29/06, Stef Mientki <[EMAIL PROTECTED]> wrote: Does anyone know the equivalent of the MatLab "diff" function. The "diff" functions calculates the difference between 2 succeeding elements of an array. I need to detect (fast) the falling edge of a binary signal. There's derivate function in

Re: I want to see all the variables

2006-12-29 Thread johnf
Steven D'Aprano wrote: > On Fri, 29 Dec 2006 08:20:22 -0600, Larry Bates wrote: > >> johnf wrote: >>> Hi, >>> When I use dir() I don't see the __ underscore items. Is there anything >>> that will show all the private vars and functions? >>> >>> johnf >> >> The idea of the underscore items is t

Re: Simplest way to do Python/Ajax with server and client on same machine?

2006-12-29 Thread John J. Lee
Adonis Vargas <[EMAIL PROTECTED]> writes: > Kenneth McDonald wrote: > > I'm doing some work with a Python program that works hand-in-hand > > with the DOM on a local client (processing DOM events, issuing DOM > > modification commands, etc.) I'm currently using cherrypy as the > > Python server fo

Re: Starting a child process and getting its stdout?

2006-12-29 Thread Tom Plunket
cypher543 wrote: > Thank you for the examples, but I have tried all of that before. Did you try my example specifically? > No matter what I do, my program always hangs while it waits for the > process to exit and then it prints all of the output at once. > > self.buildPID = subprocess.Popen(["p

Help on installing Easy_Install

2006-12-29 Thread TiNo
Hi, I'm having problems installing easy_install. When I run python ez_setup.py I get: G:\python>python ez_setup.py 'import site' failed; use -v for traceback Downloading http://cheeseshop.python.org/packages/2.5/s/setuptools/setuptools-0. 6c3-py2.5.egg Processing setuptools-0.6c3-py2.5.egg Copyin

Re: Getting VideoCapture to work with Python 2.5

2006-12-29 Thread Carsten Haese
On Fri, 2006-12-29 at 19:15 +, Just Another Victim of the Ambient Morality wrote: > I can't seem to get VideoCapture (http://videocapture.sourceforge.net/) > to work with my version of Python (2.5). Why is that? I've followed the > instructions which made it look easy but, as it happens

bad marshal data in site.py in fresh 2.5 install win

2006-12-29 Thread TiNo
Hi, I have installed python two days ago on a USB memory stick (I am on the move and have no laptop.) I am on windows computers, mostly XP, all the time. Now, after pluging it in to a different computer, I get the following message when I run pyhthon: 'import site' failed; use -v for traceback p

Getting VideoCapture to work with Python 2.5

2006-12-29 Thread Just Another Victim of the Ambient Morality
I can't seem to get VideoCapture (http://videocapture.sourceforge.net/) to work with my version of Python (2.5). Why is that? I've followed the instructions which made it look easy but, as it happens all too often, it simply doesn't work. The error I get is that the .py interface file can

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Carl Banks
Paddy wrote: > Carl Banks wrote: > > If you were so keen on avoiding a flame war, the first thing you should > > have done is to not cross-post this. > > I want to cover Pythonistas looking at Lisp and Lispers looking at > Python because of the thread. The cross posting is not as flame bait. Then

Re: A stupid question

2006-12-29 Thread Matimus
[EMAIL PROTECTED] wrote: > Any other ideas? Well, you could always try downloading and installing python: http://www.python.org. It is completely free. It won't run anything in the task bar or add itself to the startup menu and it doesn't have ads... it just sits there waiting for you to use it. I

Re: db access

2006-12-29 Thread vasudevram
king kikapu wrote: > On Dec 29, 12:12 am, johnf <[EMAIL PROTECTED]> wrote: > > king kikapu wrote: > > > Hi to all, > > > > > is there a way to use an RDBMS (in my case, SQL Server) from Python by > > > using some built-in module of the language (v. 2.5) and through ODBC ?? > > > I saw some samples

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Kaz Kylheku
Paddy wrote: > Carl Banks wrote: > > If you were so keen on avoiding a flame war, the first thing you should > > have done is to not cross-post this. > > I want to cover Pythonistas looking at Lisp and Lispers looking at That's already covered in the orginal thread. Same two newsgroups, same crowd

Re: Minor problem with configure (2.4.4)

2006-12-29 Thread MRAB
[EMAIL PROTECTED] wrote: > configure expands > AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from > IEEE Stds 1003.1-2001) > > to > > #define _POSIX_C_SOURCE 200112L > > that causes problems because _POSIX_C_SOURCE is defined by system > headers and I get hideous > warnings dur

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Aahz
[x-post removed] In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: >> >> If you were so keen on avoiding a flame war, the first thing you should >> have done is to not cross-post this. > >I want to cover Pythonistas looking at Lisp and Lispers looking at >Python b

Looking for python SIP/MGCP stacks

2006-12-29 Thread Jenny Zhao (zhzhao)
Hi Python users, I am using python to write a testing tools, currently this tool only supports skinny protocol. I am planning to add SIP and MGCP support as well, wondering if you have written these protocol stacks before which can be leveraged from. thanks Jenny -- http://mail.python.org/m

Re: I want to see all the variables

2006-12-29 Thread [EMAIL PROTECTED]
On Dec 29, 5:17 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 29 Dec 2006 07:57:30 -0800, [EMAIL PROTECTED] wrote: > > What do you mean? Can you specify which special functions you don't > > see? > > I get: > > py> class X: > >pass > > py> dir(X) > > ['__doc__', '__module__']How ab

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 08:20:22 -0600, Larry Bates wrote: > johnf wrote: >> Hi, >> When I use dir() I don't see the __ underscore items. Is there anything >> that will show all the private vars and functions? >> >> johnf > > The idea of the underscore items is that they aren't to be used by > you.

Re: I want to see all the variables

2006-12-29 Thread Steven D'Aprano
On Fri, 29 Dec 2006 07:57:30 -0800, [EMAIL PROTECTED] wrote: > What do you mean? Can you specify which special functions you don't > see? > I get: > py> class X: > pass > py> dir(X) > ['__doc__', '__module__'] How about these? >>> X.__dict__ {'__module__': '__main__', '__doc__': None} >>>

Re: Can I beat perl at grep-like processing speed?

2006-12-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Tim Smith wrote: > also, if you replace the regex with a test like lambda x: > x.lower().find("destroy") != -1, you will get really close to the speed > of perl's Testing for ``'destroy' in x.lower()`` should even be a little bit faster. Ciao, Marc 'BlackJack' Rin

Re: how to serve image files without disk use?

2006-12-29 Thread Carsten Haese
On Fri, 2006-12-29 at 09:30 -0600, Chris Mellon wrote: > On 12/28/06, Ray Schumacher <[EMAIL PROTECTED]> wrote: > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > s.bind((HOST, PORT)) > > s.listen(1) > > conn, addr = s.accept() > > while 1: > > data = conn.recv(1024) > > if dat

Re: Python Wrapper for C# Com Object

2006-12-29 Thread TheSeeker
Hi, A question. Why in your C-version are your doing: X_com_ptr->SetID(10); and in the Python version: interface.SetID() ? I don't know anything of your COM object, but does SetID require a parameter? Duane [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] skrev: > > > [EMAIL PROTECTED] skrev:

Re: I want to see all the variables

2006-12-29 Thread [EMAIL PROTECTED]
What do you mean? Can you specify which special functions you don't see? I get: py> class X: pass py> dir(X) ['__doc__', '__module__'] py> class X: def __getitem__(self, x): pass py> dir(X) ['__doc__', '__getitem__', '__module__'] On Dec 29, 12:35 pm, johnf <[EMAI

Re: Can I beat perl at grep-like processing speed?

2006-12-29 Thread Tim Smith
you may not be able to beat perl's regex speed, but you can take some steps to speed up your python program using map and filter here's a modified python program that will do your search faster #!/usr/bin/env python import re r = re.compile(r'destroy', re.IGNORECASE) def stripit(x): return

Re: Some basic newbie questions...

2006-12-29 Thread Daniel Klein
On 28 Dec 2006 08:40:02 -0800, "jonathan.beckett" <[EMAIL PROTECTED]> wrote: >Hi all, > >Question 2... >What is the correct way of looping through a list object in a class via >a method of it? Without peeking at any of the other responses, here is what I came up with. I hope it helps... class G

Re: Convert Perl to Python

2006-12-29 Thread Nick Craig-Wood
Emilio Sañudo <[EMAIL PROTECTED]> wrote: > ?? wrote: > > How can I convert a perl script to Python? > > > http://www.crazy-compilers.com/bridgekeeper/ Very interesting until this bit :- The bad news: Unfortunatly, there is no way to 'try out' bridgekeeper. It's simply not avail

Re: how to serve image files without disk use?

2006-12-29 Thread Chris Mellon
On 12/28/06, Ray Schumacher <[EMAIL PROTECTED]> wrote: > I'm trying to make a small camera server using VideoCapture.py and > socket. I needed to construct a complete image file with headers etc > for a browser to recognize it, but I couldn't find a combination of > StringIO and wx image methods to

Re: Can I beat perl at grep-like processing speed?

2006-12-29 Thread Christophe Cavalaria
js wrote: > Just my curiosity. > Can python beats perl at speed of grep-like processing? > > > $ wget http://www.gutenberg.org/files/7999/7999-h.zip > $ unzip 7999-h.zip > $ cd 7999-h > $ cat *.htm > bigfile > $ du -h bigfile > du -h bigfile > 8.2M bigfile > > -- grep.pl -- >

Re: Slowdown in Jython

2006-12-29 Thread tac-tics
> Jython is a Java application That was the intellectual leap I needed to solve the problem. I forgot that I have total access to Java memory management. It turns out at the point of slowdown, Java was continually running full GC, causing the awful loss of performance. I figured out that I was not

Re: Starting a child process and getting its stdout?

2006-12-29 Thread cypher543
Thank you for the examples, but I have tried all of that before. No matter what I do, my program always hangs while it waits for the process to exit and then it prints all of the output at once. I've tried read(), readline(), readlines(), communicate(), etc and it is always the same. self.buildPID

Can I beat perl at grep-like processing speed?

2006-12-29 Thread js
Just my curiosity. Can python beats perl at speed of grep-like processing? $ wget http://www.gutenberg.org/files/7999/7999-h.zip $ unzip 7999-h.zip $ cd 7999-h $ cat *.htm > bigfile $ du -h bigfile du -h bigfile 8.2Mbigfile -- grep.pl -- #!/usr/local/bin/perl open(F, 'bigfile

probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Stef Mientki
Does anyone know the equivalent of the MatLab "diff" function. The "diff" functions calculates the difference between 2 succeeding elements of an array. I need to detect (fast) the falling edge of a binary signal. There's derivate function in Python diff, but when you use an binary (true/false) i

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
:-) Ok, point taken! I fixed it in the end. It was nothing interesting at all - just a wayward line of code that was doing exactly what I feared - replacing the database each time rather than just when it was needed. Ben Leo Kislov wrote: > Ask Ben, he might know, although he's out to lunch. >

Re: Python Wrapper for C# Com Object

2006-12-29 Thread bg_ie
[EMAIL PROTECTED] skrev: > [EMAIL PROTECTED] skrev: > > > Hi, > > > > I wish to write a Python wrapper for my C# COM object but am unsure > > where to start. I have a dll and a tlb file, and I can use this object > > in C via the following code - > > > > // ConsolApp.cpp : Defines the entry point

Re: I want to see all the variables

2006-12-29 Thread Larry Bates
johnf wrote: > Hi, > When I use dir() I don't see the __ underscore items. Is there anything > that will show all the private vars and functions? > > johnf The idea of the underscore items is that they aren't to be used by you. If you wish to access private variables and functions you will almo

Re: Some basic newbie questions...

2006-12-29 Thread Duncan Booth
"jonathan.beckett" <[EMAIL PROTECTED]> wrote: > I'm just finding it a bit weird that some of the built in functions are > static, rather than methods of objects (such as len() being used to > find the length of a list). When it comes down to it, its a design decision, so neither right nor wrong

Re: Beginner question on text processing

2006-12-29 Thread skip
Harold> To illustrate, assume I have a text file, call it test.txt, with Harold> the following information: Harold> X11 .32 Harold> X22 .45 Harold> My goal in the python program is to manipulate this file such Harold> that a new file would be created that looks like:

Re: Question about the "new" module

2006-12-29 Thread skip
Gabriele> I'm using Python 2.5 to develop a simple MVC framework based Gabriele> on mod_python. To load my controllers, I create new modules Gabriele> using the "new" module like this: Gabriele> # Gabriele> my_module = new.module("random_name") Gabriele> my_module.__f

Re: popen on windows

2006-12-29 Thread Daniel Klein
On 27 Dec 2006 09:16:53 -0800, "hubritic" <[EMAIL PROTECTED]> wrote: >I am trying to set off commands on Windows 2003 from python. >Specifically, I am trying to use diskpart with a script file (pointed >to with path). > >cmd = ["diskpart", "/s", path] >p = Popen(cmd, shell

Re: Scaling pictures

2006-12-29 Thread cyberco
PIL is certainly a fine option, but I noticed that the scaled images (scaled with the ANTIALIAS filter) are not as good as you can get with, say, Photoshop. Maybe I'm just expecting too much, but I wish I could choose a higher quality rescaling algorithm. PIL still rocks though. On Dec 28, 2:32 pm

Re: A stupid question

2006-12-29 Thread luxnoctis
I knew what everything was for when I uninstalled it, I just didn't happen to know about every component part, apparently. ;) I have tried reinstalling the Bittorrent client, and to no avail. (The computer is a Toshiba Satellite laptop, if that helps anyone.) Any other ideas? Tom Plunket wrote: >

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Leo Kislov
Ask Ben, he might know, although he's out to lunch. Ben wrote: > I'll try it after lunch. Does anyoone know whether this might be the > problem? > > Ben > > > Ben wrote: > > I have found the problem, but not the cause. > > > > I tried setting the database up manually before hand, which let me get

Beginner question on text processing

2006-12-29 Thread Doran, Harold
I am beginning to use python primarily to organize data into formats needed for input into some statistical packages. I do not have much programming experience outside of LaTeX and R, so some of this is a bit new. I am attempting to write a program that reads in a text file that contains some value

Re: Slowdown in Jython

2006-12-29 Thread Kent Johnson
tac-tics wrote: > I have an application written in jython which has to process a number > of records. It runs fine until it gets to about 666 records (and maybe > that's a sign), and then, it's performance and responsiveness goes down > the toilet. It looks like it's running out of memory and is be

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread timw.google
Not sure if this will help, as you said you already tried autocommit, but did you try to commit after creating the table, then doing all the inserts before commiting on disconnect? (I'm no MySQL or Python guru, but I do use it with python and MySQLdb .) -- http://mail.python.org/mailman/listinfo

Question about the "new" module

2006-12-29 Thread Gabriele *darkbard* Farina
Hi, I'm using Python 2.5 to develop a simple MVC framework based on mod_python. To load my controllers, I create new modules using the "new" module like this: # my_module = new.module("random_name") my_module.__file__ = module_path exec open(module_path, "r") in my_module.__dict__ then I i

Re: list looping error

2006-12-29 Thread tkpmep
What you really want to write is for i in x: for j in i: print j The outer loop iterates over the tuples in the list, while the inner loop iterates over the elements of each tuple. So j (in your example) is always an integer, and is therefore unsubscriptable, which is exactly what the

Re: textwrap.dedent replaces tabs?

2006-12-29 Thread Frederic Rentsch
Tom Plunket wrote: > Frederic Rentsch wrote: > > >> Your rules seem incomplete. >> > > Not my rules, the stated documentation for dedent. "My" understanding > of them may not be equivalent to yours, however. It's not about understanding, It's about the objective. Let us consider the diffe

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
Perhaps when I'm checking for table existance using mysql through python I have to be more explicit: Where I did have: USE database; IF NOT EXISTS CREATE table(. Perhaps I need: USE database; IF NOT EXISTS CREATE database.table(. I'll try it after lunch. Does anyoone know whether this mi

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
I have found the problem, but not the cause. I tried setting the database up manually before hand, which let me get rid of the "IF NOT EXISTS" lines, and now it works! But why the *** should it not work anyway? The first time it is run, no database or tables, so it creates them. That works. But a

list looping error

2006-12-29 Thread Gigs_
i have created list x: >>> x = [(12, 22, 11), (13, 22, 33)] and want to print each number in tuple >>> for i in x: for j in i: print j[0] but I get this error. What does it means? Traceback (most recent call last): File "", line 3, in print j[0] T

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
Well, I've checked the SQL log, and my insert statements are certainly being logged. The only option left open is that the table in question is being replaced, but I can't see why it should be... Ben wrote: > Nope... that can't be it. I tried running those commands manually and > nothing went wro

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
Nope... that can't be it. I tried running those commands manually and nothing went wrong. But then again when I execute the problematic command manually nothing goes wrong. Its just not executing until the last time, or being overwritten. Ben wrote: > Each time my script is run, the following is

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
Each time my script is run, the following is called: self.cursor.execute("CREATE DATABASE IF NOT EXISTS "+name) self.cursor.execute("USE "+name) self.cursor.execute("CREATE TABLE IF NOT EXISTS table_name ( The idea being that stuf is only created the first time the script is run, and after t

Re: Scaling pictures

2006-12-29 Thread Kajsa Anka
On Thu, 28 Dec 2006 11:53:41 +0100, Kajsa Anka wrote (in article <[EMAIL PROTECTED]>): Thanks for the answers, I'll use PIL. jem -- http://mail.python.org/mailman/listinfo/python-list

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
One partial explanation might be that for some reason it is recreating the table each time the code runs. My code says "CREATE TABLE IF NOT EXISTS" but if for some reason it is creating it anyway and dropping the one before that could explain why there are missing entires. It wouldn't explain why

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
I initially had it set up so that when I connected to the database I started a transaction, then when I disconnected I commited. I then tried turning autocommit on, but that didn't seem to make any difference (althouh initially I thought it had) I'll go back and see what I can find... Cheers, Ben

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Ben
Ben wrote: > Well that's odd... > > If I place the exact same Insert statement elswhere in the program it > works as intended. > That would suggest it is never being run in its old position, but the > statements either side of it are printing... > > > Ben wrote: > > I don't know whether anyone can

I want to see all the variables

2006-12-29 Thread johnf
Hi, When I use dir() I don't see the __ underscore items. Is there anything that will show all the private vars and functions? johnf -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone persuaded by "merits of Lisp vs Python"?

2006-12-29 Thread Paddy
Carl Banks wrote: > If you were so keen on avoiding a flame war, the first thing you should > have done is to not cross-post this. I want to cover Pythonistas looking at Lisp and Lispers looking at Python because of the thread. The cross posting is not as flame bait. - Paddy. -- http://mail.py

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread johnf
Ben wrote: > I don't know whether anyone can help, but I have an odd problem. I have > a PSP (Spyce) script that makes many calls to populate a database. They > all work without any problem except for one statement. > > I first connect to the database... > > self.con = MySQLdb.connect(user=usern

  1   2   >