Re: Loading a Python collection from an text-file

2006-01-26 Thread Ilias Lazaridis
[EMAIL PROTECTED] wrote: another approach (probably frowned upon, but it has worked for me) is to use python syntax (a dictionary, say, or a list) and just import (or reload) the file this sounds good. can I import a whole collection of instances this way? - (thanks for all the other

Re: Problems with import of modules

2006-01-26 Thread Ilias Lazaridis
the sys.path.append has done the work. thanks. . -- http://lazaridis.com -- http://mail.python.org/mailman/listinfo/python-list

Re: generating method names 'dynamically'

2006-01-26 Thread Murali
x.__class__.__dict__[mname](x,*args,**kwargs) here x is an instance of a class FOO FOO has a method bar (if the value of mname is bar) args is a tuple whose length is the number of positional arguments accepted by bar kwargs is a dictionary corresponding to the keyword arguments accepted by bar.

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
Is it possible to have method names of a class generated somehow dynamically? More precisely, at the time of writing a program that contains a class definition I don't know what the names of its callable methods should be. I have entries stored in a database that are changing from time

Re: ImportError: No module name MySQLdb

2006-01-26 Thread Fred
Fixed... All I did was change #!/usr/bin/python to #!/usr/local/bin/python The page loaded right up it was loading Python ver 2.4.1 rather than 2.4.2 where the MySQL db module was installed... I knew it would be something easy... I learned something so it was worth it... --

Re: beta.python.org content

2006-01-26 Thread Carl Banks
Roel Schroeven wrote: Steve Holden schreef: How does http://beta.python.org/about/beginners/ look? I think it's OK, apart from the fact that the font size of the text overrides my browser's default. It looks and reads much better without the font-size: 75%. I'll second this.

Re: generating method names 'dynamically'

2006-01-26 Thread Peter Hansen
Daniel Nogradi wrote: Thanks for all the replies, it became clear that I need to look into getattr, __getattr__ and __call__. I'll do that, but since you asked, here is the thing I would like to do in a little more detail: My database has 1 table with 2 fields, one called 'name' and the

Re: Codec Search Function

2006-01-26 Thread James Stroud
Giovanni Bajo wrote: James Stroud wrote: I'm using pyinstaller 1.0 (stable) on win32xp and it is not able to find the codec for several encodings (hex, base64, etc.). I resorted to writing my own for hex, just to see if I could get my program deployed. But I think a more permanent solution

Re: Changing numbers into characters using dictionaries

2006-01-26 Thread Colin Fox
On Thu, 26 Jan 2006 20:35:26 +, Danny wrote: Hello again, I am now trying to make something to change some encrypted text into some plain text, here is the code I have so far: text = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' // some text num = '213654' // Number s1 = '700' s2 = '770'

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
My database has 1 table with 2 fields, one called 'name' and the other one called 'age', let's suppose it has the following content, but this content keeps changing: Alice 25 Bob 24 --- program1.py class klass: # do the stuff with getattr

Re: Python String Substitution

2006-01-26 Thread Steven D'Aprano
On Thu, 26 Jan 2006 15:40:47 -0800, Murali wrote: In Python, dictionaries can have any hashable value as a string. No. Dictionaries can have any hashable value as a KEY. They are not automatically converted to strings. In particular I can say d = {} d[(1,2)] = Right d[(1,2)] = Wrong

Re: ODBC

2006-01-26 Thread Roger Upole
From the syntax, this appears to be the odbc module included with the Pywin32 package. http://sourceforge.net/projects/pywin32/ You probably have it installed with the 2.1.1 version, but not 2.4. hth Roger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to

Re: generating method names 'dynamically'

2006-01-26 Thread Michael Spencer
Daniel Nogradi wrote: ... - database content --- Alice 25 Bob 24 - program1.py - class klass: ... inst = klass() - program2.py --- import program1 # The code in klass above should be such that the following # line should

Re: generating method names 'dynamically'

2006-01-26 Thread Daniel Nogradi
Here you go: database = { ... Alice: 24, ... Bob:25} ... class Lookup(object): ... def __catcher(self, name): ... try: ... print Hello my name is %s and I'm %s % (name, database[name]) ... except KeyError: ...

Re: beta.python.org content

2006-01-26 Thread Michael Tobis
newer success stories please... mt -- http://mail.python.org/mailman/listinfo/python-list

Re: Python String Substitution

2006-01-26 Thread John Bauman
Murali [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In Python, dictionaries can have any hashable value as a string. In particular I can say d = {} d[(1,2)] = Right d[(1,2)] = Wrong d[key] = test In order to print test using % substitution I can say print %(key)s % d Is

Re: good library for pdf

2006-01-26 Thread David M. Cooke
Murali [EMAIL PROTECTED] writes: Pulling out pages from existing PDF files can be done with Open Source stuff. The simplest would be pdftk (PDF Toolkit). The most fancy will be using latex and the pdfpages package together with pdflatex. - Murali There's also pyPDF, at

Re: beta.python.org content

2006-01-26 Thread Michael Tobis
I like the design, though I'd prefer stronger colors. I think it would be a major improvement except for the logo. I agree with others that the logo is a serious disappointment. Although the symmetry has some initial appeal, I do not see or want to see a two-ness about Python, and I find it

Strange behavior of int()

2006-01-26 Thread Brian
Hello, Can someone tell me what I am doing wrong in this code. If I create a file change.py with the following contents: def intTest(M, c): r = M for k in c: print 'int(r/k) = ', int(r/k), 'r =', r, 'k =', k, 'r/k =', r/k r = r - (k*int(r/k))

Re: Strange behavior of int()

2006-01-26 Thread Dan Sommers
On 26 Jan 2006 18:42:34 -0800, Brian [EMAIL PROTECTED] wrote: If I execute a similar command from the command line, it works just fine: int(0.05/0.05) 1 Try this: print 2.3 - int(2.3/.25)*.25 0.05 2.3 - int(2.3/.25)*.25 0.049822 Then check out

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Alex Martelli
Christoph Conrad [EMAIL PROTECTED] wrote: Hallo Alex, r = re.compile([^a]*a{3}b+(a+b*)*) matches = [s for s in listOfStringsToTest if r.match(s)] Unfortunately, the OP's spec is even more complex than this, if we are to take to the letter what you just quoted; e.g. aazaaab SHOULD

Re: beta.python.org content

2006-01-26 Thread Shalabh Chaturvedi
Steve Holden wrote: How does http://beta.python.org/about/beginners/ look? Steve, This is a great writeup. Here are my comments: 1. Fortunately Python is something that an experienced programmer of another language (be it ... Add C# and/or Java to this list. The current list

Re: generating method names 'dynamically'

2006-01-26 Thread Peter Hansen
Daniel Nogradi wrote: Well, I would normally do what you suggest, using parameters, but in the example at hand I have to have the method names as variables and the reason is that the whole thing will be run by apache using mod_python and the publisher handler. There a URL

Re: regular expressions, unicode and XML

2006-01-26 Thread ProvoWallis
Thanks for this but I'm still getting an empty character (I don't know what else to call it) rather than the text captured by my regular expression in my replaced text. I even added the utf encoding declaration to my input data but still no luck. Any suggestions? --

Re: obtain client ip address from SimpleXMLRPCServer ?

2006-01-26 Thread stuff
Thanks for the reply Peter. Can you provide a code snippet for extracting this data. When I print the dir() of the SimpleXMLRPCServer instance I do not see a request_handler attribute or method. Phil -- http://mail.python.org/mailman/listinfo/python-list

Re: [IDE] - The Dynamic Opportunity - ActiveState Komodo IDE / Open Source

2006-01-26 Thread Ed Leafe
On Jan 26, 2006, at 6:37 PM, Ilias Lazaridis wrote: As a first step, a free personal edition (non-commercial and academic use) would help to spread the Komodo IDE within the communities. This would be a gentle contribution to the open source dynamic languages, which are a foundation for the

Intro to Pyparsing Article at ONLamp

2006-01-26 Thread Paul McGuire
I just published my first article on ONLamp, a beginner's walkthrough for pyparsing. Please check it out at http://www.onlamp.com/pub/a/python/2006/01/26/pyparsing.html, and be sure to post any questions or comments. -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: sockets programming with python on mobile phones

2006-01-26 Thread al pacino
Thanks ! well..acutally this is siddharth dave i am a BIG al pacino fan ..(and before joning this grp i had just watched 'scent of a woman) hence this pun on myself!! neways thanks for replying ps: dear edwards watch 'scent of a woman' and u will forget 'doniie brosco'..:-) AL pacino won an

any way to customize the is operator?

2006-01-26 Thread Lonnie Princehouse
There doesn't seem to be any way to customize the behavior of is as can be done for other operators... why not? -- http://mail.python.org/mailman/listinfo/python-list

Re: Running a DOS exe file from python

2006-01-26 Thread Rinzwind
Hello, Something like this: progname = 'c:\tmp\myprog.exe arg1 '+'-- help' os.system(r'progname) should work too. So you should be able to change progname to any location you need to start it and all the args to whatever is needed. -- http://mail.python.org/mailman/listinfo/python-list

ANN: HTMLTestRunner - generates HTML test report for unittest

2006-01-26 Thread aurora
Greeting, HTMLTestRunner is an extension to the Python standard library's unittest module. It generates easy to use HTML test reports. See a sample report at http://tungwaiyip.info/software/sample_test_report.html. Check more information and download from

Re: any way to customize the is operator?

2006-01-26 Thread Fredrik Lundh
Lonnie Princehouse wrote: There doesn't seem to be any way to customize the behavior of is as can be done for other operators... why not? because it does id(a) == id(b), and there's no way to customize the behaviour of id(). (objects are not allowed to lie about who they are, or what they

Re: Mining strings from a HTML document.

2006-01-26 Thread Derick van Niekerk
Thanks Guys! I've written several functions yesterday to import from different types of raw data including html and different text formats. In the end I never used the extract function or the parser module, but your advice put me on the right track. All these functions are now in a single object

Re: any way to customize the is operator?

2006-01-26 Thread Lonnie Princehouse
(objects are not allowed to lie about who they are, or what they are). Dangit! I need to find a less honest programming language. Anyone have a Perl cookbook handy? ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Codec Search Function

2006-01-26 Thread Fredrik Lundh
James Stroud wrote: How do I get the SVN version? Maybe that is not the one I have. This crashes on the version I have (complete program listing): abcde.encode('hex') LookupError: no codec search functions registered: can't find encoding I am using the latest enthought python and the

<    1   2   3