Re: Questions on XML

2009-08-21 Thread Emmanuel Surleau
> >> I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I > >> use Python to help me in this regard? > > > > I can say from experience that Python on Windows (at least, Python 2.5 > > on 32-bit Vista) works perfectly well with UTF-8 files containing > > Bangla. I have had trouble

Re: Questions on XML

2009-08-21 Thread joy99
On Aug 22, 10:53 am, Stefan Behnel wrote: > Rami Chowdhury wrote: > >> I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I > >> use Python to help me in this regard? > > > I can say from experience that Python on Windows (at least, Python 2.5 > > on 32-bit Vista) works perfectly

Re: Questions on XML

2009-08-21 Thread Kee Nethery
On Aug 21, 2009, at 7:15 PM, joy99 wrote: Dear Group, I like to convert some simple strings of natural language to XML. May I use Python to do this? If any one can help me, on this. I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I use Python to help me in this regard?

Re: Questions on XML

2009-08-21 Thread Stefan Behnel
Rami Chowdhury wrote: >> I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I >> use Python to help me in this regard? > > I can say from experience that Python on Windows (at least, Python 2.5 > on 32-bit Vista) works perfectly well with UTF-8 files containing > Bangla. I have h

Re: Questions on XML

2009-08-21 Thread Rami Chowdhury
I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I use Python to help me in this regard? I can say from experience that Python on Windows (at least, Python 2.5 on 32-bit Vista) works perfectly well with UTF-8 files containing Bangla. I have had trouble with working with

Re: 2.6 windows install

2009-08-21 Thread Kevin D . Smith
On 2009-08-21 11:43:31 -0500, Kevin D. Smith said: On 2009-08-21 10:39:09 -0500, "Martin v. Löwis" said: Did you install Python to the network device from your XP box? That would explain why you can run it: the required registry settings & environment variables are added by the installer, n

Re: 2.6 windows install

2009-08-21 Thread Kevin D . Smith
On 2009-08-21 10:39:09 -0500, "Martin v. Löwis" said: Did you install Python to the network device from your XP box? That would explain why you can run it: the required registry settings & environment variables are added by the installer, none of which is occurring on any computer other than th

Re: Questions on XML

2009-08-21 Thread David Smith
joy99 wrote: > Dear Group, > > I like to convert some simple strings of natural language to XML. May > I use Python to do this? If any one can help me, on this. > > I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I > use Python to help me in this regard? > > How can I learn

Re: Annoying octal notation

2009-08-21 Thread Steven D'Aprano
On Fri, 21 Aug 2009 14:48:57 -0500, Derek Martin wrote: >> It maybe made sense once but this relic of the past should have been >> consigned to the waste bin of history long ago. > > Sigh. Nonsense. I use octal notation *every day*, for two extremely > prevalent purposes: file creation umask, a

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Steven D'Aprano
On Fri, 21 Aug 2009 15:17:40 -0700, Jonathan Gardner wrote: >> Unfortunately, apply() has been removed as a built-in in 3.x. I'm not >> sure if it has been relocated to a module somewhere, there's no mention >> of such in the docs. > > apply = lambda f: f() > > It's one of those functions th

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread alex23
Jonathan Gardner wrote: > This is brilliant. I am going to use this more often. I've all but > given up on property() since defining "get_foo", "get_bar", etc... has > been a pain and polluted the namespace. Unfortunately I can't remember who I first learned it from - it was definitely in a post

Questions on XML

2009-08-21 Thread joy99
Dear Group, I like to convert some simple strings of natural language to XML. May I use Python to do this? If any one can help me, on this. I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I use Python to help me in this regard? How can I learn good XML aspects of Python. If

Re: Decompressing gzip over FTP

2009-08-21 Thread SeanMon
On Aug 21, 9:40 pm, Christian Heimes wrote: > SeanMon schrieb: > > > Is there a way to decompress a large (2GB) gzipped file being > > retrieved over FTP on the fly? > > > I'm using ftplib.FTP to open a connection to a remote server, and I > > have had no success connecting retrbinary to gzip with

Re: Decompressing gzip over FTP

2009-08-21 Thread Christian Heimes
SeanMon schrieb: Is there a way to decompress a large (2GB) gzipped file being retrieved over FTP on the fly? I'm using ftplib.FTP to open a connection to a remote server, and I have had no success connecting retrbinary to gzip without using an intermediate file. Is there any way to get a file-

Decompressing gzip over FTP

2009-08-21 Thread SeanMon
Is there a way to decompress a large (2GB) gzipped file being retrieved over FTP on the fly? I'm using ftplib.FTP to open a connection to a remote server, and I have had no success connecting retrbinary to gzip without using an intermediate file. Is there any way to get a file-like object describ

Re: Annoying octal notation

2009-08-21 Thread Ben Finney
Derek Martin writes: > Sure, but that won't stop people who've been writing code for 20 years > from continuing to type octal that way... Humans can learn fairly > easily, but UN-learning is often much harder, especially when the > behavior to be unlearned is still very commonly in use. This is

Invitation to connect on LinkedIn

2009-08-21 Thread Tim Heath
LinkedIn Tim Heath requested to add you as a connection on LinkedIn: -- Jaime, I'd like to add you to my professional network on LinkedIn. - Tim View invitation from Tim Heath http://www.linkedin.com/e/I2LlXdLlWUhFABKmxVOlgGLlWUhFAfhMPPF/bl

Re: Annoying octal notation

2009-08-21 Thread Ben Finney
Derek Martin writes: > James Harris wrote: > > It maybe made sense once but this relic of the past should have been > > consigned to the waste bin of history long ago. > > Sigh. Nonsense. I use octal notation *every day*, for two extremely > prevalent purposes: file creation umask, and Unix file

Re: Sanitising arguments to shell commands

2009-08-21 Thread Chris Rebert
On Fri, Aug 21, 2009 at 3:55 PM, Ben Finney wrote: > Rick King writes: > >> shlex doesn't handle unicode input though, so, in general, it's not a >> good solution. > > Argh. Is there a Python bug tracker number for fixing that? Indeed there is: http://bugs.python.org/issue1170 It even has a patc

Re: Annoying octal notation

2009-08-21 Thread James Harris
On 21 Aug, 22:18, MRAB wrote: > Piet van Oostrum wrote: > >> Derek Martin (DM) wrote: > > >> DM> I fail to see how 0O012, or even 0o012 is more intelligible than 012. > >> DM> The latter reads like a typo, and the former is virtually > >> DM> indistinguishable from 00012, O0012, or many other

Re: Code formatting question: conditional expression

2009-08-21 Thread Aahz
In article <87ocqchl2k@benfinney.id.au>, Ben Finney wrote: >"Diez B. Roggisch" writes: >> >> excessblk = None >> if total > P.BASE: >> excessblk = ... >> >> You don't lose any vertical space, > >I don't see vertical space as such a scarce resource; we don't have an >imminent newline shor

Re: Silly question

2009-08-21 Thread David C . Ullrich
On Fri, 21 Aug 2009 14:45:55 -0500, David C Ullrich wrote: >[...] > >Oops. Should have tested that a little more carefully >before posting. No time to fix it right now, customer just >got here. Let's just say we're looking for the primes >between sqrt(n) and n... from math import sqrt def Prime

Re: Annoying octal notation

2009-08-21 Thread James Harris
On 21 Aug, 20:48, Derek Martin wrote: ... > James Harris wrote: > > It maybe made sense once but this relic of the past should have been > > consigned to the waste bin of history long ago. > > Sigh.  Nonsense.  I use octal notation *every day*, for two extremely > prevalent purposes: file creati

Re: proposal: add setresuid() system call to python

2009-08-21 Thread Carl Banks
On Aug 21, 1:50 pm, travis+ml-pyt...@subspacefield.org wrote: > On Mon, Jul 20, 2009 at 04:10:35PM +0200, Hrvoje Niksic wrote: > > To emulate the os-module-type calls, it's better to raise exceptions > > than return negative values: > > > > def setresuid(ruid, euid, suid): > > >     return _setresu

Re: Sanitising arguments to shell commands

2009-08-21 Thread Ben Finney
Rick King writes: > shlex doesn't handle unicode input though, so, in general, it's not a > good solution. Argh. Is there a Python bug tracker number for fixing that? Or is there a better solution? -- \ “Pinky, are you pondering what I'm pondering?” “I think so, | `\ Brain, but if

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef writes: > On Aug 21, 4:26 am, Ben Finney wrote: > > Note that, after that list is created, each item in that list is > > *also* a reference to the corresponding object. That is, ‘a’ is a > > reference to an object, and ‘dk[0]’ is a *different* reference to > > the *same* object. The object

Re: Reading, writing files

2009-08-21 Thread MRAB
seanm wrote: In the book I am using, they give the following function as an example: def copyFile(oldFile, newFile): f1 = open(oldFile, 'r') f2 = open(newFile, 'w') while True: text = f1.read(50) This will read up to 50 characters from the input file. At the end of the file

Re: Help Please

2009-08-21 Thread Albert Hopkins
Why do you post the same question twice within 5 minutes of each other? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading, writing files

2009-08-21 Thread Albert Hopkins
On Fri, 2009-08-21 at 15:21 -0700, seanm wrote: > In the book I am using, they give the following function as an > example: > > def copyFile(oldFile, newFile): > f1 = open(oldFile, 'r') > f2 = open(newFile, 'w') > while True: > text = f1.read(50) > if text == "": >

Help Please

2009-08-21 Thread newb.py
In the book I am using, they give the following function as an example: def copyFile(oldFile, newFile): f1 = open(oldFile, 'r') f2 = open(newFile, 'w') while True: text = f1.read(50) if text == "": break f2.write(text) f1.close() f2.close()

Reading, writing files

2009-08-21 Thread seanm
In the book I am using, they give the following function as an example: def copyFile(oldFile, newFile): f1 = open(oldFile, 'r') f2 = open(newFile, 'w') while True: text = f1.read(50) if text == "": break f2.write(text) f1.close() f2.close()

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Gardner
On Aug 21, 9:09 am, alex23 wrote: > On Aug 21, 11:36 pm, Jonathan Fine wrote: > > class ColourThing(object): >     @apply >     def rgb(): >         def fset(self, rgb): >             self.r, self.g, self.b = rgb >         def fget(self): >             return (self.r, self.g, self.b) >         re

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Gardner
On Aug 21, 6:36 am, Jonathan Fine wrote: >     �...@apply >      def tags(): >          value = [] >          # complicated code >          return value > Is this different from: tags = [] # complicated code I can see the argument that you are cleaning up a lot of intermediary variables upon re

Re: IDLE file saving problem

2009-08-21 Thread r
On Aug 21, 4:10 pm, MRAB wrote: [snip] > That happens if you don't provide the extension, eg you save as > "my_script" instead of "my_script.py". (Perhaps IDLE should add the > extension if the user doesn't.) Yes, and much more needs improvement! I have made many changes already and i am polishin

Re: Three-Phase-Diagrams with matplotlib

2009-08-21 Thread Mark Lawrence
M. Hecht wrote: Hello, does anyone know whether it is possible to draw three-phase-diagrams with matplotlib? A three-phase-diagram is a triangular diagram applied in chemistry e.g. for slags where one has three main components of a chemical substance at the corners and points or lines within t

Re: Annoying octal notation

2009-08-21 Thread MRAB
Piet van Oostrum wrote: Derek Martin (DM) wrote: DM> I fail to see how 0O012, or even 0o012 is more intelligible than 012. DM> The latter reads like a typo, and the former is virtually DM> indistinguishable from 00012, O0012, or many other combinations that DM> someone might accidentally type

Re: IDLE file saving problem

2009-08-21 Thread MRAB
newb.py wrote: I am learning Python and need to use use IDLE, but I am having a problem. When I open a new window in IDLE and write my code, all is well. The coloring works and is very helpful. However, when I save the file I am working on, all the color disappears. And what is more frustrating i

IDLE file saving problem

2009-08-21 Thread newb.py
I am learning Python and need to use use IDLE, but I am having a problem. When I open a new window in IDLE and write my code, all is well. The coloring works and is very helpful. However, when I save the file I am working on, all the color disappears. And what is more frustrating is that when I ope

Re: proposal: add setresuid() system call to python

2009-08-21 Thread travis+ml-python
On Mon, Jul 20, 2009 at 04:10:35PM +0200, Hrvoje Niksic wrote: > To emulate the os-module-type calls, it's better to raise exceptions > than return negative values: > > > def setresuid(ruid, euid, suid): > > return _setresuid(__uid_t(ruid), __uid_t(euid), __uid_t(suid)) > > def setresuid(ruid

Re: 2.6 windows install

2009-08-21 Thread Martin v. Löwis
> The default windows install puts Python26.dll in \windows\system32. I > haven't tried this, but you could probably fix your install by moving > Python26.dll into the Python26 directory. Only the admin installation should do that (for all users). The "just for me" installation won't. Regards, Ma

Re: Annoying octal notation

2009-08-21 Thread Piet van Oostrum
> Derek Martin (DM) wrote: >DM> I fail to see how 0O012, or even 0o012 is more intelligible than 012. >DM> The latter reads like a typo, and the former is virtually >DM> indistinguishable from 00012, O0012, or many other combinations that >DM> someone might accidentally type (or intentionally

Re: Annoying octal notation

2009-08-21 Thread Derek Martin
On Fri, Aug 21, 2009 at 08:25:45PM +, Benjamin Peterson wrote: > > More than flushing out bugs, it will *cause* them in ubiquity, > > requiring likely terabytes of code to be poured over and fixed. > > 2to3, however, can fix it for you extreme easily. Sure, but that won't stop people who've b

Re: Annoying octal notation

2009-08-21 Thread Benjamin Peterson
Derek Martin pizzashack.org> writes: > More than flushing out > bugs, it will *cause* them in ubiquity, requiring likely terabytes of > code to be poured over and fixed. 2to3, however, can fix it for you extreme easily. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6 windows install

2009-08-21 Thread Matimus
On Aug 20, 10:21 am, "Tim Arnold" wrote: > Hi, > I installed python2.6 to a netapp device. I can use it from my local windows > machine (XP). But others cannot use it from their pcs. > > They get this response > "The system cannot execute the specified program.". > > If they double click on python

Re: Annoying octal notation

2009-08-21 Thread Benjamin Peterson
Simon Forman gmail.com> writes: > No. You would have to modify and recompile the interpreter. This is > not exactly trivial, see "How to Change Python's Grammar" > http://www.python.org/dev/peps/pep-0306/ And even that's incorrect. You'd have to modify the tokenizer. -- http://mail.python.o

Re: proposal: add setresuid() system call to python

2009-08-21 Thread travis
On Fri, Jul 17, 2009 at 04:59:53PM -0400, Jean-Paul Calderone wrote: > On Fri, 17 Jul 2009 15:01:41 -0500, travis+ml-pyt...@subspacefield.org wrote: >> I am suggesting that the setresuid function be added to python, >> perhaps in the OS module, because it has the clearest semantics for >> manipulat

Re: zlib interface semi-broken

2009-08-21 Thread Travis
I've come up with a good test for issue5210 and uploaded it to the bug tracker. This patch should be ready for inclusion now. -- Obama Nation | My emails do not have attachments; it's a digital signature that your mail program doesn't understand. | http://www.subspacefield.org/~travis/ If you a

Re: ncurses getch & unicode (was: decoding keyboard input when using curses)

2009-08-21 Thread Thomas Dickey
On Fri, 21 Aug 2009, Iñigo Serna wrote: 2009/8/21 Thomas Dickey : On Aug 20, 6:12 pm, Iñigo Serna wrote:     c = win.getch() You're using "getch", not "get_wch" (Python's ncurses binding may/may not have the latter). curses getch returns 8-bit values, get_wch would return wider values.

Re: Silly question

2009-08-21 Thread David C Ullrich
On Fri, 21 Aug 2009 14:40:30 -0500, David C Ullrich wrote: > On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote: > >> In article , >> Benjamin Kaplan wrote: >>>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich >>>wrot= e: I just noticed that sequence[i:j:k] >>> >>>Well, I got some goo

Re: Annoying octal notation

2009-08-21 Thread Derek Martin
John Nagle wrote: > Yes, and making lead zeros an error as suggested in PEP 3127 is a > good idea. It will be interesting to see what bugs that flushes > out. James Harris wrote: > It maybe made sense once but this relic of the past should have been > consigned to the waste bin of history long ag

Re: Silly question

2009-08-21 Thread David C Ullrich
On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote: > In article , > Benjamin Kaplan wrote: >>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich >>wrot= e: >>> >>> I just noticed that >>> sequence[i:j:k] >> >>Well, I got some good news and some bad news. According to the docs, it >>existed in 1.4 but

Re: convert date time

2009-08-21 Thread D'Arcy J.M. Cain
On Fri, 21 Aug 2009 14:43:55 -0400 Ronn Ross wrote: > On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain wrote: > > You don't say what database you are using but you may find it simpler > > to do the conversion in your SELECT statement. For example, see > > http://www.postgresql.org/docs/8.3/stat

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
alex23 wrote: Unfortunately, apply() has been removed as a built-in in 3.x. I'm not sure if it has been relocated to a module somewhere, there's no mention of such in the docs. The old use of apply() You can save yourself the tidy up by using the same name for the function & the label:

Re: convert date time

2009-08-21 Thread Ronn Ross
On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain wrote: > On Fri, 21 Aug 2009 14:14:32 -0400 > Ronn Ross wrote: > > I want to split it into two fields one with the date formatted like this: > > -MM-DD 2009-08-02 > > > > and the time to be 24 hour or military time. How every you call it. >

Re: Silly question

2009-08-21 Thread David C Ullrich
On Thu, 20 Aug 2009 17:45:11 -0700, John Machin wrote: > On Aug 21, 5:33 am, David C Ullrich wrote: > >> So I'm slow, fine. (There were several times when I was using 1.5.3 and >> wished they were there - transposing matrices, etc.) > > 1.5.THREE ?? Not sure. 1.SOMETHING. Sorry about the CONFU

Re: Mac OS 9.2

2009-08-21 Thread Tommy Nordgren
On Aug 18, 2009, at 6:04 PM, madzientist wrote: hi, i have to work with mac OS 9.2 for legacy reasons...is there a compiled version of python for this os ? i need to get input about variable values from the user and then print out some text files that make use of this input. a gui would be nic

Re: convert date time

2009-08-21 Thread D'Arcy J.M. Cain
On Fri, 21 Aug 2009 14:14:32 -0400 Ronn Ross wrote: > I want to split it into two fields one with the date formatted like this: > -MM-DD 2009-08-02 > > and the time to be 24 hour or military time. How every you call it. Similar > to this: > 15:22:00 > > I found it easy to truncate off the (

Re: TypeError while checking for permissions with os.access() on windows xp

2009-08-21 Thread Simon Forman
On Aug 21, 1:33 pm, ryniek90 wrote: > I've got some code that checks priviliges on two paths: > First - chosen by user > Second - hardcoded home directory represented by **os.getenv('HOME')** - > (os.getenv('HOME') works both on Linux and Windows) > > Here's the code: > " > def __check_set_perm(se

convert date time

2009-08-21 Thread Ronn Ross
I'm new to python and I'm getting a date time from a field in the database that looks like this: 8/2/2009 8:36:16 AM (UTC) I want to split it into two fields one with the date formatted like this: -MM-DD 2009-08-02 and the time to be 24 hour or military time. How every you call it. Similar t

Re: Object Reference question

2009-08-21 Thread Simon Forman
On Aug 21, 12:12 pm, josef wrote: > > > I need the object reference name (a,b,c,d) from dk to use as input for > > > a file. > > > You'll have to track that yourself. > > I'm a bit shocked that there isn't a method for catching object > reference names. I think that something like a = MyClass0(nam

Re: Python on Crays

2009-08-21 Thread Mark Dickinson
On Aug 21, 12:21 am, Carrie Farberow wrote: > I am trying to build a statically-linked Python based on directions at: > > http://yt.enzotools.org/wiki/CrayXT5Installation > > I have tried this on multiple systems.  The first time I attempt to build > python, 'make' runs fine but 'make install' fa

Re: Annoying octal notation

2009-08-21 Thread John Nagle
Simon Forman wrote: On Aug 20, 3:06 pm, David <71da...@libero.it> wrote: Hi all, Is there some magic to make the 2.x CPython interpreter to ignore the annoying octal notation? No. You would have to modify and recompile the interpreter. This is not exactly trivial, see "How to Change Python's

Re: Annoying octal notation

2009-08-21 Thread Mensanator
On Aug 21, 11:40 am, David <71da...@libero.it> wrote: > Il Thu, 20 Aug 2009 15:18:35 -0700 (PDT), Mensanator ha scritto: > > > (Just kidding! That works in 2.5 also. How are you using it where > > it's coming out wrong? I can see you pulling '012' out of a text > > file and want to calculate with i

Re: Python and PHP encryption/decryption

2009-08-21 Thread Piet van Oostrum
> "Diez B. Roggisch" (DBR) wrote: >DBR> Jean-Claude Neveu schrieb: >>> I'm looking for a recommendation about encryption/decryption packages for >>> Python. >>> >>> I'm working on a project that will require me to store some values in a >>> database in encrypted format. I'll be storing them

TypeError while checking for permissions with os.access() on windows xp

2009-08-21 Thread ryniek90
I've got some code that checks priviliges on two paths: First - chosen by user Second - hardcoded home directory represented by **os.getenv('HOME')** - (os.getenv('HOME') works both on Linux and Windows) Here's the code: " def __check_set_perm(self, rd_obj_path, backup_dest): try:

Re: Problem with winreg - The object is not a PyHKEY object

2009-08-21 Thread Stephen Hansen
On Fri, Aug 21, 2009 at 9:33 AM, Jamie wrote: > My goal is to remotely remove the registry keys for McAfee. I don't > know how winreg handles an exception if a key doesn't exist, but I > setup my script to skip the exception. But it doesn't seem to work > right.. I think the script should be self

Re: PIL and Python

2009-08-21 Thread Michele Petrazzo
catafest wrote: > I don't extract data from jpegs. I wanna put some data in this > (copyright of my site) ... > My wrap for freeimage, called freeimagepy :) can't, as now, wrote exif information on the image, but since freeimage can do it, I think that it's not so difficult to add this type of fe

Re: Annoying octal notation

2009-08-21 Thread MRAB
David wrote: Il Thu, 20 Aug 2009 22:24:24 +0200, Johannes Bauer ha scritto: David schrieb: If I want an octal I'll use oct()! "Explicit is better than implicit..." A leading "0" *is* explicit. It isn't explicit enough, at least IMO. Is this better? Python 3.1 (r31:73574, Jun 26 2009,

Re: Annoying octal notation

2009-08-21 Thread David
Il Thu, 20 Aug 2009 15:18:35 -0700 (PDT), Mensanator ha scritto: > (Just kidding! That works in 2.5 also. How are you using it where > it's coming out wrong? I can see you pulling '012' out of a text > file and want to calculate with it, but how would you use a > string without using int()? Passin

Re: Annoying octal notation

2009-08-21 Thread David
Il Thu, 20 Aug 2009 22:24:24 +0200, Johannes Bauer ha scritto: > David schrieb: > >> If I want an octal I'll use oct()! >> >> "Explicit is better than implicit..." > > A leading "0" *is* explicit. It isn't explicit enough, at least IMO. regards David -- http://mail.python.org/mailman/listi

Problem with winreg - The object is not a PyHKEY object

2009-08-21 Thread Jamie
My goal is to remotely remove the registry keys for McAfee. I don't know how winreg handles an exception if a key doesn't exist, but I setup my script to skip the exception. But it doesn't seem to work right.. I think the script should be self explanitory, please help! Please forgive me, but I'm a

Re: Object Reference question

2009-08-21 Thread josef
On Aug 21, 4:26 am, Ben Finney wrote: > josef writes: > > To be clear, Python uses a "Pass By Object Reference" model. > > Yes. (I'm glad this concept has propagated to newcomers so well :-) I found one really good discussion on python semantics versus other languages. It gave me this gem of a q

Re: Using 'apply' as a decorator, to define constants

2009-08-21 Thread alex23
On Aug 21, 11:36 pm, Jonathan Fine wrote: > It might seem odd to use 'apply' as a decorator, but it can make sense. Yes, it's an idiom I've used myself for property declarations, but one I find myself using less often: class ColourThing(object): @apply def rgb(): def fset(self, r

Re: 2.6 windows install

2009-08-21 Thread Martin v. Löwis
> Did you install Python to the network device from your XP box? That > would explain why you can run it: the required registry settings & > environment variables are added by the installer, none of which is > occurring on any computer other than the one from which you installed. In principle, Pyt

Re: pypi category

2009-08-21 Thread Martin v. Löwis
> Would someone be able to inform me how a category can be added to the > pypy list of categories? > I'd like to add a CAD & Geometry category. > ( I develop PythonOCC, wrappers for the OpenCASCADE CAD kernel, which > is why ) Make a specific proposal to catalog-...@lists.python.org, along with a

Three-Phase-Diagrams with matplotlib

2009-08-21 Thread M. Hecht
Hello, does anyone know whether it is possible to draw three-phase-diagrams with matplotlib? A three-phase-diagram is a triangular diagram applied in chemistry e.g. for slags where one has three main components of a chemical substance at the corners and points or lines within the triangle marki

Re: Conditionally skipping the contents of a with-statement

2009-08-21 Thread Diez B. Roggisch
tsuraan schrieb: I'd like to write a Fork class to wrap os.fork that allows something like this: with Fork(): # to child stuff, end of block will automatically os._exit() # parent stuff goes here This would require (I think) that the __enter__ method of my Fork class to be able to return a va

Conditionally skipping the contents of a with-statement

2009-08-21 Thread tsuraan
I'd like to write a Fork class to wrap os.fork that allows something like this: with Fork(): # to child stuff, end of block will automatically os._exit() # parent stuff goes here This would require (I think) that the __enter__ method of my Fork class to be able to return a value or raise an exc

Re: Object Reference question

2009-08-21 Thread Simon Forman
On Aug 21, 2:07 am, josef wrote: > To begin, I'm new with python. I've read a few discussions about > object references and I think I understand them. > > To be clear, Python uses a "Pass By Object Reference" model. > x = 1 > x becomes the object reference, while an object is created with the > ty

Pydev 1.4.8 Released

2009-08-21 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.4.8 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ---

Using 'apply' as a decorator, to define constants

2009-08-21 Thread Jonathan Fine
Hi It might seem odd to use 'apply' as a decorator, but it can make sense. I want to write: # Top level in module. tags = where the list is most easily constructed using a function. And so I write: @apply def tags(): value = [] # complicated code return

Logging with SMTP Error on Mac

2009-08-21 Thread Bev in TX
Hi, I've done some Python programming, but I still consider myself a Python newbie. I have a Mac Pro OS X 10.5.8 system and I installed Python 2.6.2 (the latest package available for the Mac) yesterday. I was working through Matt Wilson's article on using the logging module: http://blog.tplus1.c

Re: Sanitising arguments to shell commands

2009-08-21 Thread Rick King
shlex doesn't handle unicode input though, so, in general, it's not a good solution. Rick King Southfield MI http://docs.python.org/library/shlex.html module shlex — Simple lexical analysis New in version 1.5.2. "The shlex class makes it easy to write lexical analyzers for simple syntaxes res

Re: Sanitising arguments to shell commands

2009-08-21 Thread Jean-Michel Pichavant
Ben Finney wrote: Jean-Michel Pichavant writes: Can someone explain the difference with the shell argument ? giving for instance an example of what True will do that False won't. The ‘shell’ argument to the ‘subprocess.Popen’ constructor specifies whether the command-line should be i

Re: ncurses getch & unicode (was: decoding keyboard input when using curses)

2009-08-21 Thread Iñigo Serna
2009/8/21 Thomas Dickey : > On Aug 20, 6:12 pm, Iñigo Serna wrote: >>     c = win.getch() > > You're using "getch", not "get_wch" (Python's ncurses binding may/may > not have the latter). > curses getch returns 8-bit values, get_wch would return wider values. you are right, ncurses binding do

Re: Zipimport leaks memory?

2009-08-21 Thread Gabriel Genellina
En Thu, 20 Aug 2009 07:02:26 -0300, ashwin.u@nokia.com escribió: We are currently trying to identify and fix all the memory leaks by just doing Py_Initialize-PyRun_SimpleFile(some simple script)-Py_Finalize and found that there are around 70 malloc-ed blocks which are not freed. One

Re: Sanitising arguments to shell commands

2009-08-21 Thread Ben Finney
Chris Rebert writes: > module shlex — Simple lexical analysis > New in version 1.5.2. > "The shlex class makes it easy to write lexical analyzers for simple > syntaxes resembling that of the Unix shell." Exactly what I needed: >>> import shlex >>> user_configured_args = "--baz 'crunch cronch' -

Re: Sanitising arguments to shell commands

2009-08-21 Thread Ben Finney
Jean-Michel Pichavant writes: > Can someone explain the difference with the shell argument ? giving > for instance an example of what True will do that False won't. The ‘shell’ argument to the ‘subprocess.Popen’ constructor specifies whether the command-line should be invoked directly (‘shell=Fa

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef writes: > To be clear, Python uses a "Pass By Object Reference" model. Yes. (I'm glad this concept has propagated to newcomers so well :-) > x = 1 > x becomes the object reference It becomes *a* reference to that object, independent of any other references to that same object. > while a

Re: Sanitising arguments to shell commands

2009-08-21 Thread Jean-Michel Pichavant
Ben Finney wrote: Miles Kaufmann writes: I would recommend avoiding shell=True whenever possible. It's used in the examples, I suspect, to ease the transition from the functions being replaced, but all it takes is for a filename or some other input to unexpectedly contain whitespace or a me

Re: Sanitising arguments to shell commands (was: Waiting for a subprocess to exit)

2009-08-21 Thread Chris Rebert
On Fri, Aug 21, 2009 at 2:08 AM, Ben Finney wrote: > How can I take a string that is intended to be part of a command line, > representing multiple arguments and the shell's own escape characters as > in the above example, and end up with a sane command argument list for > ‘subprocess.Popen’? htt

Sanitising arguments to shell commands (was: Waiting for a subprocess to exit)

2009-08-21 Thread Ben Finney
Miles Kaufmann writes: > I would recommend avoiding shell=True whenever possible. It's used in > the examples, I suspect, to ease the transition from the functions > being replaced, but all it takes is for a filename or some other input > to unexpectedly contain whitespace or a metacharacter and

Re: Problem with arrays in a recursive class function

2009-08-21 Thread Bruno Desthuilliers
Aaron Scott a écrit : I have a list of nodes, and I need to find a path from one node to another. The nodes each have a list of nodes they are connected to, set up like this: class Node(object): def __init__(self, connectedNodes): self.connectedNodes = connectedNodes n

Re: Waiting for a subprocess to exit

2009-08-21 Thread Ben Finney
Miles Kaufmann writes: > On Aug 20, 2009, at 10:13 PM, Ben Finney wrote: > > Why would I use ‘os.waitpid’ instead of:: > > > >process = subprocess.Popen("mycmd" + " myarg", shell=True) > >process.wait() > >status = process.returncode > > Really, you can just use: > > process = subpr

Re: ncurses getch & unicode (was: decoding keyboard input when using curses)

2009-08-21 Thread Thomas Dickey
On Aug 20, 6:12 pm, Iñigo Serna wrote: > Hi again, > > 2009/8/20 Iñigo Serna > > I have the same problem mentioned > > inhttp://groups.google.com/group/comp.lang.python/browse_thread/thread/...some > > months ago. > > > Python 2.6 program which usesncursesmodule in a terminal configured to use

Re: difference between 2 arrays

2009-08-21 Thread Gabriel Genellina
En Thu, 20 Aug 2009 06:54:05 -0300, <""Michel Claveau - MVP"> escribió: Yes, the module sets is written, in doc, like "deprecated". But: - sets exist in Python 2.6 (& 2.5 or 2.4) - documentation of sets (module) is better tha, documentation of set (builtin) The best: read the documenta

Re: Object Reference question

2009-08-21 Thread Bruno Desthuilliers
josef a écrit : To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a "Pass By Object Reference" model. x = 1 x becomes the object reference, while an object is created with the type 'int', value 1, and identi

Re: PIL and Python

2009-08-21 Thread catafest
I don't extract data from jpegs. I wanna put some data in this (copyright of my site) ... On Aug 20, 2:01 pm, MaxTheMouse wrote: > On Aug 20, 10:23 am, catafest wrote: > > > On my photo jpg i have this : > > > Image Type: jpeg (The JPEG image format) > > Width: 1224 pixels > > Height: 1632 pixel

Re: Object Reference question

2009-08-21 Thread Dave Angel
josef wrote: To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a "Pass By Object Reference" model. x = 1 x becomes the object reference, while an object is created with the type 'int', value 1, and identifie

Re: #elements of seq A in seq B

2009-08-21 Thread Peter Otten
Jan Kaliszewski wrote: > 20-08-2009 o 13:01:29 Neal Becker wrote: > >> I meant #occurrences of characters from the set A in string B > > But: > > 1) separately for each element of A? (see Simon's sollution with > defaultdict) > > 2) or total number of all occurrences of elements of A? (see be

  1   2   >