Re: SDL doesn't cope well with FreeSans

2006-07-27 Thread greg
Carl Banks wrote: Greg Ewing wrote: The characters come out slightly higglety-pigglety -- randomly displaced up or down a pixel or so from the baseline. It would depend on how you're displaying them, I would think. I've seen the same thing happen two different ways: * Rendering with

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Hey Steve, Yes, I agree with you. The lack of checking can get confusing fast. It's not about typing without errors. Regardless of how you train as long as you're human you WILL make typos. Also having to check whether a name has already existed can be a major pain in the butt with Python. With

Re: binding more than one attribute in a facntion

2006-07-27 Thread [EMAIL PROTECTED]
Peter Otten wrote: [EMAIL PROTECTED] wrote: Bound methods are limited to one implicit parameter. What you need is partial function application: def f(a, b, c): ... return a + b + c ... def partial(f, *args): ... def g(*more): ... return f(*args+more) ...

Re: Scope, type and UnboundLocalError

2006-07-27 Thread Paddy
Paddy wrote: Hi, I am trying to work out why I get UnboundLocalError when accessing an int from a function where the int is at the global scope, without explicitly declaring it as global but not when accessing a list in similar circumstances. The documentation:

write()

2006-07-27 Thread manuhack
I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory '/tmp/workfile' Is it something about the os? I'm using Python 2.4 under WinXP. Thanks. Without / I can open it. --

Re: How to force a thread to stop

2006-07-27 Thread H J van Rooyen
Carl J. Van Arsdall [EMAIL PROTECTED] wrote: 8 | point). Its not only important that the threads die, but that they die | with grace. There's lots of cleanup work that has to be done when | things exit or things end up in an

MySql

2006-07-27 Thread miker2
HI, I'm having trouble writing to a MySql db using python and the MySQLdb module. Here is the code: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor() cursor.execute(INSERT INTO table (field) VALUES (int)) this does not work but the

Re: write()

2006-07-27 Thread miker2
manuhack wrote: I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory '/tmp/workfile' Is it something about the os? I'm using Python 2.4 under WinXP. Thanks. Without / I can open it.

Re: write()

2006-07-27 Thread manuhack
How about write mode? Changing r to w doesn't work... [EMAIL PROTECTED] wrote: manuhack wrote: I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory '/tmp/workfile' Is it something

Re: Intermittent permission denied errors when using os.rename and a recently deleted path??

2006-07-27 Thread Neil Hodgson
Russell Warren: I'm actually running both... but I would think that once os.remove returns that the file is actually gone from the hdd. Why would either application be blocking access to a non-existent file? Does it actually tell you the target is the problem? I see an OSError: [Errno

Re: write()

2006-07-27 Thread miker2
manuhack wrote: How about write mode? Changing r to w doesn't work... [EMAIL PROTECTED] wrote: manuhack wrote: I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory

Re: builtin function compile exceptions thrown?

2006-07-27 Thread Martin v. Löwis
James Thiele wrote: What exceptions (if any) can the python builtin compile() function throw besides SyntaxError? - TypeError, if the parameters are wrong/too many/too few - Any errors that a codec may raise, if there is an encoding declaration, plus (pre 2.5) MemoryError if the encoding is

Re: MySql

2006-07-27 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], miker2 wrote: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor() cursor.execute(INSERT INTO table (field) VALUES (int)) this does not work but the interesting thing is, there is an AUTO_INCREMENT field.

Re: How to find difference in years between two dates?

2006-07-27 Thread Bruno Desthuilliers
thebjorn wrote: Bruno Desthuilliers wrote: [...] Possible solution: import mx.DateTime as dt def age(date): return dt.Age(dt.today(), date).years born = dt.Date(1967, 5, 1) assert age(born) == 39 dealbreaker: age(datetime.date(1970,5,2)) (snip traceback) What about:

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
John Henry wrote: Carl, OS writers provide much more tools for debugging, tracing, changing the priority of, sand-boxing processes than threads (in general) It *should* be easier to get a process based solution up and running andhave it be more robust, when compared to a threaded

Re: How to force a thread to stop

2006-07-27 Thread Paul Rubin
Dennis Lee Bieber [EMAIL PROTECTED] writes: Ugh... Seems to me it would be better to find some Python library for SSH, something similar to telnetlib, rather than doing an os.system() per command line. EACH of those os.system() calls probably causes a full fork() operation on Linux/UNIX,

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
Russell Warren wrote: This is something I have a streak of paranoia about (after discovering that the current xmlrpclib has some thread safety issues). Is there a list maintained anywhere of the modules that are aren't thread safe? It's much safer to work the other way: assume that libraries

Re: How to force a thread to stop

2006-07-27 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: [EMAIL PROTECTED] wrote: Carl J. Van Arsdall wrote: [EMAIL PROTECTED] wrote: Carl J. Van Arsdall wrote: I don't get what threading and Twisted would to do for you. The problem you actually have is that you sometimes need terminate these other process

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-27 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], John Machin wrote: You may wish to put more restrictions on the separators ... I would be suspicious of cases where dms[2] != dms[5]. What plausible separators are there besides :? Why allow alphabetics? If there's a use case for 23h59m59s, that would have to be handled

Re: MySql

2006-07-27 Thread miker2
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], miker2 wrote: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor() cursor.execute(INSERT INTO table (field) VALUES (int)) this does not work but the interesting thing

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: John Henry wrote: Granted. Threaded program forces you to think and design your application much more carefully (to avoid race conditions, dead-locks, ...) but there is nothing inherently *non-robust* about threaded applications. Indeed. Let's just get rid of

Re: How to force a thread to stop

2006-07-27 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hans wrote: Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() # This thread is expected to finish within a

Re: MySql

2006-07-27 Thread John Machin
[EMAIL PROTECTED] wrote: HI, I'm having trouble writing to a MySql db using python and the MySQLdb module. Here is the code: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor() cursor.execute(INSERT INTO table (field) VALUES

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Sybren Stuvel wrote: Ray enlightened us with: Also having to check whether a name has already existed can be a major pain in the butt with Python. With Java you always know when a name has already existed, and what type is bound to the name. I consider this to be a Good Thing (tm). I

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Ray wrote: otRay, please, don't top-post/ot (snip) Also having to check whether a name has already existed can be a major pain in the butt with Python. assert 'somename' not in dir(someObject) (snip) Regarding the lack of privacy, s/privacy/language-inforced access restriction/ --I

Re: MySql

2006-07-27 Thread miker2
John Machin wrote: [EMAIL PROTECTED] wrote: HI, I'm having trouble writing to a MySql db using python and the MySQLdb module. Here is the code: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor()

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread John Machin
Ray wrote: The argument against this is that since development with Python is so rapid, you're supposed to always equip your code with extensive unit tests. I like Python but I've never really bought that argument--I guess I've been doing Java too long :) In Java, if you don't always equip

locked file

2006-07-27 Thread Kirt
i have a code that backsup file from src to dest. Now if some of the files are locked , i need to skip those files.. I was trying to use fctl module but it can be used only in unix i suppose. is there anyother way? i am using windows os. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Steve Jobless wrote: Sybren Stuvel wrote: Steve Jobless enlightened us with: The first case can be just a typo, like: x.valeu = 5 I make typos all the time. Without a spell checker, this message would be unreadable :). Then learn to read what you type, as you type it. Typing without

Re: MySql

2006-07-27 Thread John Machin
[EMAIL PROTECTED] wrote: John Machin wrote: [EMAIL PROTECTED] wrote: HI, I'm having trouble writing to a MySql db using python and the MySQLdb module. Here is the code: import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor =

Re: MySql

2006-07-27 Thread Atanas Banov
[EMAIL PROTECTED] wrote: sorry guys... forget about the auto incrementer for a second. the entry is not being recorded. that is my problem. the script does not work. thanks. after Dijkstra: the use of mySql cripples the mind; its teaching should, therefore, be regarded as a criminal

Re: How to find difference in years between two dates?

2006-07-27 Thread thebjorn
John Machin wrote: thebjorn wrote: John Machin wrote: thebjorn wrote: [...] Holy code bloat, Batman! Try this: return now.year - born.year - (birthday now) yuck :-) But this: return now.year - born.year - (birthday now and 1 or 0) is not yuck??? Correct. [...]

Re: a print bug?

2006-07-27 Thread Duncan Booth
[EMAIL PROTECTED] wrote: Sybren Stuvel wrote: It has nothing to do with the print command, and everything with floating point precision. See http://docs.python.org/tut/node16.html how about the discrepancy between print 1.2345 1.2345 print %10.3f % 1.2345# seems like a bug

Re: splitting words with brackets

2006-07-27 Thread Paul McGuire
Tim Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+') r.findall(s) ['(a c)b(c d)', 'e'] Ah, it's exactly what I want! I thought the left and right sides of | are equal, but it is not true. In theory, they *should* be

Re: Tkinter pack Problem

2006-07-27 Thread H J van Rooyen
Simon Forman [EMAIL PROTECTED] wrote: | I find the Tkinter reference: a GUI for Python under Local links on | this page http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html to | be very helpful. It has a decent discussion of the grid layout | manager. | | HTH, | ~Simon Thanks am checking

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Bruno Desthuilliers
Jaroslaw Zabiello wrote: On Wed, 26 Jul 2006 18:20:44 +0200, Bruno Desthuilliers wrote: May I suggest that you learn some Lisp dialect ? Nope. I hate Lisp syntax. This should not prevent you from learning it - at least, you'd then avoid making dumb statements... Of course, I you

Re: self question

2006-07-27 Thread Duncan Booth
Mike wrote: I think the answer is that 'def' is an executable statement in python rather than a definition that the compiler interprets at compile time. As a result the compiler can evaluate 'foo()' when it defines 'bar', so it does. The following works as expected: def bar(): print

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Bruno Desthuilliers
Jaroslaw Zabiello wrote: On Wed, 26 Jul 2006 18:23:22 +0200, Bruno Desthuilliers wrote: Care to write an external DSL in Ruby ? ? I mean : write a parser and interpreter for a DSL. In Ruby. I see. Nope. I do not like code generators. I'm not talking about code generators, I'm talking

Re: Worarrounding hardcoded Option class in optparse in Python 2.3

2006-07-27 Thread Pupeno
For the record, the copy and paste fix seems to have worked, so far. Pupeno wrote: Hello, I am doing some extreme use of optparse, that is, extending it as explained on http://docs.python.org/lib/optparse-other-reasons-to-extend-optparse.html I have subclassed OptionParser and Option.

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Sybren Stuvel wrote: Ray enlightened us with: Huh? No. The compiler will always tell you. Have you ever tried Java before? I know what I'm talking about, I've got a degree in Computer Science from the University of Amsterdam. Then how come you didn't know that the Java compiler will

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
John Machin wrote: Ray wrote: The argument against this is that since development with Python is so rapid, you're supposed to always equip your code with extensive unit tests. I like Python but I've never really bought that argument--I guess I've been doing Java too long :) In Java,

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Bruno Desthuilliers wrote: Ray wrote: otRay, please, don't top-post/ot Um, top-post? I'm using Google News and it looks like it is placed correctly in the thread... or you're referring to a different thing? snip Ray -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find difference in years between two dates?

2006-07-27 Thread John Machin
thebjorn wrote: John Machin wrote: thebjorn wrote: John Machin wrote: thebjorn wrote: [...] Holy code bloat, Batman! Try this: return now.year - born.year - (birthday now) yuck :-) But this: return now.year - born.year - (birthday now and 1 or 0) is

Re:[OT] Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Bruno Desthuilliers
Ray wrote: Bruno Desthuilliers wrote: Ray wrote: otRay, please, don't top-post/ot Um, top-post? I'm using Google News and it looks like it is placed correctly in the thread... or you're referring to a different thing? http://en.wikipedia.org/wiki/Top-posting -- bruno desthuilliers

Re: Re:[OT] Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ray
Bruno Desthuilliers wrote: Ray wrote: Bruno Desthuilliers wrote: Ray wrote: otRay, please, don't top-post/ot Um, top-post? I'm using Google News and it looks like it is placed correctly in the thread... or you're referring to a different thing?

Re: httplib, threading, wx app freezing after 4 hours

2006-07-27 Thread Dermot Doran
According to the wxPython in Action book using the wx.CallAfter function in a non-gui thread is a safe wayfor threads to call functions that will then update the gui in the gui thread. Cheers!! Dermot. On 23/07/06, Mark rainess [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Mark rainess

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Kay Schluehr
Jaroslaw Zabiello wrote: Of course, I you like, you can freeze every object you want and nobody can be able to open and change it. You can also trace all activity for changing something to objects because Ruby has nice system hooks implemented. Ruby has nice security system (private,

Re: How to display name of elements in list? PROBLEM SOLVED.

2006-07-27 Thread cz
[EMAIL PROTECTED] wrote: It looks like the PyTensor object *should* have .xx, .xy, etc properties, but they may be accessible through a matrix, i.e. .t(i,j) Thanks to all of you for your help! The solution is easy: The tensor components have labels t11, t12,... Good guess ruibalp! --

Re: Threads vs Processes

2006-07-27 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, someone can, and that someone might as well be you. How long does it take to create and clean up 100 trivial processes on your system? How about 100 threads? What portion of your user waiting time is that? Here is test prog... The results

Re: subprocess module

2006-07-27 Thread Nick Craig-Wood
placid [EMAIL PROTECTED] wrote: import subprocess p = subprocess.Popen([ffmpeg.exe -i video.mpg, -f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif], shell=True, stdout=subprocess.PIPE) but the ffmpeg complains about the input file being corrupter, whereas when i run the same command

Re: PySNMP Thread unsafe?

2006-07-27 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm trying to monitor about 250 devices with SNMP, using PySNMP version 4. I use the threading.Thread to create a threadpool of 10 threads, so devices not responding won't slow down the monitoring process too much. This is surely a job for

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Kay Schluehr
Bruno Desthuilliers wrote: Care to write an external DSL in Ruby ? I mean : write a parser and interpreter for a DSL. In Ruby. It is this kind of stuff Rubys talk about when they mention DSLs in Ruby: http://www.artima.com/rubycs/articles/ruby_as_dsl.html --

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
On 2006-07-25, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Gerhard Fiedler wrote: On 2006-07-25 04:06:24, Steve Holden wrote: Since Python has no local variable declaration, there must be a rule to distinguish local names from names living in the enclosing namespaces. The rule is: unless

coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Hi listers, I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found Here's my script: results = context.module_retriever().tuples() # call to ZSQLMethod converted = []

Automatic email checking - best procedures/suggestions

2006-07-27 Thread Jon Clements
Hi All, I'm hoping someone has some experience in this field and could give me a pointer in the right direction - it's not purely python related though. Any modules/links someone has tried and found useful would be greatly appreciated... I want to have an automated process which basically has

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread blue99
Jon Bowlas wrote: Here's my script: results = context.module_retriever().tuples() # call to ZSQLMethod converted = [] for result in results: result = list(result) # make a list from the tuple for i in range(len(result)): # for each element in the listified tuple, make decode to

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Ahh, that did it, thanks very much. Jon - Original Message - From: [EMAIL PROTECTED] Newsgroups: comp.lang.python To: python-list@python.org Sent: Thursday, July 27, 2006 11:19 AM Subject: Re: coercing to Unicode: need string or buffer, NoneType found Jon Bowlas wrote: Here's my

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Peter Otten
Jon Bowlas wrote: I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found Here's my script: results = context.module_retriever().tuples() # call to ZSQLMethod

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
Ahh yes there are a couple of dodgy records that seem to have been added. many thanks. Jon - Original Message - From: Peter Otten [EMAIL PROTECTED] Newsgroups: comp.lang.python To: python-list@python.org Sent: Thursday, July 27, 2006 11:22 AM Subject: Re: coercing to Unicode: need

Re: coercing to Unicode: need string or buffer, NoneType found

2006-07-27 Thread Jon Bowlas
It says line 8 in the traceback so I guess its result[i] = unicode(result[i], 'latin-1') Jon - Original Message - From: Sybren Stuvel [EMAIL PROTECTED] Newsgroups: comp.lang.python To: python-list@python.org Sent: Thursday, July 27, 2006 11:06 AM Subject: Re: coercing to Unicode: need

Re: MySql

2006-07-27 Thread Sibylle Koczian
John Machin schrieb: BTW, if the script doesn't contain base.commit() somewhere, take yourself out to the back lane and give yourself a good thumping :-) That's not really fair, because transactions were added to MySQL only a short time ago (at least to the default table type).

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-27 Thread google0
John Machin wrote: [EMAIL PROTECTED] wrote: I know this is a trivial function, and I've now spent more time searching for a surely-already-reinvented wheel than it would take to reinvent it again, but just in case... is there a published, open-source, function out there that takes a

Re: MySql

2006-07-27 Thread ftc
[EMAIL PROTECTED] a écrit : import MySQLdb base = MySQLdb.connect(host=localhost, user=blah, passwd=blah, db=test_py) cursor = base.cursor() cursor.execute(INSERT INTO table (field) VALUES (int)) this does not work but the interesting thing is, there is an AUTO_INCREMENT field. Now say i

Re: Nested function scope problem

2006-07-27 Thread Jeremy Sanders
Gerhard Fiedler wrote: Going back to the original question... What would be the most common/useful way to access variables from the outer function for writing from within the inner function? I've done something like this (which doesn't look very nice) def myfunc(): tok = [''] def

Re: MySql

2006-07-27 Thread John Machin
Sibylle Koczian wrote: John Machin schrieb: BTW, if the script doesn't contain base.commit() somewhere, take yourself out to the back lane and give yourself a good thumping :-) That's not really fair, because transactions were added to MySQL only a short time ago (at least

Thread Question

2006-07-27 Thread Ritesh Raj Sarraf
Hi, I have some basic doubts about thread. I have a list which has items in it which need to be downloaded from the internet. Let's say list is: list_items[] which has 100 items in it. I have a function download_from_web() which does the work of downloading the items from the web. It does

Re: function to convert degree (hour), minute, seconds string to integer

2006-07-27 Thread John Machin
[EMAIL PROTECTED] wrote: John Machin wrote: [EMAIL PROTECTED] wrote: I know this is a trivial function, and I've now spent more time searching for a surely-already-reinvented wheel than it would take to reinvent it again, but just in case... is there a published, open-source,

Python with DyBase

2006-07-27 Thread Asem Eltaher
Dear users, I use Python version 2.4.3 and DyBase Object Oriented Database. These are the first three lines in my program: import os import sys import dybase I usually get the error message: ImportError: DLL load failed. Kindly be informed that I have in the folder: C:\Python24\Lib the

Re: MySql

2006-07-27 Thread Paul Boddie
John Machin wrote: Sibylle Koczian wrote: John Machin schrieb: base.commit() [...] That's not really fair, because transactions were added to MySQL only a short time ago (at least to the default table type). There simply hasn't yet been time for every experienced MySQL user to

Re: Automatic email checking - best procedures/suggestions

2006-07-27 Thread Jorge Godoy
Jon Clements [EMAIL PROTECTED] writes: problem. What I'm unsure of is the best way to design this. Bear in mind that network/email server configuration changes can be made. For instance, do I connect to the email server and keep polling it every 'n' whatever for new messages, or should I be

Re: a print bug?

2006-07-27 Thread Steve Holden
[EMAIL PROTECTED] wrote: it seems that the behavior of print is that it will round off properly for any floating point imperfection, such as shown in the first two samples. The third sample seems to be a bug? It doesn't know how to handle the floating imperfection in this case. 1.2345

Re: Thread Question

2006-07-27 Thread Duncan Booth
Ritesh Raj Sarraf wrote: I'm planning to implement threads in my application so that multiple items can be downloaded concurrently. I want the thread option to be user-defined. Looking at the documentation of threads (Core Python Programming), I've noticed that all threads are executed a

Re: Threads vs Processes

2006-07-27 Thread Steve Holden
Carl J. Van Arsdall wrote: Paul Rubin wrote: Carl J. Van Arsdall [EMAIL PROTECTED] writes: Processes seem fairly expensive from my research so far. Each fork copies the entire contents of memory into the new process. No, you get two processes whose address spaces get the data. It's

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread Bruno Desthuilliers
Kay Schluehr wrote: Bruno Desthuilliers wrote: Care to write an external DSL in Ruby ? I mean : write a parser and interpreter for a DSL. In Ruby. It is this kind of stuff Rubys talk about when they mention DSLs in Ruby: http://www.artima.com/rubycs/articles/ruby_as_dsl.html yes,

Re: Need a compelling argument to use Django instead of Rails

2006-07-27 Thread gregarican
Bruno Desthuilliers wrote: Please define security. I fail to see how language-inforced access restriction (and mandatory declarative static typing etc) relates to 'security'. As far as I'm concerned, security is about protecting a system from piracy, not about inflicting useless pain to

pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread schwehr
Hi All, I have some old pysqlite 1.x code that uses a pattern like this: cu.execute('SELECT weight FROM weights WHERE samplename=foo) row = cu.fetchone() weight=row['weight'] It seems like lookups by name are no longer supported in pysqlite2. Is that true? And if not, and I want to do a

Functions and code objects

2006-07-27 Thread Fuzzyman
Hello all, I'm trying to extract the code object from a function, and exec it without explicitly passing parameters. The code object 'knows' it expects to receive paramaters. It's 'arg_count' attribute is readonly. How can I set the arg_count to 0, or pass parameters to the code object when I

RE: pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread Tim Golden
[EMAIL PROTECTED] | I have some old pysqlite 1.x code that uses a pattern like this: | | cu.execute('SELECT weight FROM weights WHERE samplename=foo) | row = cu.fetchone() | weight=row['weight'] | | It seems like lookups by name are no longer supported in | pysqlite2. According to this:

Re: Python with DyBase

2006-07-27 Thread John Machin
Asem Eltaher wrote: Dear users, I use Python version 2.4.3 and DyBase Object Oriented Database. These are the first three lines in my program: import os import sys import dybase I usually get the error message: ImportError: DLL load failed. Kindly be informed that I have in the

Re: Nested function scope problem

2006-07-27 Thread Bruno Desthuilliers
danielx wrote: Bruno Desthuilliers wrote: (snip) Surprising for me are actually two things: 1- the fact itself, and 2- that term binding, and that whatever it means (I'll have to read more on that, now that I know the term) a binding is the association of a name and a reference to an object

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
On Thu, 27 Jul 2006 07:07:05 GMT, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 26 Jul 2006 17:38:06 -0700, Carl J. Van Arsdall [EMAIL PROTECTED] declaimed the following in comp.lang.python: Well, I guess I'm thinking of an event driven mechanism, kinda like setting up signal handlers. I

Re: Functions and code objects

2006-07-27 Thread Fuzzyman
Fuzzyman wrote: Hello all, I'm trying to extract the code object from a function, and exec it without explicitly passing parameters. The code object 'knows' it expects to receive paramaters. It's 'arg_count' attribute is readonly. How can I set the arg_count to 0, or pass parameters to

Re: How to force a thread to stop

2006-07-27 Thread Jean-Paul Calderone
On Thu, 27 Jul 2006 02:30:03 -0500, Nick Craig-Wood [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hans wrote: Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread =

Re: Changing a value for each folder while traversing a file system

2006-07-27 Thread PipedreamerGrey
No, that doesn't work. Though, leaving the random snippet about the for file in DirectoryWalker(.): line, it does leave all files the same value, rather than switching the value for every single file. The problem is, the value is shared accross every folder. --

Re: How to force a thread to stop

2006-07-27 Thread Paul Boddie
Paul Rubin wrote: Instead of using os.system, maybe you want to use one of the popens or the subprocess module. For each ssh, you'd spawn off a process that does the ssh and communicates back to the control process through a set of file descriptors (Unix pipe endpoints or whatever). The

Re: xmlrpc: hostname nor servname provided ?

2006-07-27 Thread Laszlo Nagy
I'm running a service on a machine. The service is written in Python (of course) and it connects to an XMLRPC server periodically. It recreates the ServerProxy instance each time it needs to connect to the RPC server. The server is created with this code: server =

Re: Changing a value for each folder while traversing a file system

2006-07-27 Thread Peter Otten
PipedreamerGrey wrote: I'm using the script below (originally from http://effbot.org, given to me here) to open all of the text files in a directory and its subdirectories and combine them into one Rich text file (index.rtf). Now I'm adapting the script to convert all the text files into

Re: write()

2006-07-27 Thread Rick Zantow
manuhack [EMAIL PROTECTED] wrote in news:1153981114.837884.232610 @p79g2000cwp.googlegroups.com: I copied the lines f=open('/tmp/workfile', 'w') print f f.close() from Python 2.4 Documentation 7.2. But it said IOerror No such file or directory '/tmp/workfile' Is it something about

Re: using names before they're defined

2006-07-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: do you mean 'configparser'? Yes. Does it generate objects from the config file automatically? It generates a representation of the config file as a Python object composed of sections and options. The documentation should get you started. Hiya, you might be

Re: Using iterators to write in the structure being iterated through?

2006-07-27 Thread Pierre Thibault
On Wed, 26 Jul 2006 16:11:48 -0700, Paddy wrote: Paddy wrote: Pierre Thibault wrote: Hello! I am currently trying to port a C++ code to python, and I think I am stuck because of the very different behavior of STL iterators vs python iterators. What I need to do is a simple

Re: MySql

2006-07-27 Thread miker2
Paul Boddie wrote: John Machin wrote: Sibylle Koczian wrote: John Machin schrieb: base.commit() [...] That's not really fair, because transactions were added to MySQL only a short time ago (at least to the default table type). There simply hasn't yet been time for

Re: Newbie Q: Class Privacy (or lack of)

2006-07-27 Thread Ben Sizer
Steve Jobless wrote: Sybren Stuvel wrote: Steve Jobless enlightened us with: The first case can be just a typo, like: x.valeu = 5 I make typos all the time. Without a spell checker, this message would be unreadable :). Then learn to read what you type, as you type it.

Re: why is this not working? (nested scope question)

2006-07-27 Thread biner . sebastien
Actually, the code in the book is: def f1(): x = 88 f2(x) def f2(x): print x f1() which makes all the difference in the world. Not to mention that this particular section of the book is giving an example of how to write the code *without* using nested functions.

Re: pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread schwehr
Thanks Tim! That works well. As a followup, is there a standard compliant way to ask what fields are in the table? -kurt Tim Golden wrote: | I have some old pysqlite 1.x code that uses a pattern like this: | | cu.execute('SELECT weight FROM weights WHERE samplename=foo) | row =

Re: Using iterators to write in the structure being iterated through?

2006-07-27 Thread Pierre Thibault
On Wed, 26 Jul 2006 20:59:12 +0200, Peter Otten wrote: Pierre Thibault wrote: Hum, this example seems like a special case not really appropriate for my needs. Let me make my problem a little more precise. The objects I'll want to iterate through will always contain some floats. Very often,

RE: pysqlite2 fetching from select different than pysqlite?

2006-07-27 Thread Tim Golden
[EMAIL PROTECTED] | Sent: 27 July 2006 15:01 | To: python-list@python.org | Subject: Re: pysqlite2 fetching from select different than pysqlite? | | Thanks Tim! That works well. As a followup, is there a standard | compliant way to ask what fields are in the table? | | -kurt Assuming this is

Re: Nested function scope problem

2006-07-27 Thread Antoon Pardon
On 2006-07-27, Bruno Desthuilliers [EMAIL PROTECTED] wrote: danielx wrote: Bruno Desthuilliers wrote: (snip) Surprising for me are actually two things: 1- the fact itself, and 2- that term binding, and that whatever it means (I'll have to read more on that, now that I know the term) a

Re: Functions and code objects

2006-07-27 Thread Fuzzyman
Fuzzyman wrote: Fuzzyman wrote: Hello all, I'm trying to extract the code object from a function, and exec it without explicitly passing parameters. The code object 'knows' it expects to receive paramaters. It's 'arg_count' attribute is readonly. How can I set the arg_count to

Re: why is this not working? (nested scope question)

2006-07-27 Thread John Salerno
[EMAIL PROTECTED] wrote: Ouch! You got me there, I did not copy the code properly. Now I feel stupid. Thanks for the enlightment. I think I am starting to get it. P.S. The point of the example was to show how nesting isn't necessary much of the time. The authors wanted to show that it is

Re: Threads vs Processes

2006-07-27 Thread Gerhard Fiedler
On 2006-07-26 19:10:14, Carl J. Van Arsdall wrote: Ah, alright. So if that's the case, why would you use python threads versus spawning processes? If they both point to the same address space and python threads can't run concurrently due to the GIL what are they good for? Nothing runs

  1   2   3   >