Re: class error

2011-03-19 Thread Steven D'Aprano
On Sun, 20 Mar 2011 00:08:16 +, Rhodri James wrote: > It has to be said that the confusion is exacerbated by ignoring PEP-8 > and using the same (CamelCase) name for the module and the class. That > does provide a rich source of errors in cases like this. It's not so much that UserDict ignore

Re: Some Minor questions on Class and Functions

2011-03-19 Thread joy99
On Mar 20, 9:39 am, Steven D'Aprano wrote: > On Sat, 19 Mar 2011 16:57:58 -0700, joy99 wrote: > > Dear Group, > > > I am trying to pose two small questions. > > > 1) I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v. > > 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or

Re: send function keys to a legacy DOS program

2011-03-19 Thread John Nagle
On 3/10/2011 4:58 PM, Justin Ezequiel wrote: Greetings, We have an old barcode program (MSDOS and source code unavailable.) I've figured out how to populate the fields (by hacking into one of the program's resource files.) However, we still need to hit the following function keys in sequence. F5

Distributing Python Program

2011-03-19 Thread T
I have a Python program (which I've "frozen" via py2exe) that I'd like to distribute online, but I'm not sure of the steps to take. My thoughts were to create an account with RegNow or FastSpring, who could accept the payment and offer the download, but I'm unsure as to how you deal with licensing

Re: Some Minor questions on Class and Functions

2011-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2011 16:57:58 -0700, joy99 wrote: > Dear Group, > > I am trying to pose two small questions. > > 1) I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v. > 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" > for more information, on WINXP SP2.

import newer

2011-03-19 Thread xinyou yan
I begin to study with <> I met a problem with import. first I creat a file hello.py then in fedora /14 I type python to the interpreter >>> import hello Traceback (most recent call last): File "", line 1, in ImportError: No module named hello What should i do now. The current path is n

This algorithm written in Python solves at least a subset of the Hamilton Circuit problem, which is NP complete, in n^3 time.

2011-03-19 Thread Martin
This algorithm written in Python solves at least a subset of the Hamilton Circuit problem, which is NP complete, in n^3 time. #!/usr/bin/env python # # hamiltoncircuit.python # # Copyright 2011 Martin Musatov # # This program is free software; you may redistribute it and/or modi

Re: multiprocessing Pool workers cannot create subprocesses

2011-03-19 Thread Jason Grout
On 3/19/11 4:17 PM, John L. Stephens wrote: On 3/18/2011 7:54 PM, Jason Grout wrote: Right; thanks. Let me rephrase my questions: 1. Why is important that the multiprocessing Pool worker processors have daemon=True (I think this is the same as asking: why is it important that they be terminate

Re: os.walk/list

2011-03-19 Thread Dan Stromberg
You're not really supposed to call into the md5 module directly anymore; you might use hashlib instead. But actually, using a cryptographic hash doesn't really help comparing just one pair of files; it's more certain to do a block by block comparison, and the I/O time is roughly the same - actuall

Re: Some Minor questions on Class and Functions

2011-03-19 Thread Benjamin Kaplan
On Sat, Mar 19, 2011 at 7:57 PM, joy99 wrote: > > Dear Group, > > I am trying to pose two small questions. > > 1) I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v. > 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or > "license()" for more information, on WINXP SP2. > >

Re: Remove all directories using wildcard

2011-03-19 Thread Rikishi42
On 2011-03-18, JSkinn3 wrote: > I'm new to python and I am trying to figure out how to remove all sub > directories from a parent directory using a wildcard. For example, > remove all sub directory folders that contain the word "PEMA" from the > parent directory "C:\Data". > > I've trying to use

os.walk/list

2011-03-19 Thread ecu_jon
so i am trying to add md5 checksum calc to my file copy stuff, to make sure the source and dest. are same file. i implemented it fine with the single file copy part. something like : for files in sourcepath: f1=file(files ,'rb') try: shutil.copy2(files, os.path.join(dest

Re: class error

2011-03-19 Thread Rhodri James
On Sat, 19 Mar 2011 02:15:55 -, Terry Reedy wrote: On 3/18/2011 5:27 PM, monkeys paw wrote: TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) OK, i overlooked that and the error was not very enlightening. A detailed explanation: ever

Some Minor questions on Class and Functions

2011-03-19 Thread joy99
Dear Group, I am trying to pose two small questions. 1) I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v. 1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information, on WINXP SP2. As I am writing a code for class like the following: IDLE 2.6.

Re: send function keys to a legacy DOS program

2011-03-19 Thread Alexander Gattin
On Sun, Mar 20, 2011 at 12:52:28AM +0200, Alexander Gattin wrote: > On Thu, Mar 10, 2011 at 04:58:53PM -0800, Justin > Ezequiel wrote: > > We have an old barcode program (MSDOS and source code unavailable.) > > I've figured out how to populate the fields (by hacking into one of > > the program's re

Re: Reading/Writing files

2011-03-19 Thread Dan Stromberg
On Sat, Mar 19, 2011 at 12:55 AM, Nobody wrote: > On Fri, 18 Mar 2011 16:00:55 -0700, Ethan Furman wrote: > > Dan Stromberg wrote: > > > / works fine on windows, and doesn't require escaping ("/foo/bar"). > > "/" works fine in most contexts, but not in shell commands, where "/" is > conventionall

Re: send function keys to a legacy DOS program

2011-03-19 Thread Alexander Gattin
Hello, On Thu, Mar 10, 2011 at 04:58:53PM -0800, Justin Ezequiel wrote: > We have an old barcode program (MSDOS and source code unavailable.) > I've figured out how to populate the fields (by hacking into one of > the program's resource files.) > However, we still need to hit the following functio

Re: Syntax Error

2011-03-19 Thread Terry Reedy
On 3/19/2011 2:07 PM, Manatee wrote: C:\Users\Rivetmr\MyPythonScripts>Python Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] onI win32 Type "help", "copyright", "credits" or "license" for more information. I guess I have to go to an earlier version; maybe 2.6?

Re: multiprocessing Pool workers cannot create subprocesses

2011-03-19 Thread John L. Stephens
On 3/18/2011 7:54 PM, Jason Grout wrote: Right; thanks. Let me rephrase my questions: 1. Why is important that the multiprocessing Pool worker processors have daemon=True (I think this is the same as asking: why is it important that they be terminated with terminate() rather than join() )?

Re: puzzle about file Object.readlines()

2011-03-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, MRAB wrote: On 19/03/2011 13:15, 林桦 wrote: i use python 2.5. os is window 7. the puzzle is :python don't read the leave text when meet character: chr(26) the code is: /fileObject=open('d:\\temp\\1.txt','w') fileObject.write('22\r\n') fileObject.write(chr(26

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano wrote: > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote: > > I hope this is the place to post this question. I am a really new > > pythonista. I am studying Tkinter and when I run this basic code, I get > > a syntax error on line 20,  print "hi there, everyon

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano wrote: > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote: > > I hope this is the place to post this question. I am a really new > Also, this is what is printed in the window when I type "Python" C:\Users\Rivetmr\MyPythonScripts>Python Python 2.7.1 (r271:8683

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano wrote: > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote: > > I hope this is the place to post this question. I am a really new > > pythonista. I am studying Tkinter and when I run this basic code, I get > > a syntax error on line 20,  print "hi there, everyon

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 2:00 am, Terry Reedy wrote: > On 3/19/2011 1:03 AM, Vlastimil Brom wrote: > > > 2011/3/19 Manatee: > >> I hope this is the place to post this question. > > Yes. > Lesson 1. Report Python version used, as things change. For anything > that seems like it might by os/system specific, inclu

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 1:03 am, Vlastimil Brom wrote: > 2011/3/19 Manatee : > > > I hope this is the place to post this question. I am a really new > > pythonista. I am studying Tkinter and when I run this basic code, I > > get  a syntax error on line 20,  print "hi there, everyone". Its a > > simple print li

Re: puzzle about file Object.readlines()

2011-03-19 Thread MRAB
On 19/03/2011 13:15, 林桦 wrote: > i use python 2.5. os is window 7. > the puzzle is :python don't read the leave text when meet character: > chr(26) > the code is: > /fileObject=open('d:\\temp\\1.txt','w') > fileObject.write('22\r\n') > fileObject.write(chr(26)+'\r\n') > fileObject.writ

ANN: fathom 0.1.0

2011-03-19 Thread Filip Gruszczyński
Hello everyone! I have created a small python package for python3 called fathom that provides database inspection. It is in a very early stage, rather a proof of concept right now. It provides basic information about database schema and works with Sqlite3, PostgreSQL and MySQL. I am looking for co

ANN: PyGUI 2.4

2011-03-19 Thread Greg Ewing
PyGUI 2.4 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Highlights of this release: * Python 3 Compatible on MacOSX and Windows. * ScrollableView has been overhauled on Windows and should now work with all builds of pywin32 as far as I know. What is PyGUI? ---

Surge 2011 Conference CFP

2011-03-19 Thread Katherine Jeschke
We are excited to announce Surge 2011, the Scalability and Performance Conference, to be held in Baltimore on Sept 28-30, 2011. The event focuses on case studies that demonstrate successes (and failures) in Web applications and Internet architectures. This year, we're adding Hack Day on September 2

Re: value of pi and 22/7

2011-03-19 Thread D'Arcy J.M. Cain
On Fri, 18 Mar 2011 13:45:47 +0100 Stefan Behnel wrote: > Neil Cerutti, 18.03.2011 13:17: > > RIIght. What's a cubit? > > http://en.wikipedia.org/wiki/Cubit I don't believe that Neil was asking a serious question. http://www.youtube.com/watch?v=so9o3_daDZw -- D'Arcy J.M. Cain |

puzzle about file Object.readlines()

2011-03-19 Thread 林桦
i use python 2.5. os is window 7. the puzzle is :python don't read the leave text when meet character: chr(26) the code is: * fileObject=open('d:\\temp\\1.txt','w') fileObject.write('22\r\n') fileObject.write(chr(26)+'\r\n') fileObject.write('33') fileObjec

Re: ctypes pointer to structure memory swap

2011-03-19 Thread Wanderer
On Mar 18, 6:42 pm, Nobody wrote: > On Fri, 18 Mar 2011 15:16:40 -0700, Wanderer wrote: > > Thanks for the reply, but I'm still not sure I understand. Why should > > Object1 be at address1 and Object2 be at address2 and the next moment > > Object2 is at address1 and Object1 is at address2? I'll tr

Thanks...

2011-03-19 Thread wisecracker
Hi guys... A few weeks ago I joined here with a couple of code snippets that I gave away and someone on here - can`t remember who pointed me to:- http://code.activestate.com/recipes/langs/python/ Well I have uploaded 6 items but a day or so ago I uploaded this one:- http://code.activestate.com

Re: Bounds checking

2011-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2011 01:38:10 -0700, Martin De Kauwe wrote: >> Why don't you do the range check *before* storing it in state? That way >> you can identify the calculation that was wrong, instead of merely >> noticing that at some point some unknown calculation went wrong. > > I guess no reason rea

Re: install excel xlwt in ubuntu 9

2011-03-19 Thread J.O. Aho
ratna PB wrote: > Hey friends i tried a lot to install excel xlwt in ubuntu 9 but > failed > please help me before i get full fraustrated... sudo apt-get install python-xlwt -- //Aho -- http://mail.python.org/mailman/listinfo/python-list

Re: install excel xlwt in ubuntu 9

2011-03-19 Thread Alexander Kapps
On 19.03.2011 07:29, ratna PB wrote: Hey friends i tried a lot to install excel xlwt in ubuntu 9 but failed please help me before i get full fraustrated... What have you tried and how did it failed? On 9.10, simply do (you might need to enable the universe repository in Synaptic first): $ s

Re: Bounds checking

2011-03-19 Thread Martin De Kauwe
> Sorry, are you trying to say that it is not practical to write correct > code that isn't buggy? Well, you're honest, at least, still I can't help > but feel that you're admitting defeat before even starting. No. What I am saying is the code is written has been well tested and *appears* to be wo

Re: Bounds checking

2011-03-19 Thread Martin De Kauwe
> assert all(x >= 0 for x in (a, b, c, d, e, f, g, h, i, j)) yep neat! > Why don't you do the range check *before* storing it in state? That way > you can identify the calculation that was wrong, instead of merely > noticing that at some point some unknown calculation went wrong. I guess no r

Re: Bounds checking

2011-03-19 Thread Martin De Kauwe
> dir() has to do a bit a computation. I would be tempted to give 'state' > a set of attributes to check. Call it 'nonnegatives'. >     for attr in nonnegatives: >        if ... > > This allows for attributes not subject to that check. > > -- > Terry Jan Reedy Agreed. I was trying to just write a

Re: Reading/Writing files

2011-03-19 Thread Nobody
On Fri, 18 Mar 2011 16:00:55 -0700, Ethan Furman wrote: Dan Stromberg wrote: > / works fine on windows, and doesn't require escaping ("/foo/bar"). "/" works fine in most contexts, but not in shell commands, where "/" is conventionally used to indicate a switch. Commands which follow this convent

Re: Bounds checking

2011-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2011 15:35:40 -0700, Martin De Kauwe wrote: >> Don't check for bounds, fix any bug in the code that would set your >> values out of bounds and use asserts while debugging. >> >> > whilst that is a nice idea in practice this just is not a practical > solution. Sorry, are you trying

Re: Bounds checking

2011-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2011 07:24:33 -0700, Martin De Kauwe wrote: > Hi, > > if one has a set of values which should never step outside certain > bounds (for example if the values were negative then they wouldn't be > physically meaningful) is there a nice way to bounds check? I > potentially have 10 or

Re: value of pi and 22/7

2011-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2011 07:22:43 -0700, Kee Nethery wrote: > On Mar 18, 2011, at 5:17 AM, Neil Cerutti wrote: > >> On 2011-03-18, peter wrote: >>> The Old Testament (1 Kings 7,23) says ... "And he made a molten sea, >>> ten cubits from the one brim to the other: it was round all about, and >>> his h

Re: Syntax Error

2011-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote: > I hope this is the place to post this question. I am a really new > pythonista. I am studying Tkinter and when I run this basic code, I get > a syntax error on line 20, print "hi there, everyone". Its a simple > print line, but I can't see the

Re: Abend with cls.__repr__ = cls.__str__ on Windows.

2011-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2011 14:15:46 -0700, Carl Banks wrote: > I observed the same behavior (2.6 and 3.2 on Linux, hangs) and went > ahead and submitted a bug report. Thank you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list