Re: Calendar GUI

2010-02-06 Thread Jean-Michel Pichavant
Michael Torrie wrote: Gabriel wrote: On Fri, Feb 5, 2010 at 9:08 PM, William Gaggioli wrote: I'm working on setting up some software for a Peruvian non-profit to help them organize their incoming volunteers. One of the features I'd like to add is a calendar-like view of the different v

Re: python admin abuse complaint

2010-02-07 Thread Jean-Michel Pichavant
Steve Holden wrote: Shashwat Anand wrote: LOL pow(funny, sys.maxint) Yes, funny, but it overlooks the point that Xah is a nuisance to multiple communities, not just to ours, and quite often concurrently. I'm all in favor of tolerance, but I'd like to see some evidence that rehabilitat

Re: convention for documenting function parameters in doc strings

2010-02-08 Thread Jean-Michel Pichavant
danielx wrote: Is there a convention for how to document function (or method) parameters in doc strings? Recently, I've been doing alot of PHP programming, and in PHPdoc, you'd do it like this: /* * @param type $foo Description. * * @return type Description. */ function bar($foo) { ... }

Re: use strings to call functions

2010-02-08 Thread Jean-Michel Pichavant
Klaus Neuner wrote: Hello, I am writing a program that analyzes files of different formats. I would like to use a function for each format. Obviously, functions can be mapped to file formats. E.g. like this: if file.endswith('xyz'): xyz(file) elif file.endswith('abc'): abc(file) ... Y

Re: use strings to call functions

2010-02-08 Thread Jean-Michel Pichavant
Aahz wrote: In article <0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>, OdarR wrote: and with eval(), did you try ? WARNING: eval() is almost always the wrong answer to any question Some say that eval is evil ! JM -- http://mail.python.org/mailman/listinfo/py

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
Carl Banks wrote: On Feb 8, 12:20 pm, spike wrote: Has anyone been able to come across a Python logic map or Python logic flow chart? An example can be seen on the right under History:http://en.wikipedia.org/wiki/Usenet#History This would be very helpful for all users. Begin |

Re: Python Logic Map/Logic Flow Chart. (Example Provided)

2010-02-09 Thread Jean-Michel Pichavant
I use this one: Begin | | V Start Mail client | | V Ask python-list <-+ | | | | Vwhat a bunch of dumbass wait 2 min| | | | | No. V | Did you get any answer

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I have a simple tcp server and client where the server sits and waits for a message and then processes it, my client sends its first message to the server. On the server I receive: socket.error: [Errno 107] Transport endpoint is not connected when calling msg = self.socket.r

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I found my car ;) here's the server: class commServer: """Class to hold a tcp server and interact with with it allows for a wrapper around socket class to keep code clean""" def __init__ (self, host, hostid, port, buff =1024): self.host = host se

Re: PostgreSQL driver for Python applications that supports bytea correctly?

2010-02-09 Thread Jean-Michel Pichavant
CyclingGuy wrote: Can anyone recommend a PostgreSQL driver for Python that supports selecting and inserting bytea types? I'm not looking to write server functions in Python, just client applications. Thank you Eric. Did you try any ? I know about pgdb, and since it has a function called esca

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: http://docs.python.org/library/socketserver.html JM each time a handler is spawned is it client specific? in other words when two clients send something to the server do handlers spawn for each of them or does everything just go into a single handler? docstring of

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Jean-Michel Pichavant
Grant Edwards wrote: What's the correct way to measure small periods of elapsed time. I've always used time.clock() in the past: start = time.clock() [stuff being timed] stop = time.clock() delta = stop-start However on multi-processor machines that doesn't work. Sometimes I get

Re: errno 107 socket.recv issue

2010-02-09 Thread Jean-Michel Pichavant
Jordan Apgar wrote: thanks JM, at this point i switched over to this scheme and now I'm getting an error durring instantiation of the server: Server.py: from Crypto.PublicKey import RSA from ServerNegotiator import ServerNegotiator from sharedComs import * f = open("hostid") tup = stringToTuple

Re: New to Python

2010-02-09 Thread Jean-Michel Pichavant
Quin wrote: s = f.readline() if 'mystring' in s: print 'foundit' if 'mystring' not in s: print 'not found' if 'mystring' in s: print 'processing' this generates output: not found processing so, it doesn't find the substring, but goes into processing code anyway. This is using IronPython Th

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I'm willing to bet money that it is not. If ironPython had a broken if statement, don't you think we would have known, already ? There's a rule when test writing/testin

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: Well, now you know! "Jean-Michel Pichavant" wrote in message news:mailman.2286.1265797348.28905.python-l...@python.org... Quin wrote: Thanks guys, I'm thinking it's a problem with IronPython. I'm switching to PyScripter and will test tomorrow. I&#x

Re: New to Python

2010-02-10 Thread Jean-Michel Pichavant
Quin wrote: You know, Jack, that was the point of my original post: to determine why things weren't working. Do you still want to bet money that it is? I can screenshot you TD. Another flaming war starting... IronPython implements python 2.5 and you're still complaining about your py3 cod

Re: looking for some libraries

2010-02-10 Thread Jean-Michel Pichavant
Vision wrote: hi all, I am doing some stuffs with some software, which has similar layout like this: Editbox1 Editbox2 Editbox3 _OK_ ___ |output| |output| |output| |output| |output

Re: SimpleXMLRPCServer and client address

2010-02-10 Thread Jean-Michel Pichavant
Jordan Apgar wrote: I'm trying to right a server that needs specific information for each client accessing it. The easiest way I could think of doing this is keeping this information based on ip address (the information is only valid for a short time). I know there is no was to get the client's

Re: SimpleXMLRPCServer and client address

2010-02-11 Thread Jean-Michel Pichavant
Stephen Hansen wrote: On Wed, Feb 10, 2010 at 5:36 PM, Jean-Michel Pichavant mailto:jeanmic...@sequans.com>> wrote: I don't know exactly what you are trying to do, but if your server requires informations from the client, it would be better to ask explicitly the clien

Re: ANN: obfuscate

2010-02-12 Thread Jean-Michel Pichavant
Bob Martin wrote: in 16 20100212 034121 Paul Rubin wrote: See http://en.wikipedia.org/wiki/Colossus_computer That was almost at the end of the war though. Colossus was working by the end of 1943 - the year that the Americans first dropped bombs on Germany ;-) sept 1939 -

Re: concatenate fasta file

2010-02-12 Thread Jean-Michel Pichavant
PeroMHC wrote: Hi All, I have a simple problem that I hope somebody can help with. I have an input file (a fasta file) that I need to edit.. Input file format name 1 tactcatacatac name 2 acggtggcat name 3 gggtaccacgtt I need to concatenate the sequences.. make th

Re: Replace various regex

2010-02-15 Thread Jean-Michel Pichavant
Martin wrote: Hi, I am trying to come up with a more generic scheme to match and replace a series of regex, which look something like this... 19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft) 5.0, 4.0, 2.0, 4.0, 1.0 ! lai(1:npft) Ideally match the pattern to the right of the "!" sign (e.g

Re: Replace various regex

2010-02-15 Thread Jean-Michel Pichavant
Martin wrote: On Feb 15, 2:03 pm, Jean-Michel Pichavant wrote: Martin wrote: Hi, I am trying to come up with a more generic scheme to match and replace a series of regex, which look something like this... 19.01,16.38,0.79,1.26,1.00 ! canht_ft(1:npft) 5.0, 4.0, 2.0

Re: how to structure a directory with many scripts and shared code

2010-02-15 Thread Jean-Michel Pichavant
Benedict Verheyen wrote: Hi, i wanted to ask how you guys structure your code. I mainly have scripts that automate small tasks. These scripts use a common set of utility code. My code is structured like this, for example: script_1.py script_2.py script_3.py tools\ |->__init__.py |->logu

Re: Loop problem while generating a new value with random.randint()

2010-02-15 Thread Jean-Michel Pichavant
Paulo Repreza wrote: Greetings, I'm having problems with a little script that I'm trying to finish, I don't know if I'm in the right track but I know somebody is going to help me. The script: # Import modules random for function randint import random # Generating a constant. var = 65 #

Re: get a field

2010-02-15 Thread Jean-Michel Pichavant
mierdatutis mi wrote: Hi, I have this: pe="http://www.rtve.es/mediateca/videos/20100211/saber-comer---patatas-castellanas-costillas-11-02-10/691046.shtml"; I would like to extract this: 691046.shtml But is dynamically. Not always have the same lenght the string. Could you help me how could

Re: Using class attributes

2010-02-16 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: Leo Breebaart writes: Chris Rebert writes: On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: I have a base class Foo with a number of derived classes FooA, FooB, FooC, etc. Each of these derived classes needs to read (upon initialisation) text

Re: how to structure a directory with many scripts and shared code

2010-02-16 Thread Jean-Michel Pichavant
Benedict Verheyen wrote: sstein...@gmail.com wrote: On Feb 16, 2010, at 3:28 AM, Benedict Verheyen wrote: python_scripts | |-->trunk ..|-> my big script 1 |-> setup.py ..|-> my big script 2 |-> setup.py ..|-> database

Re: Is automatic reload of a module available in Python?

2010-02-17 Thread Jean-Michel Pichavant
R (Chandra) Chandrasekhar wrote: Dear Folks, I am currently developing a python program, let us call it "generic.py", and I am testing out the functions therein by testing them out interactively in the python interpreter by invoking python and doing import generic Once I hit an error, I ne

Re: Referring to class methods in class attributes

2010-02-17 Thread Jean-Michel Pichavant
mk wrote: Stephen Hansen wrote: You don't have to (and can't) refer to the class within the body. Class statements are sort of... odd. They are code which is directly executed, and the results are then passed into a metaclass/type/whatever and a class object is created. While within the clas

Re: Creating Import Hooks

2010-02-18 Thread Jean-Michel Pichavant
Sreejith K wrote: On Feb 18, 1:57 pm, Steven D'Aprano wrote: On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: On Feb 17, 10:48 pm, Sreejith K wrote: Hi everyone, I need to implement custom import hooks for an application (http://www.python.org/dev/peps/pep

Re: Creating Import Hooks

2010-02-18 Thread Jean-Michel Pichavant
Sreejith K wrote: On Feb 18, 3:49 pm, Jean-Michel Pichavant wrote: Sreejith K wrote: On Feb 18, 1:57 pm, Steven D'Aprano wrote: On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: On Feb 17, 10:48 pm, Sreejith K wrote: Hi eve

Re: Constraints on __sub__, __eq__, etc.

2010-02-18 Thread Jean-Michel Pichavant
Andrey Fedorov wrote: It may be intuitive to you, but its not true, written down anywhere, nor assumed by the language, and the mathematical meaning of the operators doesn't matter to Python. Python purposefully does not enforce anything for these methods. Right, so neither is

Re: Executing Python code on another computer

2010-02-19 Thread Jean-Michel Pichavant
SiWi wrote: On Feb 19, 5:10 pm, "D'Arcy J.M. Cain" wrote: On Fri, 19 Feb 2010 07:52:59 -0800 (PST) SiWi wrote: So I wondered if it was possible to send the Python code I'm developing on the netbook to the workstation pc via wlan, let the script execute on the workstation pc and write

Re: Avoid converting functions to methods in a class

2010-02-23 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: I have a convention when writing unit tests to put the target of the test into a class attribute, as follows: class MyTest(unittest.TestCase): target = mymodule.someclass def test_spam(self): """Test that someclass has a spam attribute.""" self.fa

Re: What's Going on between Python and win7?

2010-02-23 Thread Michel Claveau - MVP
Hi! > Symbolic links are available in NTFS starting with Windows Vista. No. Hardlink come with NTFS, and already exists in W2K (and NT with specifics utilities). @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: python shell crashing on paste

2010-02-23 Thread Michel Claveau - MVP
Hi! Where (directory) are you, when the problem come? Have you try with UAC disabled? @+ -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: Pure virtual functions in Python?

2010-02-24 Thread Jean-Michel Pichavant
Arnaud Delobelle wrote: lallous writes: Hello How can I do something similar to pure virtual functions in C++ ? Let us consider this: class C1: # Pure virtual def cb(self, param1, param2): """ This is a callback @param param1: ... @param param2:

Re: Signature-based Function Overloading in Python

2010-02-24 Thread Jean-Michel Pichavant
Michael Rudolf wrote: Just a quick question about what would be the most pythonic approach in this. In Java, Method Overloading is my best friend, but this won't work in Python: >>> def a(): pass >>> def a(x): pass >>> a() Traceback (most recent call last): File "", line 1, in

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and it has its advantages: 1 docstri

Re: Signature-based Function Overloading in Python

2010-02-25 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Michael Rudolf wrote: First: Thanks for all the replies so far, they really helped me. Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant: >>> def a(x=None): if x is None: pass else: pass This is the way to do it python, and i

Re: Pure virtual functions in Python?

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: I still prefer not to call at all, even if it was an empty function. Regards, Elias Is there any way we could convince you that there is no point caring about this ? Even if you were trying to optimize speed, it would still require proof that an empty function is part of th

Re: Walking lists

2010-02-25 Thread Jean-Michel Pichavant
lallous wrote: Thank you all for the replies. The solution using Python 3's syntax look very intuitive. Thanks Tim, Arnaud for the idea (I am using 2.x) -- Elias On Feb 25, 1:28 pm, lallous wrote: Hello I am still learning Python, and have a question, perhaps I can shorten the code: L =

Re: Get dosctring without import

2010-02-26 Thread Jean-Michel Pichavant
Joan Miller wrote: When a package is imported, it gets the dosctring to store it in *__doc__*. Does that funcion is built in python? because I would want use it to get the docstring without import a package Epydoc, a documentation builder is able to do so with the --parse-only option. You co

Re: Docstrings considered too complicated

2010-02-26 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Thu, 25 Feb 2010 12:51:00 -0800 (PST) John Roth wrote: On Feb 24, 1:23 pm, Andreas Waldenburger wrote: a company that works with my company writes a lot of of their code in Python (lucky jerks). I've seen their code and it basically looks like this: ""

Re: Docstrings considered too complicated

2010-02-26 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Fri, 26 Feb 2010 09:09:36 -0600 Tim Daneliuk wrote: On 2/24/2010 2:23 PM, Andreas Waldenburger wrote: [stuff] Reminiscent of: mov AX,BX ; Move the contents of BX into AX Well, there might be some confusion there as to what

Re: Docstrings considered too complicated

2010-02-26 Thread Jean-Michel Pichavant
Roy Smith wrote: In article , Tim Daneliuk wrote: On 2/24/2010 2:23 PM, Andreas Waldenburger wrote: Hi all, a company that works with my company writes a lot of of their code in Python (lucky jerks). I've seen their code and it basically looks like this: """Function that does stuff

Re: Docstrings considered too complicated

2010-03-01 Thread Jean-Michel Pichavant
MRAB wrote: Gregory Ewing wrote: Mel wrote: You could think of it as a not bad use of the design principle "Clear The Simple Stuff Out Of The Way First". Destinations are commonly a lot simpler than sources That's not usually true in assembly languages, though, where the source and destina

Re: Class attributes / methods lost?

2010-03-01 Thread Jean-Michel Pichavant
Gabor Urban wrote: Hi guys, I am building a nested data structure with the following compontens: <> class Item: def __init__(self, pId, pChange, pComment): self.ID = pId self.Delta = pChange self.Comment = pComment def PrintItem(self): str = '%s,%s,%s'%

Re: Docstrings considered too complicated

2010-03-01 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Tue, 02 Mar 2010 03:18:30 +1100 Lie Ryan wrote: On 03/02/10 00:09, Andreas Waldenburger wrote: On Mon, 1 Mar 2010 05:01:49 -0800 (PST) alex23 wrote: Andreas Waldenburger wrote: But as I said: a) I am (we are) not in a position to imp

Re: Adding to a module's __dict__?

2010-03-02 Thread Jean-Michel Pichavant
Roy Smith wrote: >From inside a module, I want to add a key-value pair to the module's __dict__. I know I can just do: FOO = 'bar' at the module top-level, but I've got 'FOO' as a string and what I really need to do is __dict__['Foo'] = 'bar' When I do that, I get "NameError: name '__dict__'

Re: Docstrings considered too complicated

2010-03-02 Thread Jean-Michel Pichavant
Andreas Waldenburger wrote: On Tue, 02 Mar 2010 09:48:47 +1100 Ben Finney wrote: It's not our concern. Then I don't see what that problem is. There is none. I was griping about how stupid they are. That is a personal problem I have with their *code* (not software), and I tho

Re: Pylint Argument number differs from overridden method

2010-03-04 Thread Jean-Michel Pichavant
Wanderer wrote: On Mar 3, 2:33 pm, Robert Kern wrote: On 2010-03-03 11:39 AM, Wanderer wrote: Pylint W0221 gives the warning Argument number differs from overridden method. Why is this a problem? I'm overriding the method to add additional functionality. There are exce

Re: A "scopeguard" for Python

2010-03-04 Thread Jean-Michel Pichavant
Alf P. Steinbach wrote: From your post, the scope guard technique is used "to ensure some desired cleanup at the end of a scope, even when the scope is exited via an exception." This is precisely what the try: finally: syntax is for. You'd have to nest it. That's ugly. And more importantly,

Re: A "scopeguard" for Python

2010-03-04 Thread Jean-Michel Pichavant
Alf P. Steinbach wrote: * Jean-Michel Pichavant: Alf P. Steinbach wrote: From your post, the scope guard technique is used "to ensure some desired cleanup at the end of a scope, even when the scope is exited via an exception." This is precisely what the try: finally: syntax is for

Re: A "scopeguard" for Python

2010-03-04 Thread Jean-Michel Pichavant
Michael Rudolf wrote: Am 04.03.2010 17:32, schrieb Jean-Michel Pichavant: It looks like to me that 'with' statements are like decorators: overrated. Oh no, you just insulted my favourite two python features, followed immediately by generators, iterators and list comprehensions /

Re: Evaluate my first python script, please

2010-03-05 Thread Jean-Michel Pichavant
Pete Emerson wrote: I've written my first python program, and would love suggestions for improvement. I'm a perl programmer and used a perl version of this program to guide me. So in that sense, the python is "perlesque" This script parses /etc/hosts for hostnames, and based on terms given on t

Re: A "scopeguard" for Python

2010-03-05 Thread Jean-Michel Pichavant
Robert Kern wrote: On 2010-03-04 15:12 , Mike Kent wrote: On Mar 4, 12:30 pm, Robert Kern wrote: He's ignorant of the use cases of the with: statement, true. Ouch! Ignorant of the use cases of the with statement, am I? Odd, I use it all the time. No, I was referring to Jean-M

Re: Evaluate my first python script, please

2010-03-05 Thread Jean-Michel Pichavant
Duncan Booth wrote: Jean-Michel Pichavant wrote: You've already been given good advices. Unlike some of those, I don't think using regexp an issue in any way. Yes they are not readable, for sure, I 100% agree to that statement, but you can make them readable very easily. # no

Re: Escaping variable names

2010-03-05 Thread Jean-Michel Pichavant
Kamil Wasilewski wrote: Hi, Ive got an issue where a variable name needs to have a minus sign (-) in it. #Python 2.6 from SOAPpy import WSDL wsdlFile = "http://webapi.allegro.pl/uploader.php?wsdl"; server = WSDL.Proxy(wsdlFile) server.soapproxy.config.argsOrdering = {'doGetCountries': ['country

Re: isinstance(False, int)

2010-03-05 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Fri, 05 Mar 2010 18:14:16 +0100, mk wrote: isinstance(False, int) True >>> >>> isinstance(True, int) True Huh? Yes. Do you have an actual question? >>> issubclass(bool, int) True Huh?! Exactly. Bools are a late-comer to Python.

Re: Conditional based on whether or not a module is being used

2010-03-08 Thread Jean-Michel Pichavant
Pete Emerson wrote: On Mar 5, 1:14 pm, Chris Rebert wrote: On Fri, Mar 5, 2010 at 12:25 PM, Pete Emerson wrote: On Fri, Mar 5, 2010 at 12:17 PM, Chris Rebert wrote: On 3/5/10, Pete Emerson wrote: In a module, how do I create a conditional that will do something bas

Re: Import problem

2010-03-08 Thread Jean-Michel Pichavant
Johny wrote: I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import bmodule.py C:\>cd \ C:\>python Python 2.5 (r25:51908, S

Re: Import problem

2010-03-10 Thread Jean-Michel Pichavant
News123 wrote: Jean-Michel Pichavant wrote: Johny wrote: I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import

Re: Named loops for breaking

2010-03-10 Thread Jean-Michel Pichavant
Daniel Klein wrote: Hey, I did a little searching and couldn't really find much recent on this. The only thing I found was this: http://groups.google.com/group/comp.lang.python/browse_thread/thread/a696624c92b91181/5b7479fdc3362b83?lnk=gst&q=break+named+loop#5b7479fdc3362b83 Basically I'm wond

Re: pexpect and logging integration

2010-03-10 Thread Jean-Michel Pichavant
Lars Stavholm wrote: Hi all, has anyone managed to integrate pexpect and logging? I.e., I'd like to be able to pick up the dialog, commands sent and responses received, in my logging. I know about the pexpect logfile, and I can log things to stdout or stderr, but I really need to log using the

Re: about Telnetlib problem

2010-03-10 Thread Jean-Michel Pichavant
JEHERUL wrote: Dear All I am trying to telnet to a Cisco router . Following is my code . #code router.py import getpass import sys import telnetlib HOST = "router address" # router address is ommitted for security reason user = raw_input("Username : ") password = getpass.getpa

Re: logging: local functions ==> loss of lineno

2010-03-11 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Hi Vinay Sajip, I'm very glad discoverd your logging module ;-) (That's what I would have liked 25 years ago when I was working as a technical software developper!) Now I'm writing just some personal tools, I like python and want to use logging on a regular basis. Loggi

Re: a newbie's question

2010-03-11 Thread Jean-Michel Pichavant
PEYMAN ASKARI wrote: Hello I need some help dynamically reloading modules. As it turns out, it is not as simple as calling reload, as outlined here http://pyunit.sourceforge.net/notes/reloading.html Is there builtin support for this? The example they gave does not seem to work for me, and I

Re: bypass UAC control through python script (to be run from batchfile)

2010-03-11 Thread Michel Claveau - MVP
Hi ! Install a resident soff (script) by task-planified, in Administrator rights. Then, call this script from current work, for bypass UAC. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Need advice on starting a Python group

2010-03-12 Thread Jean-Michel Pichavant
News123 wrote: Jonathan Gardner wrote: On Thu, Mar 11, 2010 at 6:57 AM, gb345 wrote: And even when we've had volunteers, hardly anyone shows up! Any suggestions would be appreciated. Two things: One, only you and your friend really care. Let that sink in. No one is going to c

Re: to create variable from dict

2010-03-12 Thread Jean-Michel Pichavant
Luis M. González wrote: On Mar 12, 10:59 am, hiral wrote: Hi, Is there any way to create variables which name matches with dict key? For example: dict1 = {"abc":'1", "def":"2"} Now I am looking to have variable name abc and it's value be '1' etc. Pl. suggest. Thank you. Check out

Re: class inheritance

2010-03-15 Thread Jean-Michel Pichavant
JLundell wrote: I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, not a Value, I end up with stuff like this: x = Value(1) + Value(2) where x is

Re: staticmethod and setattr

2010-03-15 Thread Jean-Michel Pichavant
Am Montag, den 15.03.2010, 05:42 -0700 schrieb Michael.Lausch: On Mar 15, 11:40 am, Steven D'Aprano wrote: On Mon, 15 Mar 2010 01:43:02 -0700, Michael.Lausch wrote: Hi, I managed to get confused by Python, which is not such an easy task. The problem i have is root

Re: "Breaking" the __main__ script

2010-03-15 Thread Jean-Michel Pichavant
Steve Holden wrote: pyt...@bdurham.com wrote: Any reason you prefer PDB over WinPDB? http://winpdb.org/ Yes. I don't have Windows except one one PC :P WinPDB runs on non-Windows platforms :) One might reasonably argue that it has a pretty couter-intuitive name, then.

Re: "Breaking" the __main__ script

2010-03-15 Thread Jean-Michel Pichavant
vsoler wrote: Hello, I am still learning python, thus developnig small scripts. Some of them consist only of the main module. While testing them (debugging) I sometimes want to stop the script at a certain point, with something likestop, break, end or something similar. What statement ca

Re: "Breaking" the __main__ script

2010-03-15 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: vsoler wrote: Hello, I am still learning python, thus developnig small scripts. Some of them consist only of the main module. While testing them (debugging) I sometimes want to stop the script at a certain point, with something likestop, break, end or

Re: affectation in if statement

2010-03-16 Thread Jean-Michel Pichavant
samb wrote: Hi, I've found a work around, inspired from Rob Williscroft : class ReMatch(object): """ Object to be called : 1st time : do a regexp.match and return the answer (args: regexp, line) 2nd time : return the previous result (args: prev) """ def __cal

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly. BUT when I have to wrap the logger call in some other function, I always ge

Re: logging: local functions ==> loss of lineno

2010-03-19 Thread Jean-Michel Pichavant
Peter Otten wrote: Jean-Michel Pichavant wrote: Hellmut Weber wrote: Am 11.03.2010 12:14, schrieb Peter Otten: Hellmut Weber wrote: Logging works very well giving the filename and line number of the point where it is called. As long as I use the loggers directly

Re: Tuples vs. variable-length argument lists

2010-03-22 Thread Jean-Michel Pichavant
Spencer Pearson wrote: Hi! This might be more of a personal-preference question than anything, but here goes: when is it appropriate for a function to take a list or tuple as input, and when should it allow a varying number of arguments? It seems as though the two are always interchangeable. For

Re: accessing variable of the __main__ module

2010-03-22 Thread Jean-Michel Pichavant
News123 wrote: Hi, I wondered about the best way, that a module's function could determine the existance and value of variables in the __main__ module. What I came up with is: ### main.py ## import mod A = 4 if __name__ == "__main__": mod.f() ### mod.py ## def

Re: short-circuiting any/all ?

2010-03-22 Thread Jean-Michel Pichavant
kj wrote: I have a list of items L, and a test function is_invalid that checks the validity of each item. To check that there are no invalid items in L, I could check the value of any(map(is_invalid, L)). But this approach is suboptimal in the sense that, no matter what L is, is_invalid will be

Re: short-circuiting any/all ?

2010-03-23 Thread Jean-Michel Pichavant
kj wrote: Arguably, Knuth's "premature optimization is the root of all evil" applies even to readability (e.g. "what's the point of making code optimally readable if one is going to change it completely next day?") The guy who will change it will have to read it. The only waste would be if the

Re: logging: local functions ==> loss of lineno

2010-03-24 Thread Jean-Michel Pichavant
Peter Otten wrote: Vinay Sajip wrote: Sorry I'm a little late to this discussion. I could add a _findCaller function to the module (not part of the public API, but replaceable by someone who really needs to) which does the heavy lifting, and Logger.findCaller just calls it. Then those who ne

Re: Automatic import ?

2010-03-26 Thread Jean-Michel Pichavant
C. B. wrote: Hi everyone, I'm currently coding a C library which provides several modules and objects. Let's say that some of these objects are classes called AAA and BBB. The constructor of AAA needs to get BBB as argument. So I can run the following code : from mymodule import AAA from mymo

Re: python logging writes an empty file

2010-03-26 Thread Jean-Michel Pichavant
Ovidiu Deac wrote: Then I tried this: file = logging.FileHandler(logFileBasename, 'w') file.setLevel(logging.INFO) # set a format which is simpler for console use formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s',) # tell the handler to use th

Re: python logging writes an empty file

2010-03-26 Thread Jean-Michel Pichavant
Ovidiu Deac wrote: You set le level of your handler, but did not set the level of the logger itself. Replace file.setLevel(logging.INFO) by logging.getLogger().setLevel(logging.INFO) Log events are matched versus the logger level 1st, then the handler level (if applicable). Most of the time you

Re: Classes as namespaces?

2010-03-26 Thread Jean-Michel Pichavant
kj wrote: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Granted, this is not the "intended use" for classes, and therefore could be viewed as a misuse ("that's what dic

Re: Classes as namespaces?

2010-03-27 Thread Jean-Michel Pichavant
Jonathan Hartley wrote: On Mar 26, 6:26 pm, Luis M. González wrote: On 26 mar, 11:49, kj wrote: What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos)

Re: Automatic import ?

2010-03-27 Thread Jean-Michel Pichavant
C. B. wrote: [snip] It takes time to write the relative importations, that's ok, but I think it could be more pleasant for the end-user to not have to write a huge list of "from mymodule import xxx" if it is possible to take advantage of automatic importations. Cheers, In that particular ca

Re: "Usability, the Soul of Python"

2010-03-30 Thread Jean-Michel Pichavant
John Nagle wrote: Jonathan Hayward wrote: I've posted "Usability, the Soul of Python: An Introduction to the Python Programming Language Through the Eyes of Usability", at: http://JonathansCorner.com/python/ No, it's just a rather verbose introduction to Python, in dark brown type on a

Re: libpst - python bindings

2010-03-31 Thread Jean-Michel Pichavant
Richard Lamboj wrote: Hello, are there any python bindings for libpst? http://www.five-ten-sg.com/libpst/ https://alioth.debian.org/projects/libpst/ Kind Regards Richi http://www.lmgtfy.com/?q=libpst+python 3rd hit Cheers, JM -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess only good for win32?

2010-04-01 Thread Michel Claveau - MVP
Hi! > side-by-side configuration is incorrect Others have given you an explanation. A possibility: you use a DLL directly, without having installed. That is OK with some DLL, and no OK with others DLL. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: strange subprocess behavior when calling ps

2010-11-17 Thread Jean-Michel Pichavant
Roger Davis wrote: Hi all, [snip] Roger Davis # code follows #!/usr/bin/python import sys import subprocess def main(): psargs= ["/bin/ps", "-e"] try: ps= subprocess.Popen(psargs, stdout=subprocess.PIPE, close_fds=True) psout= ps.comm

Re: strange subprocess behavior when calling ps

2010-11-18 Thread Jean-Michel Pichavant
Roger Davis wrote: Completely off topic but I think the try clause could be rewritten that way: ... Don't use bare except clause, you're masking syntax errors for instance, which will be flagged as 'unexpected error in generation ...". In a more general manner, if something unexpected happens it'

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread Jean-Michel Pichavant
Tim Harig wrote: On 2010-11-18, noydb wrote: I have an executable that I want to run within python code. The exe requires an input text file, the user to click a 'compute' button, and then the exe calculates several output values, one of which I want to capture into a variable. Can I use P

Re: Distribution of Python Scripts

2010-11-19 Thread Jean-Michel Pichavant
tazz_ben wrote: Hi Folks - I'm an experienced programmer, but this is my first app with python, so I apologize for any stupidity on my part. So I've written/still working on a command line tool written in Python. It talks to a web service, so there really isn't anything in it that is dependen

Re: How to open html page in python resource file? ActiveX and Javascript addEventListener? Options

2010-11-21 Thread Michel Claveau - MVP
Hello! You will find (positive) answers in PyWin32 and his examples. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   11   12   >