PyCon 2009 Survey waiting for you

2009-04-06 Thread Brian Ray
Greetings, For those of you who attended PyCon and did not fill out the Survey, here is your chance: http://us.pycon.org/2009/survey/ Hurry, this survey will be closed at the end of April. Your feedback and opinions are valuable in helping us improve PyCon every year. -- PyCon 2009

Re: Painful?: Using the ast module for metaprogramming

2009-04-06 Thread Joseph Garvin
On Mon, Apr 6, 2009 at 1:33 AM, Martin v. Löwis mar...@v.loewis.de wrote: -If I have the source to a single function definition and I pass it to ast.parse, I get back an ast.Module. Why not an ast.FunctionDef? Because it is easier for processing if you always get the same type of result.

Re: How to go about. On read/write locks

2009-04-06 Thread Diez B. Roggisch
Emanuele D'Arrigo schrieb: Hi everybody, I'm having a threading-related design issue and I suspect it has a name that I just don't know. Here's a description. Let's assume a resource (i.e. a dictionary) that needs to be accessed by multiple threads. A simple lock will do the job but in some

Re: exporting symbols with ctypes?

2009-04-06 Thread Diez B. Roggisch
Brian schrieb: I'd like to load a library that expects executables which link against it to provide a particular symbol. Is there a way to do the inverse of the in_dll() operation? I'd prefer to avoid creating a brand new library on the fly just to satisfy this one dependency. Maybe elmer

Re: Killing threads

2009-04-06 Thread bieffe62
On Apr 5, 9:48 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sun, 05 Apr 2009 12:54:45 +0200, Francesco Bochicchio bock...@virgilio.it declaimed the following in gmane.comp.python.general: If yor threads are not set as 'deamons' using Thread.setDaemon method, then your main program

Monitoring Internet Explorer

2009-04-06 Thread a b
Hi, I'm trying to write a program that monitor Internet Explorer events - creating/deletion of the process, loading pages, creating tabs etc. I managed to monitor creation/deletion by using WMI, but I couldn't find a way to monitor the rest of the events. Is there a way to do this ? Thanks.

Re: Killing threads

2009-04-06 Thread bieffe62
On 6 Apr, 05:25, ericwoodwo...@gmail.com wrote: On Apr 5, 11:07 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sun, 5 Apr 2009 17:27:15 -0700 (PDT), imageguy imageguy1...@gmail.com declaimed the following in gmane.comp.python.general: In threading.Event python 2.5 docs say;

Re: py2exe problem

2009-04-06 Thread Wolfgang Forstmeier
On 03.04.2009 15:58, Dave Angel wrote: Wolfgang Forstmeier wrote: snip / Ok, but do you really use idlelib for something? Or it's just some random code you found somewhere and drop into your application? Ah yes, I really use this. I create some message boxes for a little GUI application

decorators don't play nice with nose?

2009-04-06 Thread hyperboreean
Hi, I am trying to test the business part of a web service. For this I am using unittest nose. I wrote a decorator that should handle the xml test file retrieval, but it seems I can't get it working with nose. Here's the code: * MyApp.py -- base test class * import os import unittest from

Re: Need advise about an application

2009-04-06 Thread Hendrik van Rooyen
azrael jura.gr...mail.com wrote: I guess that this is not an option because of the case that the calculation of the needed statistics takes not always the same time nad I am afraid tht using sleep() would after a couple of time periods skip a meassurement. If I understand correctly what you

Re: Python2.4 and HTTPS

2009-04-06 Thread Jeremiah Dodds
On Sun, Apr 5, 2009 at 8:17 AM, Good Z goodz...@yahoo.com wrote: Dear all, I am using Python 2.4.3 for my project. We need to use HTTPS with python2.4.3 unfortunately it seems httplib is not working fine for me. Below is small code that works well with Python2.6.1 but not with Python2.4.3.

Re: Example for readline module usage?

2009-04-06 Thread Peter Otten
Grant Edwards wrote: [I swear I've asked this question before, but Google can't find it.] My Google is better than yours then: http://mail.python.org/pipermail/python-list/2008-July/669582.html Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: logging - string formating problems

2009-04-06 Thread Werner F. Bruhin
Werner F. Bruhin wrote: I see the following exception with a string formating problem. TypeError: not all arguments converted during string formatting Traceback (most recent call last): File /usr/lib/python2.5/logging/__init__.py, line 744, in emit msg = self.format(record) File

set python default encoding

2009-04-06 Thread reetesh nigam
Hi All, I am unable to set the python default encoding. i used the following proccess to set the python encoding import sys reload(sys) sys.setdefaultencoding('latin-1') but it is giving me the same error : args = ('utf8', MEDICINE '\xc4 , 10, 12, 'invalid data', bound method Root.history

Re: How to go about. On read/write locks

2009-04-06 Thread Emanuele D'Arrigo
On Apr 6, 7:49 am, Diez B. Roggisch de...@nospam.web.de wrote: The CPython-specific answer is that the GIL takes care of that for you right now anyway. So unless you plan for a distant future where some kind of swallows fly around that don't have a GIL, you are safe to simply read and write in

Re: How to go about. On read/write locks

2009-04-06 Thread Piet van Oostrum
Emanuele D'Arrigo man...@gmail.com (ED) wrote: ED Hi everybody, ED I'm having a threading-related design issue and I suspect it has a ED name that I just don't know. Here's a description. ED Let's assume a resource (i.e. a dictionary) that needs to be accessed ED by multiple threads. A simple

Re: logging - string formating problems

2009-04-06 Thread Steven D'Aprano
On Mon, 06 Apr 2009 11:11:37 +0200, Werner F. Bruhin wrote: Werner F. Bruhin wrote: I see the following exception with a string formating problem. TypeError: not all arguments converted during string formatting Traceback (most recent call last): File /usr/lib/python2.5/logging/__init__.py,

Re: How to free /destroy object created by PyTuple_New

2009-04-06 Thread Hrvoje Niksic
grbgooglefan ganeshbo...@gmail.com writes: Regarding PyTuple_New, when I pass this tuple with variable values set to some evaluation function like PyObject_CallObject, do I need to increment reference for this tuple then decrement again after the call returns? You don't. It is assumed that

Re: Painful?: Using the ast module for metaprogramming

2009-04-06 Thread Kay Schluehr
-It would be nice if decorators were passed a function's AST instead of a function object. As it is I have to use inspect.getsource to retrieve the source for the function in question, and then use ast.parse, which is a bit inefficient because the cpython parser has to already have done this

group several methods under a attribute

2009-04-06 Thread jelle
Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor would mixins really solve the issue. So, what is a pythonic way of grouping several methods under a attribute? Many thanks in

Re: HTTP Authentication

2009-04-06 Thread Gerhard Häring
Lakshman wrote: Whats is the python urllib2 equivallent of curl -u username:password status=abcd http://example.com/update.json I did this: handle = urllib2.Request(url) authheader = Basic %s % base64.encodestring('%s:%s' % (username, password)) handle.add_header(Authorization,

HTTP Authentication

2009-04-06 Thread Lakshman
Whats is the python urllib2 equivallent of curl -u username:password status=abcd http://example.com/update.json I did this: handle = urllib2.Request(url) authheader = Basic %s % base64.encodestring('%s:%s' % (username, password)) handle.add_header(Authorization, authheader) Is there a better

C API String Parsing/Returning

2009-04-06 Thread k3xji
Hi all, This might be a newbie question. I am trying to implement a simple string decoder/encoder algorithm. Just suppose I am substrcating some values from the string passed as a parameter to the function and I want the function to return encoded/decoded version of the string. Here is the call:

Re: logging - string formating problems

2009-04-06 Thread Peter Otten
Werner F. Bruhin wrote: Werner F. Bruhin wrote: I see the following exception with a string formating problem. TypeError: not all arguments converted during string formatting Traceback (most recent call last): File /usr/lib/python2.5/logging/__init__.py, line 744, in emit msg =

Re: C API String Parsing/Returning

2009-04-06 Thread k3xji
Sorry, Here is the correct output: ss= esauth.penc('s') print ss ╣ esauth.pdec(ss) '\xb9' print ss s -- Works fine!!! ss= esauth.penc('s') print ss s ss = esauth.pdec(ss) print ss ╣ -- how did this happen if the param and return values are same? I cannot understand this. Something has

Re: Killing threads

2009-04-06 Thread ericwoodworth
On Apr 6, 3:45 am, bieff...@gmail.com wrote: On 6 Apr, 05:25, ericwoodwo...@gmail.com wrote: On Apr 5, 11:07 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sun, 5 Apr 2009 17:27:15 -0700 (PDT), imageguy imageguy1...@gmail.com declaimed the following in

Re: group several methods under a attribute

2009-04-06 Thread Gerhard Häring
jelle wrote: Hi, I'm working on a pretty large class Can you describe what its purpose is? and I'd like to group several methods under a attribute. That doesn't work in Python without bending the Python. Its not convenient to chop up the class in several smaller classes, But that's

Re: C API String Parsing/Returning

2009-04-06 Thread Gerhard Häring
k3xji wrote: Hi all, This might be a newbie question. I am trying to implement a simple string decoder/encoder algorithm. Just suppose I am substrcating some values from the string passed as a parameter to the function and I want the function to return encoded/decoded version of the string.

Re: logging - string formating problems

2009-04-06 Thread Werner F. Bruhin
I am fully aware that the problem is in my code, however as getMessage in logging.__init__.py does not catch the exception it is pretty difficult to find the problem without manually inspecting any logging.something statements. My hack of logging.py is really a hack and I know that this can

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Chris Withers
Martin v. Löwis wrote: Chris Withers wrote: Martin v. Löwis wrote: I propose the following PEP for inclusion to Python 3.1. Please comment. Would this support the following case: I have a package called mortar, which defines useful stuff: from mortar import content, ... I now want to

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Jesse Noller
On Thu, Apr 2, 2009 at 4:33 PM, M.-A. Lemburg m...@egenix.com wrote: On 2009-04-02 17:32, Martin v. Löwis wrote: I propose the following PEP for inclusion to Python 3.1. Thanks for picking this up. I'd like to extend the proposal to Python 2.7 and later. -1 to adding it to the 2.x series.

Re: How to go about. On read/write locks

2009-04-06 Thread Emanuele D'Arrigo
On Apr 6, 12:44 pm, Piet van Oostrum p...@cs.uu.nl wrote: 3. See also http://code.activestate.com/recipes/465156/ Thank you for the useful suggestions Piet. In particular I just had a look at the SharedLock class provided through the link above and it seems to fit the bill quite nicely. I'll

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 6, 2009, at 9:21 AM, Jesse Noller wrote: On Thu, Apr 2, 2009 at 4:33 PM, M.-A. Lemburg m...@egenix.com wrote: On 2009-04-02 17:32, Martin v. Löwis wrote: I propose the following PEP for inclusion to Python 3.1. Thanks for picking this

Re: logging - string formating problems

2009-04-06 Thread MRAB
Werner F. Bruhin wrote: I am fully aware that the problem is in my code, however as getMessage in logging.__init__.py does not catch the exception it is pretty difficult to find the problem without manually inspecting any logging.something statements. My hack of logging.py is really a hack

Newbie: Development plaform

2009-04-06 Thread Hermann Wehrmeyer
Hi, I am looking for an old school friend of mine, Demos Economacos. Are you perhaps the Demos who completed schooling 1979 at Kroonstad SA. Groete/Greetings Hermann Wehrmeyer Tel: 012 342 3710 Fax: 012 342 3775 -- http://mail.python.org/mailman/listinfo/python-list

Re: C API String Parsing/Returning

2009-04-06 Thread Christian Heimes
Gerhard Häring wrote: char* buf = strdup(s); if (!buf) { PyErr_SetString(PyExc_MemoryError, Out of memory: strdup failed); return NULL; } /* TODO: your string manipulation */ Don't forget to free(buf). ;) Christian -- http://mail.python.org/mailman/listinfo/python-list

speed of string chunks file parsing

2009-04-06 Thread Hyunchul Kim
Hi, all I have a simple script. Can you improve algorithm of following 10 line script, with a view point of speed ? Following script do exactly what I want but I want to improve the speed. This parse a file and accumulate lines till a line match a given regular expression. Then, when a line

Re: speed of string chunks file parsing

2009-04-06 Thread MRAB
Hyunchul Kim wrote: Hi, all I have a simple script. Can you improve algorithm of following 10 line script, with a view point of speed ? Following script do exactly what I want but I want to improve the speed. This parse a file and accumulate lines till a line match a given regular

Re: decorators don't play nice with nose?

2009-04-06 Thread J Kenneth King
hyperboreean hyperbore...@nerdshack.com writes: From: hyperboreean hyperbore...@nerdshack.com Subject: decorators don't play nice with nose? Newsgroups: comp.lang.python To: python-list@python.org Date: Mon, 06 Apr 2009 11:01:04 +0300 Hi, I am trying to test the business part of a web

Re: Killing threads

2009-04-06 Thread Aahz
In article d7c02cf3-e4ed-4d64-a880-44e1510ec...@f19g2000yqo.googlegroups.com, bieff...@gmail.com wrote: I know that killing threads is hard in any language (I'm facing now the issue in a C++ program I'm writing at work), expecially doing in a platform-independent way, but Java managed to do it.

Re: Killing threads

2009-04-06 Thread Aahz
In article 685a59cd-9f02-483f-bc59-b55091a18...@u9g2000pre.googlegroups.com, imageguy imageguy1...@gmail.com wrote: Aahz: For more info, see the slides from my thread tutorial: http://pythoncraft.com/OSCON2001/ Aahz, thanks for this reference and link to your presentation. At the risk of

Q: Best book for teaching

2009-04-06 Thread grkuntzmd
I am considering teaching an introduction to programming course for continuing education adults at a local community college. These would people with no programming experience, but I will require a reasonable facility with computers. What would be a good book to use as the text for the course?

Re: Example for readline module usage?

2009-04-06 Thread Grant Edwards
On 2009-04-06, Peter Otten __pete...@web.de wrote: Grant Edwards wrote: [I swear I've asked this question before, but Google can't find it.] My Google is better than yours then: http://mail.python.org/pipermail/python-list/2008-July/669582.html It certainly is. All I could come up with

Re: Q: Best book for teaching

2009-04-06 Thread Reckoner
On Apr 6, 7:37 am, grkunt...@gmail.com wrote: I am considering teaching an introduction to programming course for continuing education adults at a local community college. These would people with no programming experience, but I will require a reasonable facility with computers. What would

object knows which object called it?

2009-04-06 Thread Reckoner
hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually need A (remember I said they were both

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Eric Smith
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 6, 2009, at 9:21 AM, Jesse Noller wrote: On Thu, Apr 2, 2009 at 4:33 PM, M.-A. Lemburg m...@egenix.com wrote: On 2009-04-02 17:32, Martin v. Löwis wrote: I propose the following PEP for inclusion to Python 3.1. Thanks for picking this

Re: group several methods under a attribute

2009-04-06 Thread jelle
Whatever it is, you should find a better way instead of cramming everything into a single class. That smells of the God Object antipattern (http://en.wikipedia.org/wiki/God_object). Thanks Gerard, I'll take your advice. -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread P.J. Eby
At 02:00 PM 4/6/2009 +0100, Chris Withers wrote: Martin v. Löwis wrote: Chris Withers wrote: Would this support the following case: I have a package called mortar, which defines useful stuff: from mortar import content, ... I now want to distribute large optional chunks separately, but

Re: speed of string chunks file parsing

2009-04-06 Thread bearophileHUGS
Hyunchul Kim: Following script do exactly what I want but I want to improve the speed. This may be a bit faster, especially if sequences are long (code untested): import re from collections import deque def scanner1(deque=deque): result_seq = deque() cp_regular_expression =

Re: speed of string chunks file parsing

2009-04-06 Thread bearophileHUGS
bearophile:     cp_regular_expression = re.compile(^a complex regular expression here$)     for line in file(inputfile):         if cp_regular_expression.match(line) and result_seq: Sorry, you can replace that with: cp_regular_expression = re.compile(^a complex regular expression

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Chris Withers
P.J. Eby wrote: See the third paragraph of http://www.python.org/dev/peps/pep-0382/#discussion Indeed, I guess the PEP could be made more explanatory then 'cos, as a packager, I don't see what I'd put in the various setup.py and __init__.py to make this work... That said, I'm delighted to

Re: [Python-Dev] PEP 382: Namespace Packages

2009-04-06 Thread Jesse Noller
On Mon, Apr 6, 2009 at 9:26 AM, Barry Warsaw ba...@python.org wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 6, 2009, at 9:21 AM, Jesse Noller wrote: On Thu, Apr 2, 2009 at 4:33 PM, M.-A. Lemburg m...@egenix.com wrote: On 2009-04-02 17:32, Martin v. Löwis wrote: I propose

Re: speed of string chunks file parsing

2009-04-06 Thread andrew cooke
[disclaimer - this is just guessing from general knowledge of regular expressions; i don't know any details of python's regexp engine] if your regular expression is the bottleneck rewrite it to avoid lazy matching, references, groups, lookbacks, and perhaps even counted repeats. with a little

Re: Example for readline module usage?

2009-04-06 Thread Peter Otten
Grant Edwards wrote: On 2009-04-06, Peter Otten __pete...@web.de wrote: Grant Edwards wrote: [I swear I've asked this question before, but Google can't find it.] My Google is better than yours then: http://mail.python.org/pipermail/python-list/2008-July/669582.html It certainly is.

object knows which object called it?

2009-04-06 Thread R. David Murray
Reckoner recko...@gmail.com wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 5:40 am, jelle jelleferi...@gmail.com wrote: Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor would mixins really solve the issue. So, what is a pythonic way of

Re: object knows which object called it?

2009-04-06 Thread Aaron Brady
On Apr 6, 9:53 am, Reckoner recko...@gmail.com wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside

Re: object knows which object called it?

2009-04-06 Thread Duncan Booth
Reckoner recko...@gmail.com wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually

set python default encoding

2009-04-06 Thread R. David Murray
reetesh nigam nigamreetes...@gmail.com wrote: Hi All, I am unable to set the python default encoding. i used the following proccess to set the python encoding import sys reload(sys) sys.setdefaultencoding('latin-1') but it is giving me the same error : args = ('utf8', MEDICINE

Injecting python function in an embedded python engine

2009-04-06 Thread Roberto Fichera
Hi All in the list, I've embedded python v2.6.x engine into my application without any problem. Now I would like to inject some additional functions after importing a python module. So, basically I'm importing a python module via PyImport_ImportModule() function. The python module is a simple set

Randomized Incremental Decision Tree

2009-04-06 Thread razafindrazaka faniry harijaona
Hello, How to model this problem as a python code: Starting with a general condition A, we enter a statement 'p' , if p satisfy A which is always the case, then split A to three sub-conditions A1,A2,A3. And we enter again a statement p1: if p1 satisfy A: if p1

Executing a C program from Python

2009-04-06 Thread vishakha vaibhav
Hi, I am very new to python. I have my cgi script written in Python. My CGI script should call a C program and collect the value returned by this program and pass it to the browser.   Can anyone help me out in this. How can I execute the c program and collect the return value.   I tried, import

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 12:02 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 6, 5:40 am, jelle jelleferi...@gmail.com wrote: Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor

Re: An executable operational semantics for Python

2009-04-06 Thread Piet van Oostrum
bearophileh...@lycos.com (b) wrote: b gideon: I've recently finished my Master's thesis on the semantics of Python. In my thesis I define the semantics of Python by rewriting an abstract machine. The sources that are used to produce my thesis can also be compiled into a working interpreter.

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-06 Thread Ant
On Apr 4, 7:09 am, Tim Golden m...@timgolden.me.uk wrote: ... Now I think about it, try searching for xplorer2 ... I'll second that. It's one of the few non-open source bits of software that I'll willingly pay a license for. Have used it for around 5 or 6 years now. It's by a little 1 man

Re: object knows which object called it?

2009-04-06 Thread Anthra Norell
Reckoner wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside of B actually need A (remember I said they

Re: Help with wxPython program :.: return 1?

2009-04-06 Thread Trent Mick
Dennis Lee Bieber wrote: I don't know what Komodo is coded in, but if it is using wx, you may be failing from having two mainloop processes... (same problem as trying to run a Tkinter application from inside IDLE, and probably trying to run a win32gui application from PythonWin) No,

Delicious API and urllib2

2009-04-06 Thread Bill
The delicious api requires http authorization (actually https). A generic delicious api post url is https:// username:passw...@api.api.del.icio.us/v1/posts/add?url=http:// example.com/description=interestingtags=whatever. This works fine when entered in the Firefox address bar. However

pycap (popcap gaming lib w python 2.5) mouse question

2009-04-06 Thread eric_dex...@msn.com
anyone use pycap based on popcap gaming lib.. http://www.farbs.org/pycap.html?? (not to be confused with the other pycap) I was trying to figure out why the mouse works in the example I didn't see any python code for it but It seem to have an effect in the example.. --

Re: logging - string formating problems

2009-04-06 Thread Vinay Sajip
On Apr 6, 1:58 pm, Werner F. Bruhin werner.bru...@free.fr wrote: I am fully aware that the problem is in my code, however as getMessage inlogging.__init__.py does not catch the exception it is pretty difficult to find the problem without manually inspecting anylogging.something statements.

Re: Accessing mail box tree of Thunderbird/Seamonkey?

2009-04-06 Thread robert
Chris Rebert wrote: On Sun, Apr 5, 2009 at 1:04 AM, robert rob...@nowhere.invalid wrote: Is there a API/possibilty for readingwriting (live) in the mail box tree of Thunderbird/Seamonkey with Python? From what I can google, they're already in mbox format, so you can use mailbox.mbox to

Re: Delicious API and urllib2

2009-04-06 Thread Brent Bloxam
Bill wrote: The delicious api requires http authorization (actually https). A generic delicious api post url is https:// username:passw...@api.api.del.icio.us/v1/posts/add?url=http:// example.com/description=interestingtags=whatever. This works fine when entered in the Firefox address bar.

Re: Executing a C program from Python

2009-04-06 Thread Brent Bloxam
vishakha vaibhav wrote: Hi, I am very new to python. I have my cgi script written in Python. My CGI script should call a C program and collect the value returned by this program and pass it to the browser. Can anyone help me out in this. How can I execute the c program and collect the

Best way to start

2009-04-06 Thread Avi
Hi, What is a good way to learn Python? Do you recommend going by a book (suggestions welcome) or learning with tutorials? Both? Thanks in advance, Avi -- http://mail.python.org/mailman/listinfo/python-list

Eval Problem

2009-04-06 Thread Victor Subervi
Hi: I have this code: x = 1 while x = bitties: file = open(p + str(x) + .txt) for line in file: print line print eval(bits[x - 1]) x += 1 which throws this error: [Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler mod_python.cgihandler: Traceback (most recent

Re: Best way to start

2009-04-06 Thread Chris Rebert
On Mon, Apr 6, 2009 at 12:08 PM, Avi avinashr...@gmail.com wrote: Hi, What is a good way to learn Python? Do you recommend going by a book (suggestions welcome) or learning with tutorials? Both? The official Python tutorial is pretty darn good: http://docs.python.org/tutorial/ If you want a

Weird Tk Canvas coordinate issue

2009-04-06 Thread Tim Shannon
I'm new to python, so keep that in mind. I have a tk Canvas that I'm trying to draw on, and I want to start my drawing at an offset (from 0) location. So I can tweak this as I code, I set this offset as a class level variable: def ClassName: OFFSET = 20 def __init__(self, master)):

cgi file limit size?

2009-04-06 Thread davidj411
I am wondering where the limitation of filesize comes from when i upload a large file. it uploads when the filesize is less than 20 MB (but not if larger). the script does not limit the filesize so it is either an HTTP specification or a webserver limit, right? maybe my connection to the server is

Re: group several methods under a attribute

2009-04-06 Thread jelle
Hi Aaron, Thanks a lot for your suggestions. I wasnt familiar with the __get__ magic, which seems interesting. So, finally it seems that the cleanest pattern is: class ClsA( object ): def __init__( self, other ): self.inst= other def submethA( self, arg ): print(

Re: object knows which object called it?

2009-04-06 Thread George Sakkis
On Apr 6, 10:53 am, Reckoner recko...@gmail.com wrote: hi, I have the following problem: I have two objects, say, A and B, which are both legitimate stand-alone objects with lives of their own. A contains B as a property, so I often do A.B.foo() the problem is that some functions inside

Re: Best way to start

2009-04-06 Thread andrew cooke
Avi wrote: What is a good way to learn Python? Do you recommend going by a book (suggestions welcome) or learning with tutorials? Both? how do you like to learn and how much experience do you have programming in other languages? andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to start

2009-04-06 Thread Tim Shannon
I personally learned a lot from www.diveintopython.org On Mon, Apr 6, 2009 at 2:08 PM, Avi avinashr...@gmail.com wrote: Hi, What is a good way to learn Python? Do you recommend going by a book (suggestions welcome) or learning with tutorials? Both? Thanks in advance, Avi --

Re: Best way to start

2009-04-06 Thread namekuseijin
I was able to get a friend into Python over a Google Chat. I pointed him to the downloads page, waited for him to install, then covered the basics in quite a few steps (syntax, conditionals, loops, function definition and application, classes and methods, lists, dicts and comprehensions).

Returning different types based on input parameters

2009-04-06 Thread George Sakkis
That's more of a general API design question but I'd like to get an idea if and how things are different in Python context. AFAIK it's generally considered bad form (or worse) for functions/methods to return values of different type depending on the number, type and/or values of the passed

Some test fail on my new Python 2.6

2009-04-06 Thread Sorin Schwimmer
Hi All, I just downloaded and compiled Python 2.6 on a Gentoo Linux, IBM NetVista. After going through the usual steps (./configure, make), I ran a test (make test), and got some unexpected issues, which are detailed here: # ./python Lib/test/test_tcl.py Traceback (most recent call last):

Re: Best way to start

2009-04-06 Thread Avi
A BIG Thanks to Chris and Andrew for suggestions. This is an awesome place. namekuseijin: haha...got a friend hooked to Python on chat? hilarious! -- http://mail.python.org/mailman/listinfo/python-list

Re: decorators don't play nice with nose?

2009-04-06 Thread Diez B. Roggisch
hyperboreean schrieb: Hi, I am trying to test the business part of a web service. For this I am using unittest nose. I wrote a decorator that should handle the xml test file retrieval, but it seems I can't get it working with nose. Here's the code: * MyApp.py -- base test class * import os

print from a python script.

2009-04-06 Thread Ronn Ross
I'm trying to print a simple string to a network printer. This is what I have so far: import os printer_path = 192.168.200.139 p = os.popen(printer_path, 'w') p.write(this is a printer test) p.close() I'm trying to call the printer from its IP address. When I run the script I get: sh:

Re: How to go about. On read/write locks

2009-04-06 Thread Diez B. Roggisch
This is a classical synchronization problem with a classical solution: You treat the readers as a group, and the writers individually. So you have a write lock that each writer has to acquire and release, but it is acquired only by the first reader and released by the last one. Therefore you

Re: print from a python script.

2009-04-06 Thread Chris Rebert
On Mon, Apr 6, 2009 at 2:24 PM, Ronn Ross ronn.r...@gmail.com wrote: I'm trying to print a simple string to a network printer. This is what I have so far: import os printer_path = 192.168.200.139 p = os.popen(printer_path, 'w') p.write(this is a printer test) p.close() I'm trying to

Re: How to go about. On read/write locks

2009-04-06 Thread Diez B. Roggisch
Python's approach with the GIL is both reasonable and disappointing. Reasonable because I understand how it can make things easier for its internals. Disappointing because it means that standard python cannot take advantage of the parallelism that can more and more often be afforded by today's

Re: Best way to start

2009-04-06 Thread namekuseijin
Avi escreveu: A BIG Thanks to Chris and Andrew for suggestions. This is an awesome place. namekuseijin: haha...got a friend hooked to Python on chat? hilarious! True story. But he was already a programmer. Only Pascal Delphi though. -- a game sig: http://tinyurl.com/d3rxz9 --

Re: Returning different types based on input parameters

2009-04-06 Thread MRAB
George Sakkis wrote: That's more of a general API design question but I'd like to get an idea if and how things are different in Python context. AFAIK it's generally considered bad form (or worse) for functions/methods to return values of different type depending on the number, type and/or

Re: print from a python script.

2009-04-06 Thread R. David Murray
Chris Rebert c...@rebertia.com wrote: On Mon, Apr 6, 2009 at 2:24 PM, Ronn Ross ronn.r...@gmail.com wrote: I'm trying to print a simple string to a network printer. This is what I have so far: import os printer_path = 192.168.200.139 p = os.popen(printer_path, 'w') p.write(this is

Re: Weird Tk Canvas coordinate issue

2009-04-06 Thread John Posner
Tim Shannon wrote: I'm new to python, so keep that in mind. I have a tk Canvas that I'm trying to draw on, and I want to start my drawing at an offset (from 0) location. So I can tweak this as I code, I set this offset as a class level variable: def ClassName: OFFSET = 20 def

extract Infobox contents

2009-04-06 Thread Anish Chapagain
Hi, I was trying to extract wikipedia Infobox contents which is in format like given below, from the opened URL page in Python. {{ Infobox Software | name = Bash | logo = [[Image:bash-org.png|165px]] | screenshot = [[Image:Bash demo.png|250px]] |

Re: Best way to start

2009-04-06 Thread namekuseijin
Google's automatic chat logging is nice too. My first online python tutorial for someone who never saw it before (sorry for not being in english): 14/09/08 00:50 KALEL: I'm on Phyton Shell 00:52 me: cool let's go type it: 2 just to get rid of your fears... :) KALEL: Hah hah hah hah

Some test fail on my new Python 2.6

2009-04-06 Thread R. David Murray
Sorin Schwimmer sx...@yahoo.com wrote: I just downloaded and compiled Python 2.6 on a Gentoo Linux, IBM NetVista. After going through the usual steps (./configure, make), I ran a test (make test), and got some unexpected issues, which are detailed here: # ./python Lib/test/test_tcl.py

How can I change size of GUI?

2009-04-06 Thread Muddy Coder
Hi Folks, I copied code from book: class ScrolledText(Frame): def __init__(self, parent=None, text='', file=None): Frame.__init__(self, parent) self.pack(expand=YES, fill=BOTH) self.makeWidgets() self.settext(text, file)

New online docs broken?

2009-04-06 Thread Jim Garrison
I notice the online docs (at docs.python.org/3.0/index.html) were updated today. It seems some of the top-level pages, like Tutorial, Using Python, Language Reference are truncated after the first few paragraphs. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >