Re: contextlib.nested()

2008-11-07 Thread brasse
On Nov 6, 5:45 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: If you had a class that wanted to acquire some external resources that must be released at some point, how would you rewrite the code from my example? If you *can*, use a context. Use __enter__ and __exit__. Try really hard to

is it a bug in Module copy or i am wrong??

2008-11-07 Thread yoma
python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects* into it that the original contains. - A deep copy constructs a new

Re: problem with regex, how to conclude more than one character

2008-11-07 Thread tecspring
On Nov 7, 3:13 pm, Chris Rebert [EMAIL PROTECTED] wrote: On Thu, Nov 6, 2008 at 11:06 PM,  [EMAIL PROTECTED] wrote: I always have no idea about how to express conclude the entire word with regexp,  while using python, I encountered this problem again... for example, if I want to match the

[urllib2 + Tor] How to handle 404?

2008-11-07 Thread Gilles Ganault
Hello I'm using the urllib2 module and Tor as a proxy to download data from the web. Occasionnally, urlllib2 returns 404, probably because of some issue with the Tor network. This code doesn't solve the issue, as it just loops through the same error indefinitely: = for id in rows:

Re: [2.5.1] Building loop with some exceptions?

2008-11-07 Thread Gilles Ganault
On 04 Nov 2008 22:34:49 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: for i in range(1, 100): if i in (4, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89): continue do_rest_of_processing Thanks for the sample. -- http://mail.python.org/mailman/listinfo/python-list

Re: Building loop with some exceptions?

2008-11-07 Thread Gilles Ganault
On Tue, 4 Nov 2008 15:55:06 -0800 (PST), alex23 [EMAIL PROTECTED] wrote: exclusions = [04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89] for i in (x for x in xrange(1,100) if x not in exclusions): Thanks guys. -- http://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to tint an image with PIL

2008-11-07 Thread Peter Otten
Dan Moskowitz wrote: I'm using PIL to tint and composite images together. Here's how I'm currently tinting images, it's really slow and I know there's got to be a better way: def TintImage( im, tintColor ): tint = (tintColor[0]/255.0, tintColor[1]/255.0, tintColor[2]/255.0,

Re: Fastest way to tint an image with PIL

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Thu, 06 Nov 2008 13:08:59 -0800, Dan Moskowitz wrote: I'm using PIL to tint and composite images together. Here's how I'm currently tinting images, it's really slow and I know there's got to be a better way: def TintImage( im, tintColor ): tint = (tintColor[0]/255.0,

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Chris Rebert
On Thu, Nov 6, 2008 at 11:59 PM, yoma [EMAIL PROTECTED] wrote: python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects*

Re: efficient Python object count

2008-11-07 Thread darrenr
Thanks for the quick reply. Could you provide a link to more information on the debug build you refer to? A modified version of this algorithm should do the trick for my purposes, it finds the non-containers that gc ignores. I don't care how long it takes to compute, I just don't want the

Re: [urllib2 + Tor] How to handle 404?

2008-11-07 Thread Chris Rebert
On Fri, Nov 7, 2008 at 12:05 AM, Gilles Ganault [EMAIL PROTECTED] wrote: Hello I'm using the urllib2 module and Tor as a proxy to download data from the web. Occasionnally, urlllib2 returns 404, probably because of some issue with the Tor network. This code doesn't solve the issue,

Re: CGI Python problem

2008-11-07 Thread Tim O'Toole
Well, if Python's not installed, the next step is _getting_ it installed -- whether having your admin install it globally (I mean, who *doesn't* install python?! ;-) or you install it locally in your home directory as detailed at [1] where you download the source and compile from scratch

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Thu, 06 Nov 2008 23:59:51 -0800, yoma wrote: import copy class A: i = 1 class B: a = A() b = B() x=copy.copy(b) y=copy.deepcopy(b) print id(x.a), id(b.a) print id(y.a), id(y.a) the result: 14505264 14505264 14505264 14505264 So maybe i have a wrong

Re: List to Text back to List

2008-11-07 Thread SimonPalmer
On Nov 6, 8:33 pm, Chris Rebert [EMAIL PROTECTED] wrote: On Thu, Nov 6, 2008 at 12:18 PM, SimonPalmer [EMAIL PROTECTED] wrote: On Nov 6, 8:11 pm, Chris Rebert [EMAIL PROTECTED] wrote: On Thu, Nov 6, 2008 at 12:04 PM, SimonPalmer [EMAIL PROTECTED] wrote: Hi, I am looking for a way to

Re: contextlib.nested()

2008-11-07 Thread Peter Otten
brasse wrote: with nested(Foo('a'), Foo('b', True)) as (a, b):     print a.tag     print b.tag If been watching this thread for a while, and I think that your problems will go away if you write actual nested with-blocks: with Foo(a) as a: with Foo(b) as b: print a.tag

Mod_python permission denied

2008-11-07 Thread Simo D
Hi, I'm using a script.py to write a file in a dir on the server. Mod_python work but i get: Mod_python error: PythonHandler mod_python.publisher Traceback (most recent call last): File /usr/lib64/python2.4/site-packages/mod_python/apache.py, line 299, in HandlerDispatch result =

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 00:44:21 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote: [...] And by definition, call by value means that the parameter is a copy. So if you pass a ten megabyte data structure to a function using call-by- value

Re: declaration problem

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Nov 2008 16:05:22 +0530, devi thapa wrote: I am using the command recv(..) to receive a message from client. retval = recv(my_socket, *buf, len(buf) , 0) and its giving this error File ./server1.py, line 31 retval = recv(my_socket, *buf, len(buf) , 0)

plot for sale

2008-11-07 Thread [EMAIL PROTECTED]
SELL OUT land area with 12,681 ha, located at the entrance to the town of Pazardzhik(Bulgaria) in city limits and has 106 meters individual . Dimcho Debelyanov (Miryansko road). A plot in the new economic zone of the city - in the vicinity has built industrial enterprises, shops and warehouses.

Re: Step-by-step exec

2008-11-07 Thread M.-A. Lemburg
On 2008-11-07 11:48, [EMAIL PROTECTED] wrote: On Nov 7, 11:20 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: What I am trying to do is to execute it step-by-step, so that I can capture the exception if one line (or multi-line statement) fails, print a warning about the

overloading for ladder logic

2008-11-07 Thread jimzat
I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the modification step. My thought was that this might be able to be completed via overloading, but I am

[no subject]

2008-11-07 Thread Richard Carlsen
Hey! My name is Richard Carlsen. I am trying to create a program/game with the following plot/requirement in Python (a basic river-crossing game). I have just begun programming and have read a basics book on Python, but av having problems getting started with this. I would very much

File names are changed into capital letter in Python CE and WM5

2008-11-07 Thread mujunshan
Yesterday, I installed PythonCE on my cellphone whose OS is Windows Mobile 5.I wanted to use numpy as calculation tool.But after I copy numpy module in my desktop computer into my phone,I find many file names in directory \numpy were changed into capital letters.For example: __init__.py was chaged

Re: contextlib.nested()

2008-11-07 Thread brasse
On Nov 7, 10:33 am, Peter Otten [EMAIL PROTECTED] wrote: brasse wrote: with nested(Foo('a'), Foo('b', True)) as (a, b):     print a.tag     print b.tag If been watching this thread for a while, and I think that your problems will go away if you write actual nested with-blocks: with

Re: Step-by-step exec

2008-11-07 Thread Steven D'Aprano
On Thu, 06 Nov 2008 03:27:53 -0800, gregory.lielens wrote: Hi, I am using a small python file as an input file (defining constants, parameters, input data, ...) for a python application. The input file is simply read by an exec statement in a specific dictionary, and then the application

adodbapi and output parameters in stored procedures

2008-11-07 Thread leesquare
Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my system. But my stored procedure also inserts and accesses a table in the database. Here's what I have

Re: More __init__ methods

2008-11-07 Thread Mr . SpOOn
On Thu, Nov 6, 2008 at 11:00 PM, Ben Finney [EMAIL PROTECTED] wrote: Yes, the main reason is that it kills duck typing. The initialiser should *use* the parameters passed, and allow exceptions to propagate back to the caller if the parameters don't behave as expected. Another good reason to

Re: Step-by-step exec

2008-11-07 Thread gregory . lielens
On Nov 6, 9:53 pm, Aaron Brady [EMAIL PROTECTED] wrote: Check out the InteractiveConsole and InteractiveInterpreter classes. Derive a subclass and override the 'push' method.  It's not documented so you'll have to examine the source to find out exactly when and what to override. Thanks, this

Re: read() does not read whole file in activepython/DOS

2008-11-07 Thread Holger
On Nov 7, 2:40 pm, Holger [EMAIL PROTECTED] wrote: This is what it looks like in DOS: === C:\productionpython ActivePython 2.5.2.2 (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32

Does Python have Multiple Inheritance ?

2008-11-07 Thread Aaron Gray
Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Christian Heimes
Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Yes -- http://mail.python.org/mailman/listinfo/python-list

Re: overloading for ladder logic

2008-11-07 Thread Paul McGuire
On Nov 7, 7:48 am, [EMAIL PROTECTED] wrote: I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the  modification step.  My thought was that this might

Re: efficient Python object count

2008-11-07 Thread Christian Heimes
darrenr wrote: Thanks for the quick reply. Could you provide a link to more information on the debug build you refer to? Here you are: http://svn.python.org/projects/python/branches/release25-maint/Misc/SpecialBuilds.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: adodbapi and output parameters in stored procedures

2008-11-07 Thread M.-A. Lemburg
On 2008-11-07 15:04, [EMAIL PROTECTED] wrote: Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my system. But my stored procedure also inserts and

Re: overloading for ladder logic

2008-11-07 Thread Benjamin Kaplan
On Fri, Nov 7, 2008 at 8:48 AM, [EMAIL PROTECTED] wrote: I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the modification step. My thought was

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Roy Smith
In article [EMAIL PROTECTED], Tim Golden [EMAIL PROTECTED] wrote: Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron Good grief. You can use Wikipedia but you can't use Google?

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Michele Simionato
On Nov 7, 3:50 pm, Tim Golden [EMAIL PROTECTED] wrote: Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ?    http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron Good grief. You can use Wikipedia but you can't use Google?

Re: More __init__ methods

2008-11-07 Thread Duncan Booth
Mr.SpOOn [EMAIL PROTECTED] wrote: Now I must pass a and b to the main constructor and calculate them in the classmethods. class foo: def __init__(self, a, b): self.a = a self.b = b @classmethod def from_string(self, ..): ... ...

Daemon and logging - the best approach?

2008-11-07 Thread Lech Karol Pawłaszek
Hello. I'm trying to make a daemon and I want to log to a file its activity. I'm using logging module with a configuration file for it (loaded via fileConfig()). And now I want to read logging config file before daemonize the program because the file might not be accessible after daemonization.

Re: push-style templating - an xml-like way to process xhtml

2008-11-07 Thread Terrence Brannon
On Nov 2, 6:19 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Learning the handful of constructs is the same as learning a handful of API calls. The same goes for idiosyncrasies of e.g. inserting sub-templates or dealing with repeating content. I'm not sure I agree with you. 1 - the

Can I hide internal method calls from an exception stack trace?

2008-11-07 Thread Paul McGuire
Is there any way to hide portions of an exception stack trace? When users get exceptions when using pyparsing, there are usually many layers of pyparsing-internal stack messages that are not at all helpful in diagnosing the problem - the intervening messages just divert the user's attention from

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Aaron Gray
Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In article [EMAIL PROTECTED], Tim Golden [EMAIL PROTECTED] wrote: Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks,

Re: More __init__ methods

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Nov 2008 15:16:29 +, Duncan Booth wrote: 'from_string' is a bad name here for your factory method: you should try to make it clear what sort of string is expected. When I use a `from_string()` factory I usually make sure it can parse the `str()` form of that type or that there

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Tim Golden
Aaron Gray wrote: Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In article [EMAIL PROTECTED], Tim Golden [EMAIL PROTECTED] wrote: Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Joe Strout
On Nov 6, 2008, at 10:35 PM, Steve Holden wrote: That's good to hear. Your arguments are sometimes pretty good, and usually well made, but there's been far too much insistence on all sides about being right and not enough on reaching agreement about how Python's well-defined semantics for

Simple - Pretty Printing (pprint) a list with a max width?

2008-11-07 Thread rh0dium
Hi all, Perhaps it's not supposed to work like this but I thought if you supplied a width to pprint it would nicely format a list to the width. KEYS = ['search_keys', 'Section', 'site', 'Employee', 'JobClassCode', 'XBoss', 'Department', 'LocationDesc', 'cn', 'Division', 'Fax',

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Michele Simionato
On Nov 7, 4:38 pm, Tim Golden [EMAIL PROTECTED] wrote: Seriously, though, although Python does indeed support multiple inheritance, I have the impression from comments over the years that it's used a lot less than in other languages where it is more of a common idiom. Certainly in my own (not

Re: Finding the instance reference of an object

2008-11-07 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 07 Nov 2008 00:44:21 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote: [...] And by definition, call by value means that the parameter is a copy. So if you pass a ten megabyte data structure to a function

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Tim Golden
Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron Good grief. You can use Wikipedia but you can't use Google? http://www.google.co.uk/search?q=python+multiple+inheritance TJG --

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Thu, 06 Nov 2008 21:31:16 -0700, Joe Strout wrote: You're wrong, Python variables don't contain *anything*. Python variables are names in a namespace. I think we're saying the same thing. What's a name? It's a string of characters used to refer to something. That which refers to

Re: Can I hide internal method calls from an exception stack trace?

2008-11-07 Thread alex23
On Nov 8, 1:25 am, Paul McGuire [EMAIL PROTECTED] wrote: Is there any way for me to suppress these non-value-added API-internal traceback levels? Hey Paul, Have you taken a look at the traceback module? print_tb(sys.last_traceback, limit) or extract_tb(sys.last_traceback, limit) could do the

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote: I am probably egregiously misunderstanding. The practical difficulty with the moving huge blocks of data approach would appear to emerge when a function that gets passed an instance of some container then calls another function that

Re: More __init__ methods

2008-11-07 Thread Mr . SpOOn
On Fri, Nov 7, 2008 at 4:16 PM, Duncan Booth [EMAIL PROTECTED] wrote: There is a really big advantage to being explicit in this situation: you no longer have to make sure that all your constructors use a unique set of types. Consider: class Location(object): def __init__(self, lat, long):

Re: Can I hide internal method calls from an exception stack trace?

2008-11-07 Thread Peter Otten
Paul McGuire wrote: Is there any way to hide portions of an exception stack trace?  When Add a try...except at the appropriate level. Why do you want to do anything more complex? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: adodbapi and output parameters in stored procedures

2008-11-07 Thread leesquare
Thanks for that excellent pointer! I was able to do just what you said with But if my procedure has an insert statement in its midst, it doesn't work. The cursor.fetchall() gets an exception. Any ideas? --Li -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-11-07 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote: I am probably egregiously misunderstanding. The practical difficulty with the moving huge blocks of data approach would appear to emerge when a function that gets passed an instance of some container then calls

Re: PySqlite - division of real numbers without decimal fractions

2008-11-07 Thread Astley Le Jasper
On Nov 7, 6:36 am, Dan Bishop [EMAIL PROTECTED] wrote: On Nov 6, 3:46 pm, Astley Le Jasper [EMAIL PROTECTED] wrote: I've been getting errors recently when using pysqlite. I've declared the table columns as real numbers to 2 decimal places (I'm dealing with money), but when doing division

Re: declaration problem

2008-11-07 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: On Fri, 07 Nov 2008 16:05:22 +0530, devi thapa wrote: I am using the command recv(..) to receive a message from client. retval = recv(my_socket, *buf, len(buf) , 0) and its giving this error File ./server1.py, line 31 retval = recv(my_socket, *buf,

Re: 2.6, 3.0, and truly independent intepreters

2008-11-07 Thread Paul Boddie
On 7 Nov, 03:02, sturlamolden [EMAIL PROTECTED] wrote: On Nov 7, 12:22 am, Walter Overby [EMAIL PROTECTED] wrote: I read Andy to stipulate that the pipe needs to transmit hundreds of megs of data and/or thousands of data structure instances.  I doubt he'd be happy with memcpy either.  My

Calling Python from Python and .pyc problem

2008-11-07 Thread David Shi
Hello, there.I am using Python 2.5. I used py_compile and made a .pyc file. However, it runs but never stops. What is the best way tocompile a .py file.I am trying to customise the attached script to do the following:calling an external Python script and passing parameters into it.And run

Re: Step-by-step exec

2008-11-07 Thread gregory . lielens
On Nov 7, 11:20 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: What I am trying to do is to execute it step-by-step, so that I can capture the exception if one line (or multi-line statement) fails, print a warning about the failure, and continue the execution fo the

Re: efficient Python object count

2008-11-07 Thread robert
darrenr wrote: Thanks for the quick reply. Could you provide a link to more information on the debug build you refer to? A modified version of this algorithm should do the trick for my purposes, it finds the non-containers that gc ignores. I don't care how long it takes to compute, I just

.pyc keeps running and never stops

2008-11-07 Thread Shao
Dear All, I am using Python 2.5 and used py_compile to produce a .pyc file. The script runs well. However, the .pyc keeps running and never stops. Advices will be deeply appreciated. Regards. David -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I hide internal method calls from an exception stack trace?

2008-11-07 Thread Paul McGuire
On Nov 7, 10:30 am, Peter Otten [EMAIL PROTECTED] wrote: Paul McGuire wrote: Is there any way to hide portions of an exception stack trace?  When Add a try...except at the appropriate level. Why do you want to do anything more complex? Peter I thought I tried that, and now in retrying, I

Re: plot for sale

2008-11-07 Thread Mario Testinori
On Fri, 7 Nov 2008 04:27:04 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: SELL OUT land area with 12,681 ha, located at the entrance to the town of Pazardzhik(Bulgaria) in city limits and has 106 meters individual . Dimcho Debelyanov (Miryansko road). A plot in the new economic zone of

read() does not read whole file in activepython/DOS

2008-11-07 Thread Holger
This is what it looks like in DOS: === C:\productionpython ActivePython 2.5.2.2 (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27 2008, 17:57:18) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more

Re: efficient Python object count

2008-11-07 Thread darrenr
Here you are:http://svn.python.org/projects/python/branches/release25-maint/Misc/S... Excellent, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can this be done in py?

2008-11-07 Thread Mathieu Prevot
2008/11/7 Robert Singer [EMAIL PROTECTED]: Now, don't get me wrong if this is a trivial question, or even an apsurd one. I'm new to python, so my mileage may vary. I have several exe files, console applications that pretty much run on the principle: starting first.exe Enter file name:

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 08:48:19 -0700, Joe Strout wrote: I think of it this way: every variable is an object reference; no special syntax needed for it because that's the only type of variable there is. (Just as with Java or .NET, when dealing with any class type; Python is just a little more

Re: plot for sale

2008-11-07 Thread D'Arcy J.M. Cain
On Fri, 07 Nov 2008 18:10:00 +0100 Mario Testinori [EMAIL PROTECTED] wrote: Unless you're breeding pythons there, you're offtopic. Arrggghhh!!! Stop responding to spam! Please! -- D'Arcy J.M. Cain [EMAIL PROTECTED] | Democracy is three wolves http://www.druid.net/darcy/

Re: Finding the instance reference of an object

2008-11-07 Thread Steven D'Aprano
On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote: I am probably egregiously misunderstanding. The practical difficulty with the moving huge blocks of data approach would appear to emerge when a function

Re: PySqlite - division of real numbers without decimal fractions

2008-11-07 Thread Gerhard Häring
Astley Le Jasper wrote: I've been getting errors recently when using pysqlite. I've declared the table columns as real numbers to 2 decimal places (I'm dealing with money), MySQL doesn't have any MONEY type. All it has is INTEGER, REAL, TEXT, BLOB and NULL types. but when doing division

Re: Mod_python permission denied

2008-11-07 Thread Simo D
Ok, solved: apache is unable to follow relative paths from the script. Putting ol absolute paths it's ok! Simo D wrote: Hi, I'm using a script.py to write a file in a dir on the server. Mod_python work but i get: Mod_python error: PythonHandler mod_python.publisher Traceback (most recent

Re: overloading for ladder logic

2008-11-07 Thread Aaron Brady
On Nov 7, 7:48 am, [EMAIL PROTECTED] wrote: I am trying to simulate the execution of some PLC ladder logic in python. I manually modified the rungs and executed this within python as a proof of concept, but I'd like to be able to skip the  modification step.  My thought was that this might

Re: 2.6, 3.0, and truly independent intepreters

2008-11-07 Thread sturlamolden
On Nov 7, 11:46 am, Paul Boddie [EMAIL PROTECTED] wrote: As far as I can tell, he wants to keep the data in one place and just pass a pointer around between execution contexts. This would be the easiest solution if Python were designed to do this from the beginning. I have previously stated

Re: Daemon and logging - the best approach?

2008-11-07 Thread J Kenneth King
Lech Karol Pawłaszek [EMAIL PROTECTED] writes: Hello. I'm trying to make a daemon and I want to log to a file its activity. I'm using logging module with a configuration file for it (loaded via fileConfig()). And now I want to read logging config file before daemonize the program because

Re: More __init__ methods

2008-11-07 Thread Mr . SpOOn
On Thu, Nov 6, 2008 at 11:00 PM, Ben Finney [EMAIL PROTECTED] wrote: Yes, the main reason is that it kills duck typing. The initialiser should *use* the parameters passed, and allow exceptions to propagate back to the caller if the parameters don't behave as expected. Another good reason to

Can this be done in py?

2008-11-07 Thread Robert Singer
Now, don't get me wrong if this is a trivial question, or even an apsurd one. I'm new to python, so my mileage may vary. I have several exe files, console applications that pretty much run on the principle: starting first.exe Enter file name: start.dat outputs filename.dat end of first.exe

Re: More __init__ methods

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Nov 2008 17:23:21 +0100, Mr.SpOOn wrote: On Fri, Nov 7, 2008 at 4:16 PM, Duncan Booth [EMAIL PROTECTED] wrote: There is a really big advantage to being explicit in this situation: you no longer have to make sure that all your constructors use a unique set of types. Consider:

Re: Finding the instance reference of an object

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote: I am probably egregiously misunderstanding. The practical difficulty with the moving huge blocks of data approach would appear to emerge when a function

RE: Django or TurboGears or Pylons? for python web framework.

2008-11-07 Thread Sells, Fred
I use Flex (from adobe) for the client side and turbogears for the server side and pass xml or json in between. It gives you a Flash client which is very Sexy and browser independent and very simple turbogears code in Python. Flex is essentially open source, but the IDE is about $295, although

Re: [urllib2 + Tor] How to handle 404?

2008-11-07 Thread Steven McKay
On Fri, Nov 7, 2008 at 2:28 AM, Chris Rebert [EMAIL PROTECTED] wrote: On Fri, Nov 7, 2008 at 12:05 AM, Gilles Ganault [EMAIL PROTECTED] wrote: Hello I'm using the urllib2 module and Tor as a proxy to download data from the web. Occasionnally, urlllib2 returns 404, probably

declaration problem

2008-11-07 Thread devi thapa
Hi, I am using the command recv(..) to receive a message from client. retval = recv(my_socket, *buf, len(buf) , 0) and its giving this error File ./server1.py, line 31 retval = recv(my_socket, *buf, len(buf) , 0) ^

Looking for a nitty-gritty Python Ajax middleware script to fire off a number of processors

2008-11-07 Thread Shao
Dear All, I am looking for a nitty-gritty Python Ajax script to fire off a number of processing programmes, periodically checking their operations, sending messages back to an HTML div form by sending back the links of generated data files, to be downloaded by end users. I am using .NET IIS 6.0

plot for sale

2008-11-07 Thread [EMAIL PROTECTED]
SELL OUT land area with 12,681 ha, located at the entrance to the town of Pazardzhik(Bulgaria) in city limits and has 106 meters individual . Dimcho Debelyanov (Miryansko road). A plot in the new economic zone of the city - in the vicinity has built industrial enterprises, shops and warehouses.

Re: .pyc keeps running and never stops

2008-11-07 Thread Tim Couper
On Nov 7, 10:40 am, Shao [EMAIL PROTECTED] wrote: Dear All, I am using Python 2.5 and used py_compile to produce a .pyc file.  The script runs well.  However, the .pyc keeps running and never stops. Advices will be deeply appreciated. Regards. David perhaps you should include the source

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Joe Strout
On Nov 7, 2008, at 10:29 AM, Steven D'Aprano wrote: Note: I tried to say name above instead of variable but I couldn't bring myself to do it -- name seems to generic to do that job. Lots of things have names that are not variables: modules have names, classes have names, methods have

Re: Trying to set a date field in a access databse

2008-11-07 Thread Roger Upole
You should be able to pass a PyTime or datetime.datetime object. Roger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I cannot get the following code to work import win32com.client import time engine = win32com.client.Dispatch(DAO.DBEngine.36)

Re: Simple - Pretty Printing (pprint) a list with a max width?

2008-11-07 Thread Paul McGuire
On Nov 7, 9:45 am, rh0dium [EMAIL PROTECTED] wrote: Hi all, Perhaps it's not supposed to work like this but I thought if you supplied a width to pprint it would nicely format a list to the width. KEYS = ['search_keys', 'Section', 'site', 'Employee', 'JobClassCode', 'XBoss', 'Department',  

Re: Extending Logger

2008-11-07 Thread polettog
On Nov 7, 12:17 am, Thomas Christensen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: I took a look to the logging module which was quite sexy at a first sight, but then i finally realized the following : the Logger class can't be extended since a Logger is created only with getLogger

@contextlib question

2008-11-07 Thread Neal Becker
http://www.python.org/doc/2.5.2/lib/module-contextlib.html has this example: from contextlib import contextmanager @contextmanager def tag(name): print %s % name yield print /%s % name contexlib.contextmanager doc string (2.5.1) says: Typical usage: @contextmanager

Re: (Windows) Dropping stuff onto a Python script

2008-11-07 Thread Roger Upole
This is done via a drop handler. Add registry key HKCR\Python.File\shellex\DropHandler with a default value of {86C86720-42A0-1069-A2E8-08002B30309D} Roger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello people, I'd like to have the functionality known from real

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Terry Reedy
Joe Strout wrote: On Nov 6, 2008, at 10:35 PM, Steve Holden wrote: Note: I tried to say name above instead of variable but I couldn't bring myself to do it -- name seems to generic to do that job. Python has two types of names. Some complex objects -- modules, classes, and functions, and

Re: adodbapi and output parameters in stored procedures

2008-11-07 Thread Roger Upole
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I need some help getting output values from my stored procedures when using adodbapi. There's an example testVariableReturningStoredProcedure in adodbapitest.py, and that works for my system. But my stored procedure also

Re: Daemon and logging - the best approach?

2008-11-07 Thread Lech Karol Pawłaszek
J Kenneth King wrote: [...] Depends. For *NIX systems, it's a good idea to use the syslog daemon for logging where it's available. True, however it's more convenient to have certain application logs in its own place sometimes. I believe the logging module can be configured to log to the

Re: Django or TurboGears or Pylons? for python web framework.

2008-11-07 Thread Daniel Fetchinson
Hi Senior, There was a case for web site that will be public to Internet for me. I like python so I do not consider the use of Ruby on Rails. I searched more web framework of python from Google. The good solution just only there are Django, TurboGears and Pylons. Just from my preferences,

Re: Extending Logger

2008-11-07 Thread Matimus
Yes but in the other hand :http://docs.python.org/library/logging.html#logger-objects Note that Loggers are never instantiated directly, but always through the module-level function logging.getLogger(name). That is part of the power of the logging module. If you ask for a logger of the same

Re: Finding the instance reference of an object

2008-11-07 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote: I am probably egregiously misunderstanding. The practical difficulty with the moving huge blocks of data approach would appear to

Re: Daemon and logging - the best approach?

2008-11-07 Thread Neal Becker
Lech Karol Pawłaszek wrote: Hello. I'm trying to make a daemon and I want to log to a file its activity. I'm using logging module with a configuration file for it (loaded via fileConfig()). And now I want to read logging config file before daemonize the program because the file might

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Terry Reedy
Steven D'Aprano wrote: On Fri, 07 Nov 2008 08:48:19 -0700, Joe Strout wrote: Unfortunately, the term name is *slightly* ambiguous in Python. There are names, and then there are objects which have a name attribute, which holds a string. This attribute is usually called __name__ but sometimes

  1   2   >