Re: How to determine if IO redirection is occurring with the output from a Python program?

2012-04-17 Thread pat
Check os.isatty(fd). It will return True if fd is a terminal-like device. On Tue, Apr 17, 2012 at 5:21 PM, Edward d'Auvergne wrote: > Hi, > > I was wondering if anyone knows of how to detect when IO redirection > of any form is happening within a Python program? I would like to > emulate the beh

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread pat
Paramiko provides SSH2 support and is platform-independent (implemented purely in Python). Try it and see if it works for you. Link: http://www.lag.net/paramiko/.. On 04/18/2012 04:35 PM, Richard Shea wrote: On a *nix box this is a reasonable bit of Python : cmd = "ssh -o StrictHostKeyCheckin

Re: ANN: Louie-1.0b2 - Signal dispatching mechanism

2005-12-01 Thread Pat
Thomas Heller wrote: > > What is the difference between PyDispatcher and Louie? > (I'm still using a hacked version of the original cookbook recipe...) Not too much at this point, but the general differences are listed on this page: http://louie.berlios.de/changes.html Matt and I plan to experim

Re: Solutions for data storage?

2005-01-19 Thread Pat
Leif K-Brooks wrote: > I'm writing a relatively simple multi-user public Web application with > Python. It's a rewrite of a similar application which used PHP+MySQL > (not particularly clean code, either). My opinions on various Web > frameworks tends to vary with the phase of the moon, but current

Re: Solutions for data storage?

2005-01-19 Thread Pat
Posting using Google Groups messed up the formatting of those class definition examples. Assume that they contain the usual indentation of typical class definitions. ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-05 Thread Pat
e into multiline command. Ctrl+]Increase font size. Ctrl+[Decrease font size. Ctrl+=Default font size. >>> Hope that helps. Pat -- Patrick K. O'Brien Orbtechhttp://www.orbtech.com Schevo http://www.schevo.org Pypersyst http://www.pypersyst.org -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Wow! I must say, I'm less than impressed with the responses so far. I know Ilias can give the impression that he is just trolling, but I can assure you he is not. At least, not in this case. ;-) So in an effort to make some headway, I'm going to try to summarize the current state of affairs.

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
So what if someone appears to be a troll? Suck it up and rise above it. This thread started with legitimate questions. Unfortunately, almost every response has been dismissive, petty, and a complete waste of time and effort. Please respond to the issue or simply ignore it. The issue is real and

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
I thought I was being as clear and specific as I needed to be. Apparently not. I'm talking about compiling the original source code, per the recommendations made by Mike Fletcher and documented here: Python 2.4 Extensions w/ the MS Toolkit Compiler http://www.vrplumber.com/programming/mstoolkit/

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
between the two dlls? If I'm asking questions already answered elsewhere, I'd love a link to that resource, if you have it. Thanks, Pat Patrick K. O'Brien Orbtechhttp://www.orbtech.com Schevo http://www.schevo.org Pypersyst http://www.pypersyst.org -- http://mail.pyt

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Stephen, I appreciate your responses. Maybe "school bullies" was an exaggeration on my part. At the same time, I'm not sure it is good for the Python community to expect everyone to roll up their sleeves and hack at something to make it work. (And I don't mean to imply that you hold that opinio

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
>>users. I can't expect them to purchase a .NET compiler or go through a >See above. That answers the cost question (assuming that your interpretation of the licensing is correct, since I'm not a lawyer nor qualified to render much of an opinion on that). But there is still the issue of going t

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Stephen Kellet said: Pat, could you include some context in your replies? I have no idea if you are replying to my comments about Visual Studio Express or someone else? The only text I see in your replies is what you write, no text from the posting you are replying to. As it is I've ignore

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Fredrik Lundh wrote: > "Pat"wrote: > > > I thought I was being as clear and specific as I needed to be. > > Apparently not. I'm talking about compiling the original source code > > the python source or the extension source? > > > The bottom line

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Stephen Kellett wrote: > In message <[EMAIL PROTECTED]>, Pat > <[EMAIL PROTECTED]> writes > >That answers the cost question (assuming that your interpretation of > >the licensing is correct, since I'm not a lawyer nor qualified to > >render much of an

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Pat
Fredrik Lundh wrote: > "Pat" wrote: > > > Okay, I think we are pretty much talking about the same thing. My > > problem is not that I'm unable or unwilling to purchase a good > > compiler. My problem is that I don't want to make it a requirement of &g

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Pat
Fredrik Lundh wrote: > "Pat" wrote: > > > A few things. Primarily the fact that I'm not very experienced in C > > (the extensions that I need to have compiled are not written by me). > > Secondarily, the fact that the discussion threads I read made it seem

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-19 Thread Pat
Diez B. Roggisch wrote: > > >> Just out of curiousity: How many python extensions are you planning to > >> write? > > > > I estimate 10 to 100, depending on abstractional capabilities of the > > extension system. > > > >> And how many lines of pure python code have you written in your life? > > > >

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Pat
Nick Coghlan wrote: > Pat wrote: > > On Windows, most users are used to installing precompiled binary > > packages, rather than compiling from source. When you do have to > > compile from source, it often requires you to fiddle with nitty gritty > > details abou

Re: pycrust xmlrpclib problem

2006-08-15 Thread Pat
Timothy Gee wrote: > Have do a lot of lab work making use of xmlrpclib and am quite > dependent on it. I just started working with pycrust under Linux RH9, > and wanted to use it as my standard python environment, however, when I > import xmlrpclib, I get a segmentation fault. Command line still wo

I need suggests

2007-01-23 Thread Pat
I have to do a big programm. Could someone give me some suggests about IDE (on Linux) and books to learn. -- http://mail.python.org/mailman/listinfo/python-list

optparse question

2009-01-26 Thread Pat
Up until today, I never needed to pass any arguments to a Python program. I did all the requisite reading and found that I should use optparse instead of getopt. I read the documentation and since the words "simple" and "easy" often appeared in the examples and documentation, I just knew tha

Re: optparse question

2009-01-27 Thread Pat
If you mean with "/" as the option designator instead of "-": there doesn't appear to be a documented way of doing it. You would have to do some social engineering on the users to get them used to doing "dir -s -b". In any case I thought the number of Windows users who know how to fire up a Com

Re: optparse question

2009-01-27 Thread Pat
Thorsten Kampe wrote: * Pat (Mon, 26 Jan 2009 20:02:59 -0500) Up until today, I never needed to pass any arguments to a Python program. [...] getopt resolved my immediate need, but I would like to know how one could use optparse to extract out the options from something like "dir /s /b&q

Re: optparse question

2009-01-27 Thread Pat
I had no idea people were going to get so upset that I used a Windows example and go off on a tear. Nobody is upset, and nobody has "gone off on a tear". The point about the "Windows example" is that the docs say in a close-to-screamingly- obvious manner that /options are not supported, no ma

Re: optparse question

2009-01-27 Thread Pat
Peter Otten wrote: Pat wrote: The question was it possible to add a simple flag like 'd-' to optparse with no other parameters? Do you mean "d-" or "-d"? If the latter, what's wrong with Robert Kern's answer? Peter I mean "-d" since th

Re: len()

2009-02-01 Thread Pat
Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby I'm surprised that no one responded to that question. I keep making that mistake all the time myself. -- http://mail.python

Re: len()

2009-02-04 Thread Pat
Andreas Waldenburger wrote: On Sat, 31 Jan 2009 13:27:02 -0500 Pat wrote: Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby I'm surprised that no one respond

Re: len()

2009-02-08 Thread Pat
Gabriel Genellina wrote: En Wed, 04 Feb 2009 12:38:04 -0200, Pat escribió: Andreas Waldenburger wrote: On Sat, 31 Jan 2009 13:27:02 -0500 Pat wrote: Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len bef

Re: len()

2009-02-08 Thread Pat
Terry Reedy wrote: Pat wrote: Andreas Waldenburger wrote: On Sat, 31 Jan 2009 13:27:02 -0500 Pat wrote: Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby I'm

Re: lint for Python?

2008-10-06 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : I've been searching for a good multi-module lint checker for Python and I haven't found one yet. Pylint does a decent job at checking for errors only within a single module. Here's one of my problems. I have two modules. In modul

Array of dict or lists or ....?

2008-10-06 Thread Pat
I can't figure out how to set up a Python data structure to read in data that looks something like this (albeit somewhat simplified and contrived): States Counties Schools Classes Max Allowed Students Current enrolled Students Nebraska, Wabash, Newville, Ma

Re: Array of dict or lists or ....?

2008-10-07 Thread Pat
Dennis Lee Bieber wrote: On Mon, 06 Oct 2008 19:45:07 -0400, Pat <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: I can't figure out how to set up a Python data structure to read in data that looks something like this (albeit somewhat simplified and contrived)

Append a new value to dict

2008-10-13 Thread Pat
I know it's not "fair" to compare language features, but it seems to me (a Python newbie) that appending a new key/value to a dict in Python is awfully cumbersome. In Python, this is the best code I could come up with for adding a new key, value to a dict mytable.setdefault( k, [] ).append(

Re: Append a new value to dict

2008-10-13 Thread Pat
Pat wrote: I know it's not "fair" to compare language features, but it seems to me (a Python newbie) that appending a new key/value to a dict in Python is awfully cumbersome. In Python, this is the best code I could come up with for adding a new key, value to a dict mytabl

Re: Append a new value to dict

2008-10-16 Thread Pat
paul wrote: Pat schrieb: I know it's not "fair" to compare language features, but it seems to me (a Python newbie) that appending a new key/value to a dict in Python is awfully cumbersome. In Python, this is the best code I could come up with for adding a new key,

Re: regular expression question (re module)

2008-10-16 Thread Pat
Faheem Mitha wrote: Hi, I need to match a string of the form capital_letter underscore capital_letter number against a string of the form anything capital_letter underscore capital_letter number some_stuff_not_starting with a number DUKE1_plateD_A12.CEL. Thanks in advance. Please cc

Re: python debugger tips?

2008-10-16 Thread Pat
[EMAIL PROTECTED] wrote: Hi All, I'm switching to python from perl, and like the language a ton, but I find pdb and pydb to be vastly inferior debuggers to the perl version. In particular, I've grown very used to stepping into arbitrary functions interactively. For instance, in perl you can do

Re: PYTHON WORKING WITH PERL ??

2008-10-16 Thread Pat
Sean DiZazzo wrote: On Sep 29, 12:44 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: Sir, You are absolutely correct. I was praying to G_d I did not have to slaughter my project's source code in this manner. However, like life itself, I was given legacy source code (i.e. someone else erro

Re: IDE Question

2008-10-18 Thread Pat
Steve Phillips wrote: Hi All, I am just wondering what seems to be the most popular IDE. The reason I ask is I am currently at war with myself when it comes to IDE's. It seems like every one I find and try out has something in it that others don't and viceversa. I am in search for the perfect IDE

regexp in Python (from Perl)

2008-10-19 Thread Pat
I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this in Python which accomplishes the same thing: ip = ip[ :-1 ] i

re.search over a list

2008-10-19 Thread Pat
While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', str( mylist ) ) I'm not smart enough (total newbie) to code up a generator e

Re: re.search over a list

2008-10-20 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', s

Re: regexp in Python (from Perl)

2008-10-20 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this

question regarding list comprehensions

2008-10-20 Thread Pat
I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) and... string = "" for r in results: if not r.startswith( '#' ): string =+ r It seems that a list

Re: question regarding list comprehensions

2008-10-20 Thread Pat
Steven D'Aprano wrote: On Mon, 20 Oct 2008 10:20:03 -0400, Pat wrote: Finally, if someone could point me to a good tutorial or explain list compressions I would be forever in your debt. Think of a for-loop: for x in (1, 2, 3): x Creates x=1, then x=2, then x=3. It doesn't d

Re: question regarding list comprehensions

2008-10-20 Thread Pat
Diez B. Roggisch wrote: Pat wrote: I have written chunks of Python code that look this: new_array = [] for a in array: if not len( a ): continue new_array.append( a ) new_array = [a for a in array if len(a)] and... string = ""

Question about scope

2008-10-23 Thread Pat
I have a Globals class. In it, I have a variable defined something like this: remote_device_enabled = bool In one module, I assign True/False to Globals.remote_device_enabled. Once set, this value never changes. In another module, at the top after the imports statements, I tried this: from

Re: re.search over a list

2008-10-23 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : Bruno Desthuilliers wrote: Pat a écrit : While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't jus

Re: Question about scope

2008-10-23 Thread Pat
Bruno Desthuilliers wrote: Pat a écrit : I have a Globals class. Not sure it's such a great idea, but anyway... What's the use case for this class ? There are perhaps better (or at least more idiomatic) solutions... In it, I have a variable defined something

Re: regexp in Python (from Perl)

2008-10-24 Thread Pat
Bruno Desthuilliers wrote: MRAB a écrit : On Oct 19, 5:47 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Pat a écrit : (snip) ip = ip[ :-1 ] ip =+ '9' or: ip = ip[:-1]+"9" (snip) >>> re.sub(r'^(((\d+)\.){3})\d+$', "\g<1>9&quo

Re: Question about scope

2008-11-01 Thread Pat
Steven D'Aprano wrote: On Thu, 23 Oct 2008 11:38:35 -0400, Pat wrote: I have a Globals class. Well, that's your first mistake. Using global variables in a class is no better than using bare global variables. They're still global, and that's a problem: http://we

lint for Python?

2008-10-03 Thread Pat
I've been searching for a good multi-module lint checker for Python and I haven't found one yet. Pylint does a decent job at checking for errors only within a single module. Here's one of my problems. I have two modules. In module one, I have a function: def foo( host, userid, password ):

Re: lint for Python?

2008-10-05 Thread Pat
Miki wrote: Hello, In module one, I have a function: def foo( host, userid, password ): pass In module two, I call that function: foo( userid, password) lint doesn't find that error and it won't be caught until it's called while the program is running. pychecker does find these kind o

Screen placement based on screen resolution

2006-04-07 Thread Pat
I am trying to place a dialog in the center of the screen based on a users screen resolution. I can get the width and height of the screen, but I can't seem to use the following: root.geometry('WxH+X+Y') It appears the values for X and Y need to be integers and not a variable like width/2-40 S

Re: Screen placement based on screen resolution

2006-04-07 Thread Pat
Thanks. S "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tkinter takes strings as its arguments; it's TCL's legacy. You can use > string formatting for this: > > x = width/2-40 > y = height/2-30 > > root.geometry('%ldx%ld+%ld+%ld' % (width, height, x, y)) >

Re: Screen placement based on screen resolution

2006-04-08 Thread Pat
Thanks a lot for you response. S "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Pat" <[EMAIL PROTECTED]> wrote: > >> I am trying to place a dialog in the center of the screen based on a >> users >> screen r

Re: CGI Problem on MS IIS 5.0 - Trying to access files on other machines

2005-09-15 Thread Pat [MSFT]
Set the site to be Basic Authentication and login as you. I suspect that the .exe is either running as IWAM/IUSER (i.e. GUEST) or you are running into a double hop issue. Pat "paulp" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greetings, > > I&#

Re: CGI Problem on MS IIS 5.0 - Trying to access files on other machines

2005-09-16 Thread Pat [MSFT]
Don't change the account IIS is running under - that is a pretty big security issue waiting to happen. Change the authentication model for the web site to Basic, then logon as you. That will cause any execution to be in the security context you are expecting. Pat "paulp" &l

Re: Can one use Python to learn and even apply Functional Programming?

2014-02-16 Thread Pat Johnson
This made me grin. ;) -- https://mail.python.org/mailman/listinfo/python-list

Basic help

2014-05-20 Thread Pat Fourie
nd regards Pat -- This message has been scanned for viruses and dangerous content by Pinpoint, and is believed to be clean. -- https://mail.python.org/mailman/listinfo/python-list

Re: JUST GOT HACKED

2013-10-08 Thread Pat Johnson
I don't think you are allowed to use the word dumbass to describe anyone or anything buddy. On Tuesday, October 1, 2013 9:42:31 AM UTC-4, Ferrous Cranus wrote: > Στις 1/10/2013 4:27 μμ, ο/η Chris “Kwpolska” Warrick έγραψε: > > > On Tue, Oct 1, 2013 at 3:15 PM, Νίκος wrote: > > >> Στις 1/10/2

Re: JUST GOT HACKED

2013-10-08 Thread Pat Johnson
>From what I gather he was viewing files uploaded to the ftp folder and found >this warning.html file contained within... So my take on it is, someone just >uploaded it and this guy is freaking out making a buffoon out of himself. -- https://mail.python.org/mailman/listinfo/python-list

pyhon 1.5.2 problem

2014-06-19 Thread Pat Fourie
yone help as this did work before.I have recompiled everything but the problem still Exists. In anticipation, Many Thanks Pat p...@icon.co.za -- This message has been scanned for viruses and dangerous content by Pinpoint, and is believed to be clean. -- https://mail.python.org/mailman/listinfo/python-list

Boa Constructor error: "No section:editor"

2006-10-17 Thread Pat Nystrom
vocation of boa worked fine. Good luck! Pat -- http://mail.python.org/mailman/listinfo/python-list

Relative Imports

2007-07-17 Thread Pat O'Hara
7;ve never dealt with this. Thanks for your help, -Pat -- http://mail.python.org/mailman/listinfo/python-list