Re: subprocess module under python 2.7

2010-07-27 Thread Chris Rebert
On Tue, Jul 27, 2010 at 4:12 PM, Timothy W. Grove tim_gr...@sil.org wrote: I am using the following code to hide the console window when launching a subprocess under Windows.       startupinfo = subprocess.STARTUPINFO()       startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW      

Re: Multiprocessing zombie processes

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 3:30 AM, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message mailman.1127.1280014712.1673.python-l...@python.org, Chris Rebert wrote: Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr. Frankenstein. Most people try to /avoid/ making

Re: ValueError: invalid literal for int():

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 3:25 AM, lee san82m...@gmail.com wrote: Hi, I have a value, partintid = int(Screw plugg  (91_10 - untitled)) but i get ValueError: invalid literal for int(): Screw plugg  (91_10 - untitled) any help? That is most certainly not your actual exact code, since it has

Re: ValueError: invalid literal for int():

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert c...@rebertia.com wrote: On Mon, Jul 26, 2010 at 3:25 AM, lee san82m...@gmail.com wrote: Hi, I have a value, partintid = int(Screw plugg  (91_10 - untitled)) but i get ValueError: invalid literal for int(): Screw plugg  (91_10

Re: How to capture all the environment variables from shell?

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 4:36 PM, Peng Yu pengyu...@gmail.com wrote: Hi, R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm not sure what it does when os module is imported. But it seems that os.environ doesn't capture all the environment variable from the shell. Could

Re: Python acting weird

2010-07-25 Thread Chris Rebert
On Sun, Jul 25, 2010 at 5:08 PM, Westly Ward sonicrules1...@gmail.com wrote: x = {type:folder, name:sonicbot, data:[{type:folder, name:SonicMail, data:[{type:file, name:bbcode.py, compressed:False, contents:blahblahfilecontents}]}]} print x def setindict(dictionary, keys, value) :    if

Re: obtaining pid of child process

2010-07-25 Thread Chris Rebert
On Sun, Jul 25, 2010 at 9:02 PM, tazimk tazimkol...@gmail.com wrote: Hi, I am using python's multiprocessing module to spawn new process as follows : import multiprocessing import os d = multiprocessing.Process(target=os.system,args=('iostat 2 a.txt',)) d.start() I want to obtain pid

[issue9381] syntax error in Unicode C API docs

2010-07-25 Thread Chris Rebert
New submission from Chris Rebert pyb...@rebertia.com: See http://docs.python.org/py3k/c-api/unicode.html#file-system-encoding Note the literal and unhyperlinked :func:PyUnicode_FSConverter in the last sentence of the first paragraph. I suspect there's a trivial syntax error in the ReST source

[issue9382] os.popen referenced but not documented in Python 3.x

2010-07-25 Thread Chris Rebert
New submission from Chris Rebert pyb...@rebertia.com: http://docs.python.org/py3k/library/os.html currently mentions os.popen() in several places. The docs for os.popen() itself say: 'These functions are described in section File Object Creation' However, unlike the 2.x version

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-07-25 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: Added file: http://bugs.python.org/file18209/subprocess.rst.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7950

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-07-25 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: My apologies for the extra email... -- Added file: http://bugs.python.org/file18210/subprocess.rst.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7950

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-07-25 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: Removed file: http://bugs.python.org/file18209/subprocess.rst.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7950

Re: Multiprocessing zombie processes

2010-07-24 Thread Chris Rebert
On Sat, Jul 24, 2010 at 4:11 PM, Navkirat Singh navkir...@gmail.com wrote: OK I wanted zombie processes snip Now lets see how I can handle them. Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr. Frankenstein. Cheers, Chris -- Most people try to /avoid/ making zombies. --

Re: Multiple versions of Python coexisting in the same OS

2010-07-24 Thread Chris Rebert
On Sat, Jul 24, 2010 at 7:40 PM, Edward Diener eldie...@tropicsoft.invalid wrote: On 7/24/2010 6:25 AM, Mark Lawrence wrote: On 24/07/2010 04:17, Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to

Re: Unicode error

2010-07-23 Thread Chris Rebert
On Fri, Jul 23, 2010 at 3:14 AM, dirknbr dirk...@gmail.com wrote: I am having some problems with unicode from json. This is the error I get UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in position 61: ordinal not in range(128) Please include the full Traceback and the

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-07-23 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: I found some extra time. Here's an initial suggested patch against py3k head. Disclaimer: I have no special expertise in computer security beyond having read Secure Coding: Principles and Practices a while back. -- keywords: +patch

Re: an error about DJANGO_SETTINGS_MODULE

2010-07-22 Thread Chris Rebert
On Thu, Jul 22, 2010 at 1:14 AM, aimeixu aime...@amazon.com wrote: Hi, I use python Django framework to make a bookmark website, when I clicked  login button on  the user login page .and I  import from django.contrib.auth.models import User in the console,It will occur the following error:

Re: Convert Unix timestamp to Readable Date/time

2010-07-22 Thread Chris Rebert
On Thu, Jul 22, 2010 at 5:54 AM, kak...@gmail.com kak...@gmail.com wrote: Well i have the following number 1279796174846  i did the following: mdate = 1279796174846 tempStr = str(mdate) tempStr2 = tempStr[:-3] tempInt = int(tempStr2) print Last Login :,

[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-07-21 Thread Chris Rebert
Chris Rebert pyb...@rebertia.com added the comment: I'm busy with finding an apartment and taking exams for the next week-or-so, but after that I'll try and suggest a patch. If anyone wants to have a crack at it between now and then, don't let me stop you

Re: How is memory managed in python?

2010-07-20 Thread Chris Rebert
On Mon, Jul 19, 2010 at 6:30 PM, Vishal Rana ranavis...@gmail.com wrote: Hi, In my web application (Django) I call a function for some request which loads like 500 MB data from the database uses it to do some calculation and stores the output in disk. I just wonder even after this request is

Re: hasattr + __getattr__: I think this is Python bug

2010-07-20 Thread Chris Rebert
On Tue, Jul 20, 2010 at 3:10 AM, dmitrey dmitrey.kros...@scipy.org wrote: hi all, I have a class (FuncDesigner oofun) that has no attribute size, but it is overloaded in __getattr__, so if someone invokes myObject.size, it is generated (as another oofun) and connected to myObject as

Re: Kick off a delete command from python and not wait

2010-07-20 Thread Chris Rebert
On Tue, Jul 20, 2010 at 8:33 AM, loial jldunn2...@gmail.com wrote: I have a requirement to kick off a shell script from a python script without waiting for it to complete. I am not bothered about any return code from the script. What is the easiest way to do this. I have looked at popen but

Re: convert time to UTC seconds since epoch

2010-07-20 Thread Chris Rebert
On Tue, Jul 20, 2010 at 6:31 PM, Greg Hennessy greg.henne...@cox.net wrote: On 2010-07-20, Rami Chowdhury rami.chowdh...@gmail.com wrote: If you have a sufficiently recent version of Python, have you considered time.strptime: http://docs.python.org/library/time.html#time.strptime ? Given the

Re: convert time to UTC seconds since epoch

2010-07-20 Thread Chris Rebert
On Tue, Jul 20, 2010 at 6:48 PM, Greg Hennessy greg.henne...@cox.net wrote: On 2010-07-21, Chris Rebert c...@rebertia.com wrote: On Tue, Jul 20, 2010 at 6:31 PM, Greg Hennessy greg.henne...@cox.net wrote: Given the documentation talks about double leap seconds which don't exist, why should

Re: why is this group being spammed?

2010-07-18 Thread Chris Rebert
On Sun, Jul 18, 2010 at 12:49 AM, Johannes Kleese j.kle...@arcor.de wrote: On 18.07.2010 08:09, geremy condra wrote: On Sat, Jul 17, 2010 at 10:57 PM, Alf P. Steinbach /Usenet alf.p.steinbach+use...@gmail.com wrote: in in a social group by sharing that group's behavior and values. This

Re: rstrip()

2010-07-17 Thread Chris Rebert
On Fri, Jul 16, 2010 at 10:27 AM, MRAB pyt...@mrabarnett.plus.com wrote: Jason Friedman wrote: $ python Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) [GCC 4.4.1] on linux2 Type help, copyright, credits or license for more information. x.vsd-dir.rstrip(-dir) 'x.vs' I expected 'x.vsd'

Re: why is this group being spammed?

2010-07-17 Thread Chris Rebert
On Sat, Jul 17, 2010 at 10:01 PM, be.krul be.k...@gmail.com wrote: why is this group being spammed? Because that's what happens in unmoderated USENET newsgroups. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Best Pythonic Approach to Annotation/Metadata?

2010-07-16 Thread Chris Rebert
On Thu, Jul 15, 2010 at 12:37 PM, Sparky samnspa...@gmail.com wrote: Hello Python community! I am building a JSON-RPC web application that uses quite a few models. I would like to return JSON encoded object information and I need a system to indicate which properties should be returned when

Re: timing

2010-07-16 Thread Chris Rebert
On Fri, Jul 16, 2010 at 5:52 PM, Jia Hu huji...@gmail.com wrote: Hello: If I want to calculate the runtime of a section of a program. How can I do it? Taking you extremely literally: from time import time start = time() run_section_here() end = time() runtime = end-start Assuming you're

Re: python3: help with pickle

2010-07-15 Thread Chris Rebert
On Thu, Jul 15, 2010 at 3:34 AM, Alan alanwil...@gmail.com wrote: Hi there, This is more an exercise to myself to understand python3. I took a code I wrote (acpype) and I am trying to make it compatible with either python 3 or 2. I am trying to make a pickle file compatible with either python

Re: __getattribute__ hook and len() problem

2010-07-15 Thread Chris Rebert
On Thu, Jul 15, 2010 at 5:42 PM, ernest nfdi...@gmail.com wrote: Hi! I have this class that overrides the __getattribute__ method, so that it returns the attributes of str(self) instead of the attributes of self. class Part(object):    def __init__(self):        self.content = []    def

Re: IDLE won't start on Mac OSX

2010-07-15 Thread Chris Rebert
On Thu, Jul 15, 2010 at 9:49 PM, Dylan Gleason crazy8...@yahoo.com wrote: Hello, My name is Dylan. I am new to this list and am just getting started with Python and programming in general (although I have some experience with general UNIX wankery). I am trying to fire up Python ver. 2.7 with

Re: IDLE won't start on Mac OSX

2010-07-15 Thread Chris Rebert
On Thu, Jul 15, 2010 at 10:00 PM, Chris Rebert c...@rebertia.com wrote: On Thu, Jul 15, 2010 at 9:49 PM, Dylan Gleason crazy8...@yahoo.com wrote: Hello, My name is Dylan. I am new to this list and am just getting started with Python and programming in general (although I have some experience

Re: list.insert

2010-07-14 Thread Chris Rebert
On Wed, Jul 14, 2010 at 7:54 AM, Eric J. Van der Velden ericjvandervel...@gmail.com wrote: Hi, I understand this: l=[1,2,3] l[1:2]=[8,9] l [1,8,9,3] But how do you do this with list.insert? You can't clobber existing items in the list using just .insert(), so the closest you could get

Re: Check if a command is valid

2010-07-13 Thread Chris Rebert
On Tue, Jul 13, 2010 at 4:33 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Kenny Meyer wrote: I have to figure out if a string is callable on a Linux system. I'm actually doing this:    def is_valid_command(command):        retcode = 100 # initialize        if command:            

Re: python namespace question

2010-07-13 Thread Chris Rebert
On Tue, Jul 13, 2010 at 8:03 PM, chad cdal...@gmail.com wrote: Given the following code... #!/usr/bin/python class cgraph:    def printme(self):        print hello\n x = cgraph() x.printme() Does the function print() exist in the cgraph namespace or the printme() one? Neither. It

Re: Learn Python the Hard Way (online tutorial)

2010-07-12 Thread Chris Rebert
On Sun, Jul 11, 2010 at 10:03 PM, Paul Rubin no.em...@nospam.invalid wrote: I just came across this, a python tutorial purportedly intended for beginning programmers.  I only read the first few pages and I'm not crazy about the approach, but I haven't seen it mentioned here, and some folks

Re: Possible to create a read-only complex object?

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 12:45 AM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: On Mon, 12 Jul 2010 02:56:34 -0400, Terry Reedy wrote: On 7/11/2010 12:51 PM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other

Re: Netbeans plugin and Python 3

2010-07-12 Thread Chris Rebert
On Fri, Jul 9, 2010 at 9:27 AM, Nitin Pawar nitinpawar...@gmail.com wrote: Hi, I never tried python3.0 with netbeans but I use python 2.6.5 with netbean 6.7.1 Here is how I managed to change from python 2.5 (netbeans default) to 2.6.5 1) From the tools- plugins section install python plugin

Re: how to delete \n

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 1:27 PM, Jia Hu huji...@gmail.com wrote: Hi, I just want to delete \n at each line. My operating system is ubuntu 9.1. The code is as follows #!/usr/bin/python import string fileName=open('Direct_Irr.txt', 'r') # read file directIrr = fileName.readlines()

Re: Check if a command is valid

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 6:29 PM, Kenny Meyer knny.m...@gmail.com wrote: Hello, I have to figure out if a string is callable on a Linux system. I'm callable seems vague. Is a command string with invalid arguments but a valid executable callable? If no, then there's no general way to test

Re: Python 3 grammar, function parameters

2010-07-12 Thread Chris Rebert
On Mon, Jul 12, 2010 at 3:32 PM, Junkman j...@junkwallah.org wrote: Greetings to Python users, I'm trying to parse Python code using the grammar supplied with the documentation set, and have a question on the grammar for function parameters: funcdef: 'def' NAME parameters ['-' test] ':'

Re: Easy questions from a python beginner

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 2:08 PM, News123 news1...@free.fr wrote: Carl Banks wrote: On Jul 11, 10:48 am, wheres pythonmonks wherespythonmo...@gmail.com wrote: I'm an old Perl-hacker, and am trying to Dive in Python. Welcome to the light.  I have some easy issues (Python 2.6) which

Re: Possible to create a read-only complex object?

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 9:51 AM, pyt...@bdurham.com wrote: I have a complex object with attributes that contain lists, sets, dictionaries, and other objects. The lists and dictionaries may themselves contain complex objects. I would like to provide a read-only version of this type of object

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 7:15 PM, The Danny Bos danny...@gmail.com wrote: Heya, I'm running a py script that simply grabs an image, creates a thumbnail and uploads it to s3. I'm simply logging into ssh and running the script through Terminal. It works fine, but gives me an IOError every now

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 8:13 PM, The Danny Bos danny...@gmail.com wrote: Thanks gang, I'm gonna paste what I've put together, doesn't seem right. Am I way off? Here's my code.  - It goes through a table Item  - Matches that Item ID to an API call  - Grabs the data, saves it and creates the

Re: IOError and Try Again to loop the loop.

2010-07-11 Thread Chris Rebert
On Jul 12, 2:14 pm, Chris Rebert c...@rebertia.com wrote: On Sun, Jul 11, 2010 at 8:13 PM, The Danny Bos danny...@gmail.com wrote: Thanks gang, I'm gonna paste what I've put together, doesn't seem right. Am I way off? Here's my code.  - It goes through a table Item  - Matches

Re: Why doesn't python's list append() method return the list itself?

2010-07-11 Thread Chris Rebert
On Sun, Jul 11, 2010 at 10:03 PM, Nathan Rice nathan.alexander.r...@gmail.com wrote: Yeah, I long ago filed the in place place in the same folder as snip all() returning True for an empty iterable If you weren't taught about vacuous truth (or even identity elements) in Discrete Mathematics,

Re: how do you do a count of a result set?

2010-07-09 Thread Chris Rebert
On Fri, Jul 9, 2010 at 9:56 PM, Rene Veerman rene7...@gmail.com wrote: hi. i'm using this function;        def dbCacheGet(self, appParams):                results = db.GqlQuery(                        SELECT *            FROM DBcache            WHERE url='+appParams['urlCalled']+'    

Re: Writing Out from 2 Lists

2010-07-08 Thread Chris Rebert
On Thu, Jul 8, 2010 at 4:30 AM, Dlanor Slegov dlanorsle...@rocketmail.com wrote: Hi, I am trying to find a python solution for an informatics problem I have at work. Generalized equivalent of my problem is: I have an excel sheet with column 1 and column 2 having corresponding information

Re: Python -- floating point arithmetic

2010-07-08 Thread Chris Rebert
On Thu, Jul 8, 2010 at 8:52 AM, Giacomo Boffi giacomo.bo...@polimi.it wrote: Zooko O'Whielacronx zo...@zooko.com writes: I'm starting to think that one should use Decimals by default and reserve floats for special cases. would you kindly lend me your Decimals ruler? i need to measure the

Re: Python as a scripting language. Alternative to bash script?

2010-07-07 Thread Chris Rebert
On Wed, Jul 7, 2010 at 8:31 AM, Michael Torrie torr...@gmail.com wrote: On 07/06/2010 09:34 PM, Chris Rebert wrote: On Tue, Jul 6, 2010 at 6:40 AM, Michael Torrie torr...@gmail.com wrote: While it's possible to set up pipes and spawn programs in parallel to operate on the pipes, in practice

Re: Python as a scripting language. Alternative to bash script?

2010-07-06 Thread Chris Rebert
On Tue, Jul 6, 2010 at 1:35 PM, member thudfoo thud...@opensuse.us wrote: On Tue, Jul 6, 2010 at 6:40 AM, Michael Torrie torr...@gmail.com wrote: On 07/06/2010 04:12 AM, sturlamolden wrote: On 28 Jun, 19:39, Michael Torrie torr...@gmail.com wrote: In python I could simply take the output of ps

Re: Python as a scripting language. Alternative to bash script?

2010-07-06 Thread Chris Rebert
On Tue, Jul 6, 2010 at 6:40 AM, Michael Torrie torr...@gmail.com wrote: On 07/06/2010 04:12 AM, sturlamolden wrote: On 28 Jun, 19:39, Michael Torrie torr...@gmail.com wrote: In python I could simply take the output of ps ax and use python's own, superior, cutting routines (using my module):

Re: What is the name of the name space I am in?

2010-07-05 Thread Chris Rebert
On Mon, Jul 5, 2010 at 2:07 AM, Anthra Norell anthra.nor...@bluewin.ch wrote: I try to use new.new.classobj (name, baseclass, dict) and have no clue Slight tangent: Note that both the `new` module and old-style classes (which are what `classobj` produces) are deprecated. To produce new-style

Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)

2010-07-05 Thread Chris Rebert
On Mon, Jul 5, 2010 at 3:38 PM, Philip Semanchuk phi...@semanchuk.com wrote: On Jul 5, 2010, at 4:30 PM, D'Arcy J.M. Cain wrote: On Mon, 05 Jul 2010 14:42:13 -0400 Terry Reedy tjre...@udel.edu wrote: Good start. Now what is blocking those four? Lack of developer interest/time/ability? or

Re: markmin 0.1

2010-07-05 Thread Chris Rebert
On Mon, Jul 5, 2010 at 4:56 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: Markmin is a wiki markup language implemented in less than 100 lines of code (one file, no dependencies) easy to read secure support table, ul, ol, code support html5 video and audio elements can align images

Re: Python 3 put-downs: What's the point?

2010-07-04 Thread Chris Rebert
On Sun, Jul 4, 2010 at 5:05 PM, Roy Smith r...@panix.com wrote: In article mailman.238.1278287528.1673.python-l...@python.org,  Tim Chase python.l...@tim.thechases.com wrote: I've often wondered if changing the name of the language (such as Adder, Served, Dwarf or Fawlty for the Britcom fans

Re: Why Python forbids multiple instances of one module?

2010-07-04 Thread Chris Rebert
2010/7/4 CHEN Guang dr...@126.com: Why Python forbids multiple instances of one module? That's just how its import mechanism works. It allows for modules that need canonical program-wide state to rely on being singleton, and it's also an optimization. You can trick the import machinery and get

Re: subprocess query

2010-07-03 Thread Chris Rebert
On Sat, Jul 3, 2010 at 7:33 AM, Sudheer inbox1.sudh...@gmail.com wrote: Hi,  What's wrong with the following code. The program waits indefenitely at  'output = p2.stdout.read()' from subprocess import * p1=Popen(['tr', 'a-z', 'A-Z'],stdin=PIPE,stdout=PIPE) p2=Popen(['tr','A-Z',

Re: Why defaultdict?

2010-07-02 Thread Chris Rebert
On Fri, Jul 2, 2010 at 2:20 AM, Thomas Jollans tho...@jollans.com wrote: On 07/02/2010 06:11 AM, Steven D'Aprano wrote: I would like to better understand some of the design choices made in collections.defaultdict. snip Second, why is the factory function not called with key? There are three

Re: why python don't support extended slice direct assignment for lists?

2010-07-02 Thread Chris Rebert
On Fri, Jul 2, 2010 at 7:19 PM, Robert William Hanks astroultra...@gmail.com wrote: to say is wrong i think is a bit too much, its just a different type of usage, this type of sintax is extensively used in numpy arrays (extended slice came from numerical python), just asking why not extend the

Re: Reversing backslashed escape sequences

2010-07-01 Thread Chris Rebert
On Wed, Jun 30, 2010 at 10:50 PM, Steven D'Aprano steve-remove-t...@cybersource.com.au wrote: I have a byte-string which is an escape sequence, that is, it starts with a backslash, followed by either a single character, a hex or octal escape sequence. E.g. something like one of these in Python

Re: List-type attributes and name strings

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 3:56 AM, egbert egber...@xs4all.nl wrote: Normally you use setattr() if the name of the attribute is in a namestring: setattr(self, namestring, value) But my attributes are lists or dictionaries, and I don't seem to be able to use setattr anymore. Because you're not

Re: Solutions for hand injury from computer use

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 10:00 AM, Andreas Waldenburger use...@geekmail.invalid wrote: On Thu, 01 Jul 2010 09:35:31 -0700 Ethan Furman et...@stoneleaf.us wrote: I'll have to give the left-handed mouse a try... hmmm -- not too bad so far. Since we're on the subject: I find the best solution

Re: Python dynamic attribute creation

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 6:10 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: snip Engineers are quite happy to make the tools they need to make the tools they need to make the tools they need to make something. Carpenters would think you were crazy if you said that building a

Re: Why defaultdict?

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 9:11 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: I would like to better understand some of the design choices made in collections.defaultdict. Perhaps python-dev should've been CC-ed... Firstly, to initialise a defaultdict, you do this: from

Re: Is there a reference manual for pyparsing?

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 9:50 PM, John Nagle na...@animats.com wrote:  Is there a reference manual for pyparsing?  Not a tutorial.  Not a wiki. Not a set of examples.  Not a getting started guide. Something that actually documents what each primitive does?

Re: Is there a reference manual for pyparsing?

2010-07-01 Thread Chris Rebert
On Thu, Jul 1, 2010 at 10:08 PM, John Nagle na...@animats.com wrote: On 7/1/2010 10:02 PM, Chris Rebert wrote: On Thu, Jul 1, 2010 at 9:50 PM, John Naglena...@animats.com  wrote:  Is there a reference manual for pyparsing?  Not a tutorial.  Not a wiki. Not a set of examples.  Not a getting

Re: pyc runtime error

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 1:06 AM, Baris CUHADAR 189...@gmail.com wrote: Can anyone explain this unexpected behavior? all files chmod 755, i've compiled x.py with py_compilefiles, also tried within python console with import x system:  centos 5.4 32bit This a PATH related problem i think?

Re: Composition of functions

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 9:09 PM, Zubin Mithra zubin.mit...@gmail.com wrote: Hello, y=list(x).reverse() print y None L = [a, b, c] L.reverse() L [c, b, a] As you can see, L.reverse() performs the operation on itself and returns nothing. Hence, the return type None. Instead of

Re: Very odd output from subprocess

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 9:12 PM, m mtig...@gmail.com wrote: I have this function: def GetMakeOutput(make, rules, out=None):    p = subprocess.Popen('%s %s' % (make,rules),                         shell=True,                         bufsize=1024,                        

Re: Python dynamic attribute creation

2010-06-29 Thread Chris Rebert
On Tue, Jun 29, 2010 at 9:48 AM, WANG Cong xiyou.wangc...@gmail.com wrote: On 06/27/10 12:01, Carl Banks pavlovevide...@gmail.com wrote: On Jun 25, 8:24 pm, WANG Cong xiyou.wangc...@gmail.com wrote: Understand, but please consider my proposal again, if we switched to: setattr(foo, 'new_attr',

Re: 回复: I wander which is better? JSP or Pytho n? And is there a place for JSP?

2010-06-28 Thread Chris Rebert
-- 原始邮件 -- 发件人: Chris Rebertc...@rebertia.com; 发送时间: 2010年6月28日(星期一) 中午1:09 收件人: Rogerrogerda...@gmail.com; 主题: Re: I wander which is better? JSP or Python? And is there a place for JSP? On Sun, Jun 27, 2010 at 9:49 PM, Roger rogerda...@gmail.com wrote: As

Re: dynamically modify help text

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais bbl...@bryant.edu wrote: On Jun 27, 2010, at 22:37 , Red Forks wrote: Read you doc file and set the __doc__ attr of the object you want to change. On Monday, June 28, 2010, Brian Blais bbl...@bryant.edu wrote: I know that the help text for an

Re: I strongly dislike Python 3

2010-06-28 Thread Chris Rebert
On Mon, Jun 28, 2010 at 1:08 PM, Edward A. Falk f...@green.rahul.net wrote: In article mailman.2270.1277736664.32709.python-l...@python.org, Stephen Hansen  me+list/pyt...@ixokai.io wrote: No one said otherwise, or that print was useless and never used in such contexts. I was responding to

Re: Need instruction on how to use isinstance

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:30 PM, alex23 wuwe...@gmail.com wrote: Stephen Hansen me+list/pyt...@ixokai.io wrote: P.S. The removal of callable is something I don't understand in Python 3: while generally speaking I do really believe and use duck typing, I too have on occassion wanted to dispatch

Re: I wander which is better? JSP or Python? And is there a place for JSP?

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:49 PM, Roger rogerda...@gmail.com wrote: As I plan to study JSP, I find it extremly complicated and a part of J2EE. I did not attend to get the whole of J2EE. I hope anybody can describe the future of JSP. Is there a place for JSP? This is

Re: Need instruction on how to use isinstance

2010-06-27 Thread Chris Rebert
On Sun, Jun 27, 2010 at 9:54 PM, Stephen Hansen me+list/pyt...@ixokai.io wrote: On 6/27/10 9:30 PM, alex23 wrote: Stephen Hansenme+list/pyt...@ixokai.io  wrote: P.S. The removal of callable is something I don't understand in Python 3: while generally speaking I do really believe and use duck

Re: I strongly dislike Python 3

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 11:55 AM, Peter Kleiweg p.c.j.klei...@rug.nl wrote: Stephen Hansen schreef op de 26e dag van de zomermaand van het jaar 2010: There were various serious problems with Python 2 which could not be fixed in a backwards compatible way; we've been living with them for years

Re: Python dynamic attribute creation

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 6:06 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: snip CPython is a fairly plodding implementation. But that's due to the conservativeness of CPython: Unladen Swallow is faster, and PyPI is faster still, and the PyPI people expect to eventually be

Re: Why Is Escaping Data Considered So Magical?

2010-06-26 Thread Chris Rebert
On Sat, Jun 26, 2010 at 7:21 PM, Lawrence D'Oliveiro wrote: In message mailman.2123.1277522976.32709.python-l...@python.org, Tim Chase wrote: On 06/25/2010 07:49 PM, Lawrence D'Oliveiro wrote: ... I see that you published my unobfuscated e-mail address on USENET for all to see. I

Re: How to get the date format from the users locale?

2010-06-25 Thread Chris Rebert
On Fri, Jun 25, 2010 at 4:39 AM, Fabio Zadrozny fabi...@gmail.com wrote: I'm trying to get the locale-aware date format but it doesn't seem to be available through nl_langinfo in python 2.5.4 (windows vista). There is the %x format specifier in the time module, but it doesn't actually tell you

Re: Pythonic Idiom For Searching An Include Path

2010-06-23 Thread Chris Rebert
On Wed, Jun 23, 2010 at 3:27 PM, Tim Daneliuk tun...@tundraware.com wrote: Given a program 'foo' that takes a command line argument '-I includefile', I want to be able to look for 'includefile' in a path specified in an environment variable, 'FOOPATH'. I'd like a semantic that says:  If

Re: process cannot access the file because it is being used by other process

2010-06-21 Thread Chris Rebert
On Mon, Jun 21, 2010 at 6:44 AM, Felipe Vinturini felipe.vintur...@gmail.com wrote: snip Your problem seems to be with stdout redirect to the same file: YourOutput1.txt. Windows is not like Unix like systems! You can try, instead of redirecting to the same file, redirect each to a separate

Re: Problem using pbzip2 with bz2.BZ2File().read()

2010-06-21 Thread Chris Rebert
On Mon, Jun 21, 2010 at 5:32 PM, Ameet Nanda ameet.na...@gmail.com wrote: When I compress a file with bzip2 from command line and read it with uncomp_data = bz2.BZ2File(fname).read() , it reads the whole file into uncomp_data. However when I compress the file with pbzip2 from command line and

Re: Serializing functions

2010-06-17 Thread Chris Rebert
2010/6/17 Andreas Löscher andreas.loesc...@s2005.tu-chemnitz.de: Am Donnerstag, den 17.06.2010, 18:03 +0200 schrieb Andreas Löscher: Am Donnerstag, den 17.06.2010, 08:18 -0700 schrieb Paul Rubin: Matteo Landi landima...@gmail.com writes: I could be wrong, but it seems functions are not

Re: First program

2010-06-12 Thread Chris Rebert
On Sat, Jun 12, 2010 at 2:03 AM, Phil H skilp...@gmail.co.za wrote: Hi, Trying my hand with Python but have had a small hiccup. Reading  'A byte of Python' and created helloworld.py as directed. #!/usr/bin/python # filename : helloworld.py print 'Hello World' At the terminal prompt cd to

Re: tkinter doubt

2010-06-10 Thread Chris Rebert
On Thu, Jun 10, 2010 at 12:48 AM, Thomas Jollans tho...@jollans.com wrote: On 06/10/2010 08:50 AM, madhuri vio wrote: # File: hello2.py from Tkinter import * class App:     def __init__(self, master):         frame = Frame(master)         frame.pack()         self.button =

Re: regarding the dimensions in gui

2010-06-10 Thread Chris Rebert
On Thu, Jun 10, 2010 at 1:27 AM, Andreas Waldenburger use...@geekmail.invalid wrote: On Thu, 10 Jun 2010 08:37:21 +0100 Simon Brunning si...@brunningonline.net wrote: On 10 June 2010 08:19, Shashwat Anand anand.shash...@gmail.com wrote: And please stop using 'sir' for heaven's sake. Not

Re: gui related

2010-06-10 Thread Chris Rebert
On Thu, Jun 10, 2010 at 2:38 AM, madhuri vio madhuri@gmail.com wrote: in this program i tried..i am getting a name error... from Tkinter import* import Tkinter a = Tk() a.title (TOOL) entry = Tkinter.Canvas(a)    #creating the canvas under the root

Re: Python-list Digest, Vol 81, Issue 63

2010-06-09 Thread Chris Rebert
On Tue, Jun 8, 2010 at 11:57 PM, madhuri vio madhuri@gmail.com wrote: import tkinter root = tkinter.Tk() #initialize tkinter and get a top level instance root.title(madhuri is a python) canvas = tkinter.Canvas(root) #creating the canvas under the root canvas.pack() #to call the packer

Re: help me

2010-06-09 Thread Chris Rebert
On Wed, Jun 9, 2010 at 12:18 AM, madhuri vio madhuri@gmail.com wrote: this is the code i have written ..even after changing d module name i am still getting the same error... You still haven't renamed /home/manoj/tkinter.py to something else. Otherwise it wouldn't still be mentioned in the

Re: GUIs - A Modest Proposal

2010-06-09 Thread Chris Rebert
On Wed, Jun 9, 2010 at 1:45 AM, Lie Ryan lie.1...@gmail.com wrote: On 06/09/10 08:20, Martin P. Hellwig wrote: However I don't think that x11 represents that majority (just a gut feeling I have no data to back this claim up) of gui users, so an equal solution should be found for windows and

Re: help me

2010-06-09 Thread Chris Rebert
On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'.  By default a simple reply goes to the individual, and not to the list.  Make sure python-list@python.org is in your TO: list.  I'm sending this back to the list, with my remarks at the end, since

Re: help me

2010-06-09 Thread Chris Rebert
On Wed, Jun 9, 2010 at 4:07 PM, Chris Rebert c...@rebertia.com wrote: On Wed, Jun 9, 2010 at 3:37 PM, Dave Angel da...@ieee.org wrote: Note, I said REPLY-ALL'.  By default a simple reply goes to the individual, and not to the list.  Make sure python-list@python.org is in your TO: list

Re: How do subprocess.Popen(ls | grep foo, shell=True) with shell=False?

2010-06-09 Thread Chris Rebert
On Wed, Jun 9, 2010 at 9:15 PM, Chris Seberino cseber...@gmail.com wrote: How do subprocess.Popen(ls | grep foo, shell=True) with shell=False? I would think: from subprocess import Popen, PIPE ls = Popen(ls, stdout=PIPE) grep = Popen([grep, foo], stdin=ls.stdout) Cheers, Chris --

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Chris Rebert
On Tue, Jun 8, 2010 at 2:00 AM, ch1zra ch1...@gmail.com wrote: On Jun 8, 10:29 am, Richard Thomas chards...@gmail.com wrote: On Jun 8, 9:03 am, ch1zra ch1...@gmail.com wrote: I have following code : import os, time, re, pyodbc, Image, sys from datetime import datetime, date, time from

Re: how to get a reference to the __main__ module

2010-06-08 Thread Chris Rebert
On Tue, Jun 8, 2010 at 10:29 PM, WH whz...@gmail.com wrote: Hi, I want to use one of two functions in a script: def func_one(): pass def func_two(): pass func = getattr(x, 'func_'+number) func() 'x' in getattr() should be a reference to the __main__ module, right?  How to get it? from

Re: Importing modules

2010-06-06 Thread Chris Rebert
On Sun, Jun 6, 2010 at 8:16 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Anthony Papillion papill...@gmail.com writes: import os os.path.append('$HOME/gsutils/boto') thinking I could then successfully do the import boto statement. Nope. You'll need to give the literal path.

<    7   8   9   10   11   12   13   14   15   16   >