Convert Perl to Python

2006-12-28 Thread Χρυσάνθη Αϊναλή
How can I convert a perl script to Python? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

RotatingFileHandler Error

2006-12-28 Thread Roopesh
Hi I am trying to use RotatingFileHandler, in the foll way : rootLogger = logging.getLogger('') rootLogger.setLevel(logging.DEBUG) rotatingHandler = logging.handlers.RotatingFileHandler(self.logobj_path.name,"a", 1000, 10) rotatingHandler.doRollover() rotatingHandler.emit() rootLogger.addHandler(r

Re: A stupid question

2006-12-28 Thread Gabriel Genellina
At Friday 29/12/2006 01:05, [EMAIL PROTECTED] wrote: The specified module could not be found. LoadLibrary(pythondll) failed For the bittorrent client, reinstalling it should be enough. For other issues on your system, best to contact your vendor. -- Gabriel Genellina Softlab SRL

Re: A stupid question

2006-12-28 Thread casevh
[EMAIL PROTECTED] wrote: > It says exactly: > > The specified module could not be found. > LoadLibrary(pythondll) failed > > >I bought a floor model computer, and it came with all sorts of > > >ridiculousness on it that I promptly uninstalled. However, now whenever > > >I start windows I get a me

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

2006-12-28 Thread Carl Banks
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: (PyGTK) Disabling ToolButton when no TreeView item is selected?

2006-12-28 Thread Hendrik van Rooyen
"cypher543" <[EMAIL PROTECTED]> wrote: > I have a TreeView and a ToolButton. The ToolButton should only be > active if the user has selected an item in the TreeView. What signal > should I use to achieve this? you can try using the configure method on the toolbutton in the command that is execu

Re: textwrap.dedent replaces tabs?

2006-12-28 Thread Tom Plunket
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. > What if common tabs remain after stripping common white space? What if we just go with, "[r]emove any whitespace than c

Re: Starting a child process and getting its stdout?

2006-12-28 Thread Adonis Vargas
cypher543 wrote: > This has been driving me insane for the last hour or so. I have search > everywhere, and nothing works. I am trying to use the subprocess module > to run a program and get its output line by line. But, it always waits > for the process to terminate and then return the output all

Starting a child process and getting its stdout?

2006-12-28 Thread cypher543
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But, it always waits for the process to terminate and then return the output all at once. Can someone ple

Re: A stupid question

2006-12-28 Thread luxnoctis
It says exactly: The specified module could not be found. LoadLibrary(pythondll) failed Don't know if that helps at all. Gabriel Genellina wrote: > At Friday 29/12/2006 00:27, [EMAIL PROTECTED] wrote: > > >I bought a floor model computer, and it came with all sorts of > >ridiculousness on it tha

Re: Comparing files in a zip to files on drive

2006-12-28 Thread Yu-Xi Lim
kj7ny wrote: > I am attempting to incrementally back up files using python. How can I > compare a file on a hard drive to a file in a python created zip file > to tell if the file has changed? Or should I be using some other > method to determine if a file has changed? > You can easily determin

Re: A stupid question

2006-12-28 Thread Gabriel Genellina
At Friday 29/12/2006 00:27, [EMAIL PROTECTED] wrote: I bought a floor model computer, and it came with all sorts of ridiculousness on it that I promptly uninstalled. However, now whenever I start windows I get a message saying "LoadLibrary (pythondll ) failed." It also says this when I try to do

Re: A stupid question

2006-12-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hello all. Let me say first that I have no idea what python is or what > it does. > > I bought a floor model computer, and it came with all sorts of > ridiculousness on it that I promptly uninstalled. However, now whenever > I start windows I get a message saying "LoadLi

A stupid question

2006-12-28 Thread luxnoctis
Hello all. Let me say first that I have no idea what python is or what it does. I bought a floor model computer, and it came with all sorts of ridiculousness on it that I promptly uninstalled. However, now whenever I start windows I get a message saying "LoadLibrary (pythondll ) failed." It also s

Re: Comparing files in a zip to files on drive

2006-12-28 Thread Tim Williams
On 28 Dec 2006 18:35:15 -0800, kj7ny <[EMAIL PROTECTED]> wrote: > I am attempting to incrementally back up files using python. How can I > compare a file on a hard drive to a file in a python created zip file > to tell if the file has changed? Or should I be using some other > method to determine

Re: Comparing files in a zip to files on drive

2006-12-28 Thread Justin Ezequiel
kj7ny wrote: > compare a file on a hard drive to a file in a python created zip file > to tell if the file has changed? >>> fileondisk = r'C:\Documents and Settings\power\Desktop\ES3dc+Template.3f' >>> zipondisk = r'C:\Documents and Settings\power\Desktop\temps.zip' >>> import zipfile >>> z = zipf

Comparing files in a zip to files on drive

2006-12-28 Thread kj7ny
I am attempting to incrementally back up files using python. How can I compare a file on a hard drive to a file in a python created zip file to tell if the file has changed? Or should I be using some other method to determine if a file has changed? -- http://mail.python.org/mailman/listinfo/pyt

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

2006-12-28 Thread Paul Hummer
I am rather annoyed at the "apples vs. oranges" arguments I frequently see on Reddit and the like. I picked up python last summer after going through a very messy breakup (it seemed like a good thing to do with all the alone time). Anyway, ever since I started writing python, I've been bugged by

Re: module with a threading-like api that uses processes?

2006-12-28 Thread skip
>> I could have sworn someone was working on a module recently with a >> threading-like API that used subprocesses under the covers, but 10 >> minutes or so of googling didn't yield anything. >> appreciated. Steve> http://www.python.org/dev/summary/2006-10-01_2006-10-15/#proc

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

2006-12-28 Thread Ray
Paddy3118 wrote: > This month there was/is a 1000+ long thread called: > "merits of Lisp vs Python" > In comp.lang.lisp. > (I suspect this thread to be very short - even the > original poster seems to have given up on the day he > started the thread). I use both. And Java, and C++ too. Can on

Re: keypressed() function

2006-12-28 Thread Ravi Teja
[EMAIL PROTECTED] wrote: > I need a function (blocking or non-blocking) that tells me if a key has > been pressed (even before it has been released etc.). Also, I would of > course like to know _which_ key has been pressed. > > I know that this probably does not exist in the Python library already

Re: Reverse of SendKeys??

2006-12-28 Thread Ravi Teja
Scripter47 wrote: > Hey! > > I know there is a module named SendKeys. > SendKeys module it can type strings as you where typing it, on the keyboard. > But is there a module that does the reverse. A module that gets > _anything_ what the keyboard writes. > For example. If i type "hey" on my keyboar

Minor problem with configure (2.4.4)

2006-12-28 Thread sndive
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 during compilation. I tried to fix it by adding

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread WaterWalk
Pyenos wrote: > Approach 1: > > class Class1: > class Class2: > def __init__(self):self.variable="variable" > > class Class3: > def method():print Class1().Class2().variable #problem > > Approach 1.1: > > class Class1: > class

Re: Reverse of SendKeys??

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 15:39, Scripter47 wrote: A module that gets _anything_ what the keyboard writes. You want a "keylogger" -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo q

Re: xml bug?

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 15:58, Imbaud Pierre wrote: The offending part is the one that goes: xmpPLUS='' it triggers an exception: ValueError: too many values to unpack, in _parse_ns_name. Some debugging showed an obvious mistake in the scanning of the name argument, that goes beyond the clos

Re: Slowdown in Jython

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 13:14, 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 runnin

Re: __getattr__ possible loop

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 14:01, Maksim Kasimov wrote: > Nothing so clever. dir() eats and ignores all exceptions, so when you > hit the recursion limit it eats the RecursionLimitExceeded exception > and continues merrily along the way. This is probably not good > behavior... > > class Foo: >de

Re: Generating text files (newbie)

2006-12-28 Thread Gabriel Genellina
At Thursday 28/12/2006 10:59, Doran, Harold wrote: Assume I have a tab-delimited text file called foo.txt organized as follows: x11 -0.04 x22 -0.42 x33 0.3 My goal is to read in this file and use the information therein to output a new file that is organized as follows: x11

how to serve image files without disk use?

2006-12-28 Thread Ray Schumacher
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 avoid disk saves, without PIL. If I save a temp.jpg file t

Re: Reverse of SendKeys??

2006-12-28 Thread Erik Johnson
Aside from the obvious security issues such a program would represent (and your name and signature are curious in that respect as well), you are basically asking for functionality (i.e., a key logger) I believe to be outside what is offered by Python and/or the API of most operating systems. P

Re: problems with socket

2006-12-28 Thread Flávio Ribeiro
any help? dammit :(( 2006/12/27, Flávio Ribeiro <[EMAIL PROTECTED]>: Hi all, I will try to explain my problem, and wait for someone here give me solutions: (sorry for the bad, bad english) I have a server application that talks with another client applications using socket. The problem is

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Steven D'Aprano
On Thu, 28 Dec 2006 09:16:18 -0800, Ben wrote: > Hello... > > I have a dictionary, where each value is a seperate instance of the > same class: > > self.mop_list[record_number]=record(self.mops[:]) Others have already solved the immediate problem, but I'd just like to make a brief comment abou

Re: db access

2006-12-28 Thread johnf
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 that use statements like "import dbi" or "import > odbc" but neither modules (dbi, odbc) are pr

Re: Some basic newbie questions...

2006-12-28 Thread Scott David Daniels
jonathan.beckett wrote: >> ... >>class Battleship(object): >>... >>def getShellsLeft(self): >>numShells = 0 >>for aGun in self.guns: >>numShells += aGun.shells >>return numShells >>... > > Excellent example - once upo

Re: per interpreter storage for C extensions

2006-12-28 Thread Graham Dumpleton
Chris Mellon wrote: > I'm not that familiar with > mod_python but I'm surely each python interpreter is in a different > thread (if not process) than the others. No. In mod_python there can be multiple distinct interpreter instances in each Apache child process. If using a multithreaded Apache M

RE: rsync for python?

2006-12-28 Thread Mark Schoonover
nienfeng wrote: > Hi, everyone > > I want to build rsync server that can run in linux and windows, > and configure by python. So I'm looking for something like rsync for > python. I find rsync.py and pysync. But rsync.py looks like a > client mode, > it can't be a rsync server, is it? Can

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
I'll hope to understand that later on ! You can achieve the > same result without side-effects by returning more than one return value > from your function. > > Hope this helps, Wow this certainly helps, thanks very much Carsten! Why is the obvious sometimes so far away ;-) cheers, Stef Mie

Re: xml bug?

2006-12-28 Thread Imbaud Pierre
Erik Johnson a écrit : > "Imbaud Pierre" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Now my points are: >>- how do I spot the version of a given library? There is a __version__ >> attribute of the module, is that it? > > > Yes, the module maintainer should be incrementing

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes- I can see that my_list and mops, being outside def __init__() > only get created once, hence the confusion. > > Surely def __init__() gets called each time an instance is created > however? But the snag is that if they have

Re: textwrap.dedent replaces tabs?

2006-12-28 Thread Frederic Rentsch
Tom Plunket wrote: > Frederic Rentsch wrote: > > >> It this works, good for you. I can't say I understand your objective. >> (You dedent common leading tabs, except if preceded by common leading >> spaces (?)). >> > > I dedent common leading whitespace, and tabs aren't equivalent to > spa

Re: Hooking any/all 'calls'

2006-12-28 Thread Kevin Little
Thanks, Robert! That was exactly what I was looking for. -k "fumanchu" <[EMAIL PROTECTED]> wrote: >Kevin Little wrote: >> In Python 2.4 or 2.5, what is the easiest way to hook any and all >> callables such that designated code is executed at the very start and >> end of each call? (Yes, I'm t

Re: answers.py v0.0.1 - source

2006-12-28 Thread Pyenos
#!/usr/bin/python # answers.py --- A simple answer-bot. # Copyright 2006 Logan Lee # # RELEASE NOTES: # # - I have fixed an error where the program crashes on query of #+unknown string to answers dictionary. # - Rephrased 'Do you h

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 19:49 +0100, Stef Mientki wrote: > [...] > When I replace the assignment to "filter_prev", by a loop, > the function works as expected. > >#filter_prev = Extended [ len(Signal_IN) : ] >for i in range( len(filter_prev )): > filter_prev[i] = Extended [ len(Signal_I

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Yes- I can see that my_list and mops, being outside def __init__() only get created once, hence the confusion. Surely def __init__() gets called each time an instance is created however? But the snag is that if they have default values set these are shared between all instances, even if they are,

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > class record: > my_list =[] > mops=[] > > def __init__(self,mops): > self.mops=mops Similar to the example I gave, the lists my_list and mops shown above are executed just once: when your

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Ah - I have been very silly indeed! I had not realised that by creating my lists outside of the def__init___() constructor they would always be class rather than instance variables, and so there was only one of them when I referred to it. Thanks to Erik and Chris for your help! Ben Ben wrote:

Re: xml bug?

2006-12-28 Thread Erik Johnson
"Imbaud Pierre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Now my points are: > - how do I spot the version of a given library? There is a __version__ >attribute of the module, is that it? Yes, the module maintainer should be incrementing this version for each new release a

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Ah - ok. In fact I simply had: class record: my_list =[] mops=[] def __init__(self,mops): self.mops=mops Where mops is something I pass in when i create the instance. I had thought that then each time I created an instance of the record class as an element

Re: DOS, UNIX and tabs

2006-12-28 Thread Tom Plunket
Steven D'Aprano wrote: > I don't know what "problems" with tabs you are talking about. I never have > problems with tabs. *Other people* who choose to use software that doesn't > understand tabs have problems. > > I've spent a lot of time reading both sides of the tabs versus spaces > argument, a

xml bug?

2006-12-28 Thread Imbaud Pierre
I am using the standard xml library to create another library able to read, and maybe write, xmp files. Then an xml library bug popped out: xml.dom.minidom was unable to parse an xml file that came from an example provided by an official organism.(http://www.iptc.org/IPTC4XMP) The parsed file was

Re: getting a process's PID

2006-12-28 Thread Tom Plunket
eldorado wrote: > >>> g = os.popen("ps -ef | grep HUB | grep -v grep | awk '{ print $2 }'") > >>> h = g.readlines() > >>> g.close() > >>> h > ['87334\012'] > >>> h = h[:-1] > >>> h > [] > >>> I understand you're probably set, but instead of using readlines() you could also do this: g = os h

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
Carsten Haese wrote: > On Thu, 2006-12-28 at 15:28 +, Paul Hummer wrote: >> You'd have to either pass the variables by reference into the function, [...] > > In Python, all function calls are call by reference. Period. The key > difference between Python and other programming languages is in t

Python 2.4/2.5 hang on bad reference?

2006-12-28 Thread Christian Convey
Has anyone seen the following? I've got a somewhat complicated program that includes pygtk, some C/C++ code, and lots of Python code. My problem is that when some code tries to use a global variable that hasn't yet been created, or tries to invoke a method/function that doesn't exist in anothe

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This seems to work without any errors. But bizzarely I find that > whatever my record number, the instance of "my_class" is appended to > every list. So in this case > > self.mop_list[0].my_list.append(my_class(Some data for th

Reverse of SendKeys??

2006-12-28 Thread Scripter47
Hey! I know there is a module named SendKeys. SendKeys module it can type strings as you where typing it, on the keyboard. But is there a module that does the reverse. A module that gets _anything_ what the keyboard writes. For example. If i type "hey" on my keyboard. Will the program get the st

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
> Too many misconceptions here (I changed to a more PEP-8 style naming): > >class Gun(object): >def __init__(self): >self.shells = 10 > >class Battleship(object): >def __init__(self): >self.guns = [Gun(), Gun()] > >def getShellsLeft(self): >

Re: Some basic newbie questions...

2006-12-28 Thread Scott David Daniels
jonathan.beckett wrote: > Hi all, > > While working on support at work, I have been picking away at Python - > because I think it could be a valuable scripting tool for building > utilities from. I have been reading the python.org tutorials, and > playing around with some basic code, but I have en

New IRC Channel: #moderncalcs

2006-12-28 Thread RadSurfer
IRC Server:Freenode IRC Channel: #moderncalcs Purpose: #moderncalcs created December 2005 is intended as a real-time chat channel for anyone using any model of scientific/graphing/programmable calculator, especially those of modern design. However, any calculator-related topic is acceptable.

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
> > I normally work with PHP, C#, Javascript, and the odd bit of C++, > > Do any of them call functions w/o parens? That's a really good point :) -- http://mail.python.org/mailman/listinfo/python-list

Re: SPAM-LOW: (PyGTK) Disabling ToolButton when no TreeView item is selected?

2006-12-28 Thread Scripter47
cypher543 skrev: > I have a TreeView and a ToolButton. The ToolButton should only be > active if the user has selected an item in the TreeView. What signal > should I use to achieve this? > > Thanks, > David > Hey I use the "curselection()" function. Example: id = self.listbox.curselection() id

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, 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). Well, they actually are methods of objects (at least they are no

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, jonathan.beckett <[EMAIL PROTECTED]> wrote: >> > Given the code below, why does the count method return what it does? >> > How *should* you call the count method? >> > a = [] >> > a.append(1) >> > print a.count >> >> print a.count(). Which will cause an exception, BTW, since

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Hi Grant, thanks for the code snippets - made total sense. On the evidence of the last couple of hours, Python is still feeling very alien, but I'm starting to get my head around it. I'm just finding it a bit weird that some of the built in functions are static, rather than methods of objects (su

dictionary containing instances of classes behaving oddly

2006-12-28 Thread Ben
Hello... I have a dictionary, where each value is a seperate instance of the same class: self.mop_list[record_number]=record(self.mops[:]) In my case I know that record_number takes the values 0,3,and 7 thanks to a loop, giving me three instances of the record class instantiaterd with some data

Re: per interpreter storage for C extensions

2006-12-28 Thread Chris Mellon
On 12/28/06, Robin Becker <[EMAIL PROTECTED]> wrote: > Robin Becker wrote: > > Chris Mellon wrote: > >> On 12/28/06, Robin Becker <[EMAIL PROTECTED]> wrote: > >>> As part of some django usage I need to get some ReportLab C extensions > >>> into a > >>> state where they can be safely used with mod_

Re: keypressed() function

2006-12-28 Thread BJörn Lindqvist
> I know that this probably does not exist in the Python library already > as a platform-independant abstraction (even though it probably could), > but then I would at least like solutions that works on Windows and on > Linux. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 But it

Re: per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
Robin Becker wrote: > Chris Mellon wrote: >> On 12/28/06, Robin Becker <[EMAIL PROTECTED]> wrote: >>> As part of some django usage I need to get some ReportLab C extensions into >>> a >>> state where they can be safely used with mod_python. > . >> Just off the top of my head, I'd think tha

Re: Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Chris Mellon wrote: > On 28 Dec 2006 08:40:02 -0800, jonathan.beckett > <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > While working on support at work, I have been picking away at Python - > > because I think it could be a valuable scripting tool for building > > utilities from. I have been readi

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
Chris Mellon wrote: > > Nothing so clever. dir() eats and ignores all exceptions, so when you > hit the recursion limit it eats the RecursionLimitExceeded exception > and continues merrily along the way. This is probably not good > behavior... > > class Foo: >def __getattr__(self, attr): >

(PyGTK) Disabling ToolButton when no TreeView item is selected?

2006-12-28 Thread cypher543
I have a TreeView and a ToolButton. The ToolButton should only be active if the user has selected an item in the TreeView. What signal should I use to achieve this? Thanks, David -- http://mail.python.org/mailman/listinfo/python-list

Anyone persuaded by "merits of Lisp vs Python"?

2006-12-28 Thread Paddy3118
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 of the other language; (deep bre

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
[EMAIL PROTECTED] wrote: > Maksim Kasimov: >> how to improve the situation depends on what do you expect to get by calling >> "T().method()" > > You are right, sorry for being cryptic. I think that's a kind of bug of > Python (produced maybe by an infinite loop), so an improvement can be a > trac

Re: Some basic newbie questions...

2006-12-28 Thread Chris Mellon
On 28 Dec 2006 08:40:02 -0800, jonathan.beckett <[EMAIL PROTECTED]> wrote: > Hi all, > > While working on support at work, I have been picking away at Python - > because I think it could be a valuable scripting tool for building > utilities from. I have been reading the python.org tutorials, and >

Re: per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
Chris Mellon wrote: > On 12/28/06, Robin Becker <[EMAIL PROTECTED]> wrote: >> As part of some django usage I need to get some ReportLab C extensions into a >> state where they can be safely used with mod_python. . >> > > Just off the top of my head, I'd think that using thread-local storag

Re: Some basic newbie questions...

2006-12-28 Thread Grant Edwards
On 2006-12-28, jonathan.beckett <[EMAIL PROTECTED]> wrote: > Hi all, > > While working on support at work, I have been picking away at Python - > because I think it could be a valuable scripting tool for building > utilities from. I have been reading the python.org tutorials, and > playing around w

Some basic newbie questions...

2006-12-28 Thread jonathan.beckett
Hi all, While working on support at work, I have been picking away at Python - because I think it could be a valuable scripting tool for building utilities from. I have been reading the python.org tutorials, and playing around with some basic code, but I have ended up with a few questions that pro

Re: db access

2006-12-28 Thread Chris Mellon
On 12/28/06, Martin P. Hellwig <[EMAIL PROTECTED]> wrote: > king kikapu wrote: > > Hey Martin, > > > > thanks for the fast reply! > > > > I have already seen that link and i just downloaded the pyodbc module > > but isn't Python already containing a "built-in" odbc module so to > > allow for db com

Re: db access

2006-12-28 Thread Laszlo Nagy
king kikapu írta: > Hey Martin, > > thanks for the fast reply! > > I have already seen that link and i just downloaded the pyodbc module > but isn't Python already containing a "built-in" odbc module so to > allow for db communication ?? > There is no built-in ODBC module. We all know that Pytho

Re: __getattr__ possible loop

2006-12-28 Thread Chris Mellon
On 12/28/06, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 28 Dec 2006 07:45:05 -0800, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > Maksim Kasimov: > > > how to improve the situation depends on what do you expect to get by > > > calling "T().method()" > > > > You are right, sorry for being cr

Re: per interpreter storage for C extensions

2006-12-28 Thread Chris Mellon
On 12/28/06, Robin Becker <[EMAIL PROTECTED]> wrote: > As part of some django usage I need to get some ReportLab C extensions into a > state where they can be safely used with mod_python. > > Unfortunately we have C code that seems incompatible with mod_python and I'm > looking for ways to improve

Re: db access

2006-12-28 Thread Martin P. Hellwig
king kikapu wrote: > Hey Martin, > > thanks for the fast reply! > > I have already seen that link and i just downloaded the pyodbc module > but isn't Python already containing a "built-in" odbc module so to > allow for db communication ?? > Not that I'm aware of, but it is possible to do odbc w

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Laszlo Nagy
> You should also think long and hard about *why* you want to return a > value from a function by modifying an input parameter instead of just > using the return statement. The "return by modifying an input parameter" > approach comes from C where that's the only way to return more than one > valu

Re: __getattr__ possible loop

2006-12-28 Thread Chris Mellon
On 28 Dec 2006 07:45:05 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Maksim Kasimov: > > how to improve the situation depends on what do you expect to get by > > calling "T().method()" > > You are right, sorry for being cryptic. I think that's a kind of bug of > Python (produced maybe by

Slowdown in Jython

2006-12-28 Thread tac-tics
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 being forced to use extend

Re: db access

2006-12-28 Thread king kikapu
Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a "built-in" odbc module so to allow for db communication ?? On Dec 28, 6:06 pm, "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote: > king kikapu wrote: >

Re: DOS, UNIX and tabs

2006-12-28 Thread Sebastian 'lunar' Wiesner
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> typed > In <[EMAIL PROTECTED]>, Felix Benner wrote: > >> I like using tabs. And the style guide doesn't give a reason why one >> shouldn't and neither does the thread >> http://www.python.org/search/hypermail/python-1994q2/0198.html in the >> archive.

Re: db access

2006-12-28 Thread Martin P. Hellwig
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 that use statements like "import dbi" or "import > odbc" but neither modules (dbi, odbc) are pre

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 15:28 +, Paul Hummer wrote: > You'd have to either pass the variables by reference into the function, [...] In Python, all function calls are call by reference. Period. The key difference between Python and other programming languages is in the behavior of the assignment

db access

2006-12-28 Thread king kikapu
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 that use statements like "import dbi" or "import odbc" but neither modules (dbi, odbc) are present on my system... Any hint(

Re: __getattr__ possible loop

2006-12-28 Thread bearophileHUGS
Maksim Kasimov: > how to improve the situation depends on what do you expect to get by calling > "T().method()" You are right, sorry for being cryptic. I think that's a kind of bug of Python (produced maybe by an infinite loop), so an improvement can be a traceback or some automatic breaking of t

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Carsten Haese
On Thu, 2006-12-28 at 16:14 +0100, Stef Mientki wrote: > I want to return a "simple" variable from a function, > not using the function result. > Is that in any way possible ?? > > The code below is from O'Reilly, "Learning Python", > and there seems no way > to return a simple var like "z" in the

per interpreter storage for C extensions

2006-12-28 Thread Robin Becker
As part of some django usage I need to get some ReportLab C extensions into a state where they can be safely used with mod_python. Unfortunately we have C code that seems incompatible with mod_python and I'm looking for ways to improve the situation. Basically the main things that are wrong are

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Paul Hummer
How about restructuring your function like this: def some_function( z,y ): z = 2 y[2] = 'global ?' return z And then you'll have to react to the returning variable, like this in your code: x = 5 y = [1,2,3,4] print x,y print some_function( x, y ) print x,y Now, it appears like you want so

Re: Fuzzy string comparison

2006-12-28 Thread jmw
Gabriel Genellina wrote: > At Tuesday 26/12/2006 18:08, John Machin wrote: > > > > I'm looking for a module to do fuzzy comparison of strings. [...] > Other alternatives: trigram, n-gram, Jaro's distance. There are some > Python implem. available. Quick question, you mentioned the data you need

Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Stef Mientki wrote: > I want to return a "simple" variable from a function, not using the > function result. Why? > The code below is from O'Reilly, "Learning Python", and there seems no > way to return a simple var like "z" in the example below. Is that true ? To return

Re: __getattr__ possible loop

2006-12-28 Thread Maksim Kasimov
[EMAIL PROTECTED] wrote: > I have tried this, with Psyco it segfaults, and with Python 2.5 (on > Win) hangs the interpreter, is it possible to improve the situation? > > class T(object): > def __getattr__(self, x): dir(self) > #import psyco > #psyco.full() > T().method() > > (Probably dir calls

Re: DOS, UNIX and tabs

2006-12-28 Thread Grant Edwards
On 2006-12-28, Felix Benner <[EMAIL PROTECTED]> wrote: > I like using tabs. And the style guide doesn't give a reason > why one shouldn't and neither does the thread > http://www.python.org/search/hypermail/python-1994q2/0198.html > in the archive. So what's the point in typing four spaces for > i

Re: Fuzzy string comparison

2006-12-28 Thread jmw
Gabriel Genellina wrote: > At Tuesday 26/12/2006 18:08, John Machin wrote: > > > > I'm looking for a module to do fuzzy comparison of strings. [...] > Other alternatives: trigram, n-gram, Jaro's distance. There are some > Python implem. available. Quick question, you mentioned the data you need

Re: DOS, UNIX and tabs

2006-12-28 Thread Grant Edwards
On 2006-12-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I've spent a lot of time reading both sides of the tabs versus spaces > argument, and I haven't found anything yet that explains why tabs are, in > and of themselves, bad. They aren't. Using tabs isn't bad. Using both tabs and spaces i

  1   2   >