Re: Downloading a file form a displayed table

2013-03-05 Thread Dave Angel
On 03/05/2013 04:48 AM, Νίκος Γκρ33κ wrote: Τη Τρίτη, 5 Μαρτίου 2013 11:45:09 π.μ. UTC+2, ο χρήστης Dave Angel έγραψε: It would be useful to actually specifying the context of this fragment of code. Presumably it's running on a web server somewhere, and you're expecting the fi

Re: Recursive function

2013-03-05 Thread Dave Angel
On 03/05/2013 10:32 AM, Ana Dionísio wrote: Hello! I have to make a script that calculates temperature, but one of the parameters is the temperature in the iteration before, for example: temp = (temp_-1)+1 it = 0 temp = 3 it = 1 temp = 3+1 it = 2 temp = 4+1 How can I do this in a simple way?

Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Dave Angel
On 03/05/2013 12:49 PM, Νίκος Γκρ33κ wrote: What extra triple quote? There are 2 sets of triple quotes the counter's and the print's !! There are 3 pairs of triple-quotes. But one pair is nested inside the other, so the interpreter will not handle it the way you apparently want. If you have

Re: collaborative editing environments

2013-03-05 Thread Dave Angel
On 03/05/2013 12:56 PM, Eric Johansson wrote: I finally have an intern helping me with my various accessibility projects. We need to do pair programming so he can write the code in my head that I can't express by broken hand or speech recognition (yet). The best technique with come up with so fa

Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Dave Angel
On 03/05/2013 01:53 PM, Νίκος Γκρ33κ wrote: Let's focus on just the following snipper please: Once again, I repeat. Make a fragment that contains enough information to actually run. Explain in what environment it's running, and what you hoped would happen. For example, why on earth would y

Re: Controlling number of zeros of exponent in scientific notation

2013-03-05 Thread Dave Angel
On 03/05/2013 03:09 PM, fa...@squashclub.org wrote: Instead of: 1.8e-04 I need: 1.8e-004 So two zeros before the 4, instead of the default 1. You could insert a zero two characters before the end, num = "1.8e-04" num = num[:-2] + "0" + num[-2:] But to get closer to your problem, could yo

Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Dave Angel
On 03/05/2013 03:04 PM, Νίκος Γκρ33κ wrote: #open html template if htmlpage.endswith('.html'): f = open( "/home/nikos/public_html/" + htmlpage ) htmldata = f.read() counter = ''' mailto:supp...@superhost.gr";>

Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

2013-03-06 Thread Dave Angel
On 03/06/2013 05:25 AM, Bryan Devaney wrote: On Wednesday, March 6, 2013 10:11:12 AM UTC, Wong Wah Meng-R32813 wrote: Hello there, I am using python 2.7.1 built on HP-11.23 a Itanium 64 bit box. I discovered following behavior whereby the python process doesn't seem to release memory utili

Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

2013-03-06 Thread Dave Angel
On 03/06/2013 07:31 AM, Wong Wah Meng-R32813 wrote: Apologies as after I have left the group for a while I have forgotten how not to post a question on top of another question. Very sorry and appreciate your replies. I tried explicitly calling gc.collect() and didn't manage to see the memory

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Dave Angel
On 03/06/2013 05:27 AM, Lele Gaifax wrote: Νίκος Γκρ33κ writes: Its about the following line of code: current_fullpaths.add( os.path.join(root, files) ) I'm sorry, typo on my part. That should have been "fullpath", not "file" (and neither "files" as you wrongly reported back!): # Compu

Re: Interesting list() un-optimization

2013-03-06 Thread Dave Angel
On 03/06/2013 10:20 PM, Roy Smith wrote: I stumbled upon an interesting bit of trivia concerning lists and list comprehensions today. We use mongoengine as a database model layer. A mongoengine query returns an iterable object called a QuerySet. The "obvious" way to create a list of the query

Re: Unhelpful traceback

2013-03-07 Thread Dave Angel
On 03/07/2013 01:33 AM, John Nagle wrote: Here's a traceback that's not helping: A bit more context would be helpful. Starting with Python version. Traceback (most recent call last): File "InfoCompaniesHouse.py", line 255, in main() File "InfoCompaniesHouse.py", line 251, in mai

Re: Need help deriving a convertion function on python

2013-03-07 Thread Dave Angel
On 03/07/2013 03:40 PM, Chris Angelico wrote: On Fri, Mar 8, 2013 at 7:25 AM, wrote: Good day, I have a computer programming assignment. I am completely lost and i need some help. These are the questions that are confusing me By the way, you may find the python-tutor list more suit

Re: Python and Hidden Markov Model

2013-03-07 Thread Dave Angel
On 03/07/2013 03:48 PM, subhabangal...@gmail.com wrote: Dear Group, I was trying to learn Hidden Markov Model. In Python there are various packages, but I was willing to do some basic calculation starting from the scratch so that I can learn the model very aptly. Do you know of any thing such?

Re: Unhelpful traceback

2013-03-07 Thread Dave Angel
On 03/07/2013 04:23 PM, John Nagle wrote: raise RuntimeError, 'open() requires mode "r", "U", or "rU"' RuntimeError: open() requires mode "r", "U", or "rU" "b" for files is about end of line handling (CR LF -> LF), anyway. Only for Python 2. Since originally you didn't specif

Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

2013-03-09 Thread Dave Angel
On 03/09/2013 03:07 AM, Wong Wah Meng-R32813 wrote: Yes I have verified my python application is reusing the memory (just that it doesn't reduce once it has grown) and my python process doesn't have any issue to run even though it is seen taking up more than 2G in footprint. My problem is c

Re: Running external module and accessing the created objects

2013-03-09 Thread Dave Angel
On 03/09/2013 06:05 AM, Kene Meniru wrote: (lots of stuff that was more confusing to me than helpful) You use the words launch, encountered, execute, and others in ways that do not make sense to me, or are at least ambiguous. You have an explicitly named user.py, which apparently is *not*

Re: Running external module and accessing the created objects

2013-03-09 Thread Dave Angel
On 03/09/2013 10:34 AM, Kene Meniru wrote: OK. Sorry to have caused all the confusion. Let me try this again. Thank you very much. This is much clearer, though it's not all here. To use my program the user needs a script file I will call user.py. Functions from my program must be imported i

Re: Running external module and accessing the created objects

2013-03-09 Thread Dave Angel
On 03/09/2013 11:56 AM, Kene Meniru wrote: Dave Angel wrote: On 03/09/2013 10:34 AM, Kene Meniru wrote: To use my program the user needs a script file I will call user.py. Functions from my program must be imported into this file with something like "from myapp import *". An

Re: Advice regarding multiprocessing module

2013-03-11 Thread Dave Angel
On 03/11/2013 01:57 AM, Abhinav M Kulkarni wrote: * My laptop has quad-core Intel i5 processor, so I thought using multiprocessing module I can parallelize my code (basically calculate gradient in parallel on multiple cores simultaneously). * As a result I end up creating a

Re: Running external module and accessing the created objects

2013-03-11 Thread Dave Angel
On 03/11/2013 07:57 PM, Kene Meniru wrote: Here's the answer to this question. The summary of the question: how to run a module (called myapp.py) from another module (called myappwin.py) and be able to access the namespace of myapp.py from myappwin.py. --

Re: Running external module and accessing the created objects

2013-03-11 Thread Dave Angel
On 03/11/2013 09:23 PM, Kene Meniru wrote: Dave Angel wrote: On 03/11/2013 07:57 PM, Kene Meniru wrote: I hope you're just kidding. execfile() and exec() are two of the most dangerous mechanisms around. import or __import__() would be much better, as long as your user hasn't a

Re: Running external module and accessing the created objects

2013-03-11 Thread Dave Angel
On 03/11/2013 09:58 PM, Kene Meniru wrote: Dave Angel wrote: On 03/11/2013 07:57 PM, Kene Meniru wrote: I hope you're just kidding. execfile() and exec() are two of the most dangerous mechanisms around. import or __import__() would be much better, as long as your user hasn't a

Re: Running external module and accessing the created objects

2013-03-12 Thread Dave Angel
On 03/12/2013 12:05 AM, Michael Torrie wrote: On 03/11/2013 06:48 PM, Dave Angel wrote: I hope you're just kidding. execfile() and exec() are two of the most dangerous mechanisms around. import or __import__() would be much better, as long as your user hasn't already run myapp

Re: Reversing bits in a byte

2013-03-12 Thread Dave Angel
On 03/11/2013 11:32 AM, Robert Flintham wrote: Hi, I have a 'bytes' object which contains a simple bitmap image (i.e. 1 bit per pixel). I can't work out how I would go about displaying this image. Does anyone have any thoughts? All the best, Rob How does your subject line relate to your

Re: How can i create a random array of floats from 0 to 5 in python

2013-03-12 Thread Dave Angel
On 03/12/2013 01:11 PM, Norah Jones wrote: I want to create a random float array of size 100, with the values in the array ranging from 0 to 5. I have tried random.sample(range(5),100) but that does not work. How can i get what i want to achieve? None of the responses so far actually give y

Re: editing a HTML file

2013-03-14 Thread Dave Angel
On 03/14/2013 02:09 PM, Tracubik wrote: Hi all, I'would like to make a script that automatically change some text in a html file. I need to make some changes in the text of tags My question is: there is a way to just "update/substitute" the text in the html tags or do i have to make a new mo

Re: IOError:[Errno 27] File too large

2013-03-14 Thread Dave Angel
On 03/14/2013 04:12 PM, ch.valdera...@gmail.com wrote: Taking a wild guess, I think that you are using a Samba share on a Linux server. A file "FILENAME.xml;" was accidentally creating on this share from the Linux filesystem layer, since Linux will allow you to use semicolons in file names.

Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Dave Angel
On 03/15/2013 08:00 AM, olsr.ka...@gmail.com wrote: i maybe don't talk english very well but at least i am not a Rude,and you are not obligated to answering me much less Mocking me ,i assure you that i will not post anything anymore jackass thank you alex23 Note also that you were insu

Re: How to add the current dir to sys.path when calling a python file?

2013-03-18 Thread Dave Angel
On 03/17/2013 11:56 PM, Peng Yu wrote: Hi, man python says "If a script argument is given, the directory containing the script is inserted in the path in front of $PYTHONPATH. The search path can be manipulated from within a Python program as the variable sys.path." Instead I want to have t

Re: [Python 2.7.3] What's the difference between these two uses of "for"?

2013-03-18 Thread Dave Angel
On 03/17/2013 10:14 PM, Yves S. Garret wrote: I don't get why it's posting what I said twice... Because you're using googlegroups, and haven't unchecked some poorly defined default setting. You're posting both to python-list and to comp.lang.python, each of which is mirrored to the other.

Re: Excel column 256 limit

2013-03-18 Thread Dave Angel
On 03/18/2013 11:28 AM, Ana Dionísio wrote: Is there some way to go around this limit? I need to import data from python to excel and I need 1440 columns for that. Doesn't sound like a Python question. But one answer is Libre Office Calc, which seems to have a 1024 column limit. -- DaveA

Re: Best way to find starting directory

2013-03-19 Thread Dave Angel
On 03/19/2013 04:21 AM, Frank Millman wrote: On 19/03/2013 09:55, Peter Otten wrote: Frank Millman wrote: I want to locate a file relative to the directory from which the main program was launched. I have found two ways of finding the starting directory - 1. import os dir = os.getcwd() Thi

Re: Need help in extracting lines from word using python

2013-03-19 Thread Dave Angel
On 03/19/2013 10:20 AM, razinzam...@gmail.com wrote: I'm currently trying to extract some data between 2 lines of an input file Your subject line says "from word". I'm only guessing that you might mean Microsoft Word, a proprietary program that does not, by default, save text files. The fol

Re: Best way to find starting directory

2013-03-19 Thread Dave Angel
On 03/19/2013 10:29 AM, Frank Millman wrote: On 19/03/2013 14:46, Dave Angel wrote: On 03/19/2013 04:21 AM, Frank Millman wrote: On 19/03/2013 09:55, Peter Otten wrote: Frank Millman wrote: I want to locate a file relative to the directory from which the main program was launched. I have

Re: "module could not be found" error

2013-03-19 Thread Dave Angel
On 03/19/2013 11:10 AM, Robert Flintham wrote: Hi, I'm trying to run the following, with representing an array of floating point numbers: import numpy as np import scipy as sp from scipy import optimize xdata= ydata= def t2fit(x,T

Re: Replace "dash" values in a field with new line- VB equivalent of Python

2013-03-19 Thread Dave Angel
On 03/19/2013 11:36 AM, Cathy James wrote: Dear All, I need some assistance with Python so that values in the "Name" field e.g. Murray - James - Leo can be labeled as: Murray James Leo with a new line replacing every dash. Basically I need the equivalent of this VB in Python: replace ( [Name]

Re: Wierd behavior of gc.collect

2013-03-19 Thread Dave Angel
On 03/19/2013 11:47 AM, Bodhi wrote: I have a python process that does some operations and is supposed to release memory after those. The issue is that memory is not released (as seen through top). So I do a gc.collect() to see if there is any cycle etc. Immediately after doing the collect mem

Re: Wierd behavior of gc.collect

2013-03-19 Thread Dave Angel
On 03/19/2013 12:36 PM, Bodhi wrote: I know this, but my question is what does gc.collect do which results in the c library to free memory? Usually it is because of unreferenced objects in a cycle or something, but here that doesn't seem to be the case. As I said, python calls the C free() f

Re: CSV, lists, and functions

2013-03-19 Thread Dave Angel
On 03/19/2013 06:59 PM, C.T. wrote: Hello, Currently doing a project for class an I'm stuck. I have a csv file that I'm suppose to extract some information from. I've created a function that ignores the first six lines of the csv file and creates a list of values in a particular column. Here

Re: Best way to find starting directory

2013-03-20 Thread Dave Angel
On 03/20/2013 01:58 AM, Frank Millman wrote: On 19/03/2013 17:03, Dave Angel wrote: On 03/19/2013 10:29 AM, Frank Millman wrote: On 19/03/2013 14:46, Dave Angel wrote: In putting them there, you are making two assumptions. One is that only one user will ever run this, and two is that the

Re: link is unavailable http://mail.python.org/mailman/listinfo/python-list

2013-03-20 Thread Dave Angel
On 03/20/2013 05:40 AM, Bhavitha Nagaraju wrote: Hi all, The link for sendkeys, which is a pre-requiste for winGuipython is unavailable. http://mail.python.org/mailman/listinfo/python-list. Could you suggest , where I could get the sendKeys for now… Looks like you pasted the wrong link in

Re: Best way to find starting directory

2013-03-20 Thread Dave Angel
On 03/20/2013 05:38 AM, Frank Millman wrote: On 20/03/2013 10:56, Dave Angel wrote: On 03/20/2013 01:58 AM, Frank Millman wrote: On 19/03/2013 17:03, Dave Angel wrote: Dave, I really appreciate your input, but we are talking at cross purposes somewhere along the line - I am not sure

Re: "monty" < "python"

2013-03-21 Thread Dave Angel
On 03/21/2013 08:55 AM, Chris Angelico wrote: On Thu, Mar 21, 2013 at 11:45 PM, Roy Smith wrote: In article , Terry Reedy wrote: On 3/20/2013 10:03 AM, franzferdinand wrote: Ok, thanks everybody! Threads are like the Sorcerer's Apprentice. You can start 'em, but you cannot stop 'em ;-)

Re: problem with function

2013-03-21 Thread Dave Angel
On 03/21/2013 02:31 PM, leonardo selmi wrote: hi all, i wrote the following code: def find(word, letter): index = 0 while index < len(word): if word[index] == letter: return index index = index + 1 return -1 if i run the program i get this error: n

Re: Binary for numpy 1.7.0 with Python 2.7.3

2013-03-21 Thread Dave Angel
On 03/21/2013 03:40 PM, Colin J. Williams wrote: How do I find the binaries on Source Forge? I'm trying to update to both 2.7.3 and Numpy 1.7.0. Colin W Best answer might depend on what OS you're running, and what implementation of Python you're after. Why would you look on SourceForge for

Re: Global NameError Fix?

2013-03-21 Thread Dave Angel
On 03/21/2013 07:43 PM, maiden129 wrote: Hello, I'm using the version 3.2.3 of Python and I am having an issue in my program and I don't know how to fix it: counterLabel["text"] = str(counter) NameError: global name 'counterLabel' is not defined Please include the entire traceback when repo

Re: SOAPpy.Types.faultType: Cannot use object of type stdClass as array

2013-03-23 Thread Dave Angel
On 03/23/2013 09:33 AM, Tamer Higazi wrote: Hi Chris! thanks But I am about of going nuts I did everything according their sample: http://kasapi.kasserver.com/dokumentation/?open=soap and wanted to accomplish it in python! Isn't there an API on Python SOAPpy published somewhere? Wil

Re: how to install indico software?

2013-03-23 Thread Dave Angel
On 03/23/2013 10:38 AM, Mark Lawrence wrote: On 23/03/2013 14:15, Avnesh Shakya wrote: please tell me someone, how to install indico software? I have link-- http://indico-software.org/wiki/Admin/Installation0.98 http://indico-software.org/wiki/Releases/Indico0.99 is the link pointed to by:

Re: addressof object with id()

2013-03-23 Thread Dave Angel
On 03/23/2013 08:37 PM, Fabian von Romberg wrote: Hi, I have a single questions regarding id() built-in function. example 1: var1 = "some string" var2 = "some string" if use the id() function on both, it returns exactly the same address. example 2: data = "some string" var1 = data var2 = d

Re: Separate Rows in reader

2013-03-23 Thread Dave Angel
On 03/24/2013 01:20 AM, Jiewei Huang wrote: Hi all, Currently create a simple text-based database of information about people I have a csv file which consist of 3 rows , row 1 2 and 3 is as such: Name AddressTelephone Birthday John Konon Ministry of Moon Walks 4567882 2

Re: Separate Rows in reader

2013-03-24 Thread Dave Angel
On 03/24/2013 04:11 AM, Jiewei Huang wrote: Sorry my typo in the output here is the correct output that i need : [('John Konon', 'Ministry of moon Walks', '4567882', '27-Feb'), ( 'Stacy Kisha', 'Ministry of Man Power', '1234567', 17-Jan')] the difference is that i need a [(row two), (row

Re: Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

2013-03-25 Thread Dave Angel
On 03/25/2013 08:29 AM, dbv wrote: In Python 2.7.3, at ln34 the source file tempfile.py states: from random import Random as _Random But, Random is a Class. Have you just tried the following: import random print dir(random.random) print random.__file__ I suspect you have another r

Re: Separate Rows in reader

2013-03-25 Thread Dave Angel
On 03/25/2013 09:05 PM, Jiewei Huang wrote: > On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: If you insist on using GoogleGroups, then make sure you keep your quotes small. I'm about to stop reading messages that are double-spaced by buggy software. Have you tried the spl

Re: At a loss on python scoping.

2013-03-26 Thread Dave Angel
On 03/26/2013 02:17 AM, Shiyao Ma wrote: Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r a.func(3) print(a.s)# this should print 3, also where does py store

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 05:06 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 12:11:34 AM UTC+1, Ethan Furman wrote: On 03/25/2013 12:29 PM, Michael Herrmann wrote: ... notepad_1 = start("Notepad") notepad_2 = start("Notepad") notepad_1.write("Hello World!") notepa

Re: JES account balance function help urgent!

2013-03-26 Thread Dave Angel
On 03/26/2013 06:30 AM, kidom...@gmail.com wrote: I am supposed to complete the following five functions, i have no idea how to do this. I will greatly appreciate any help The following five functions allow you to maintain the running balance of an account and print out lines relating to each

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 08:04 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 11:26:30 AM UTC+1, Dave Angel wrote: ... Seems to me that the official interface should all be methods. However, you could have a new object which always represents the "focus" window. Then the USER co

Re: Help me pick an API design (OO vs functional)

2013-03-26 Thread Dave Angel
On 03/26/2013 10:40 AM, Michael Herrmann wrote: On Tuesday, March 26, 2013 3:13:30 PM UTC+1, Neil Cerutti wrote: Have you considered adding a keyword argument to each of your global functions, which is normally None, but allows a user to provide a prefered focus window? enter_text("test.tx

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 01:26 PM, leonardo selmi wrote: hi python community, i wrote the following programm: from sys import argv script, userName = argv prompt = '> ' print 'hi %s, i am the %s script' % (userName, script) print "i'd like to ask you a few questions." print 'do you like me %s' % userNam

Re: problem with sys import argv

2013-03-26 Thread Dave Angel
On 03/26/2013 04:12 PM, Thomas 'PointedEars' Lahn wrote: Dave Angel wrote: Since the script takes a mandatory argument, run it with one. python myscript.py Dave Better would be to change the script to check len(argv) for exactly 2, and tell the user how he should have run it. I

Re: Performance of int/long in Python 3

2013-03-26 Thread Dave Angel
On 03/26/2013 05:14 PM, Chris Angelico wrote: Does that allow us to determine wheter integers are idiots or not? No, it doesn't. I'm fairly confident that most of them are not... however, I have my eye on 42. He gets around, a bit, but never seems to do anything very useful. I'd think twic

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Dave Angel
On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One might want to format True/False in a fixed w

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 01:44 AM, Eric Parry wrote: I downloaded the following program from somewhere It'd be good to show where you found it, and credit the apparent author. Bill Barksdale posted this in 2008 at: http://stackoverflow.com/questions/201461/shortest-sudoku-solver-in-python-how-does-it-

Re: Performance of int/long in Python 3

2013-03-27 Thread Dave Angel
On 03/26/2013 07:10 PM, Gregory Ewing wrote: On Wed, Mar 27, 2013 at 8:08 AM, Grant Edwards wrote: Does that allow us to determine wheter integers are idiots or not? No, it doesn't. I'm fairly confident that most of them are not... however, I have my eye on 42. He thought he was equal to 6

Re: how do you make a loop run in reverse?

2013-03-27 Thread Dave Angel
On 03/26/2013 07:59 PM, rahulredd...@hotmail.com wrote: So i have a set of for loops that create this : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Re: Sudoku

2013-03-27 Thread Dave Angel
On 03/27/2013 11:00 PM, Eric Parry wrote: On Wednesday, March 27, 2013 6:28:01 PM UTC+10:30, Ulrich Eckhardt wrote: http://wiki.python.org/moin/GoogleGroupsPython > Thank you for your explanation. I noticed that in this particular puzzle when it ran out of candidates in a particular cyc

Re: Sudoku

2013-03-28 Thread Dave Angel
On 03/28/2013 06:11 PM, Eric Parry wrote: On Thursday, March 28, 2013 3:06:02 PM UTC+10:30, Dave Angel wrote: Are you familiar with recursion? Notice the last line in the function r() calls the function r() inside a for loop. So when r() returns, you're back inside the next lev

Re: How to find bad row with db api executemany()?

2013-03-29 Thread Dave Angel
On 03/29/2013 10:48 AM, Roy Smith wrote: I'm inserting a gazillion rows into a MySQL database using MySQLdb and cursor.executemany() for efficiency. Every once in a while, I get a row which violates some kind of database constraint and raises Error. I can catch the exception, but don't see an

Re: Sudoku

2013-03-29 Thread Dave Angel
On 03/29/2013 05:47 PM, Eric Parry wrote: That explains why the program keeps running after a solution is found. A recursive function can be designed to find all solutions, in which case it would (as you say) keep running. The function you posted in the first place uses exit() to avoi

Re: Python class and variable issue(newby question!)

2013-03-29 Thread Dave Angel
On 03/29/2013 06:17 PM, Sam Berry wrote: Thanks for the responses! My issue was sorted with Benjamins post, just printing s worked. Cheers for the info though Chris, if i have any further issues il post them with some working code. In that case, you probably should add a line like: s = Non

Re: How to set or get enviroment variable

2013-03-30 Thread Dave Angel
On 03/30/2013 04:39 PM, Nac Temha wrote: Hi, I want to get and set enviroment variable of linux system. Actually I can do this issue using os module but How can I do without using os module? Is there another way? As Chris has said, the os module is the way to get and modify the environment o

Re: Sudoku

2013-03-30 Thread Dave Angel
On 03/30/2013 06:06 PM, Eric Parry wrote: On Saturday, March 30, 2013 8:41:08 AM UTC+10:30, Dave Angel wrote: On 03/29/2013 05:47 PM, Eric Parry wrote: Sometimes a bug in such a function will cause it to run indefinitely, and/or to overflow the stack. I don't see such a bug in

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Dave Angel
On 03/31/2013 02:56 AM, morphex wrote: Hi. I was just doodling around with the python interpreter today, and here is the dump from the terminal: morphex@laptop:~$ python Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for mor

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Dave Angel
On 03/31/2013 03:33 AM, Steven D'Aprano wrote: On Sat, 30 Mar 2013 23:56:46 -0700, morphex wrote: Hi. I was just doodling around with the python interpreter today, and here is the dump from the terminal: morphex@laptop:~$ python Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on lin

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Dave Angel
On 03/31/2013 08:07 AM, morphex wrote: Aha, OK. Thought I found a bug but yeah that makes sense ;) While we're on the subject, wouldn't it be nice to have some cap there so that it isn't possible to more or less block the system with large exponentiation? There's an assumption there. The O

Re: Creating a dictionary from a .txt file

2013-03-31 Thread Dave Angel
On 03/31/2013 12:52 PM, C.T. wrote: On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote: Thank you, Mark! My problem is the data isn't consistently ordered. I can use slicing and indexing to put the year into a tuple, but because a car manufacturer could have two names (ie, Aston Ma

Re: Creating a dictionary from a .txt file

2013-03-31 Thread Dave Angel
On 03/31/2013 02:41 PM, Roy Smith wrote: In article , Dave Angel wrote: On 03/31/2013 12:52 PM, C.T. wrote: On Sunday, March 31, 2013 12:20:25 PM UTC-4, zipher wrote: Thank you, Mark! My problem is the data isn't consistently ordered. I can use slicing and indexing to put the

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Dave Angel
On 03/31/2013 06:06 PM, Alex wrote: Dave Angel wrote: On 03/31/2013 02:56 AM, morphex wrote: 1**2 1 1**2**3 1 1**2**3**4 1L 1**2**3**4**5 Traceback (most recent call last): File "", line 1, in MemoryError Does anyone know why this raises a MemoryError? Doesn't m

Re: Sudoku

2013-03-31 Thread Dave Angel
On 03/31/2013 06:03 PM, Eric Parry wrote: I think in the original it was exit(a). That did not work either. There you go again. "Did not work" tells us very little. With my Python 2.7.2, exit(something) with something being a string prints the string and then exits. Nowhere have I s

Re: How to do this?

2013-04-01 Thread Dave Angel
On 04/01/2013 07:08 AM, Ana Dionísio wrote: [0 0 0 0 0.17 0.17 0.17 0.17 0 0 0 0.17 0.17 0.17 0 0 0 0 0 0 0] I'd do res = "[0 0 0 0 0.17 0.17 0.17 0.17 0 0 0 0.17 0.17 0.17 0 0 0 0 0 0 0]" Unless there's a pattern you're trying to accomplish (like maybe next time you want to do "it" for a li

Re: Error in working with Dict

2013-04-01 Thread Dave Angel
On 04/01/2013 09:50 AM, inshu chauhan wrote: I have this program which is working with 2 dictionaries segments, class_counts.. but I am getting an error mentioned below the programme. import cv from itertools import * from math import floor, sqrt, ceil from numpy import array, dot, subtract, add

Re: Help

2013-04-01 Thread Dave Angel
On 04/01/2013 05:42 PM, khao...@gmail.com wrote: Self-bump Normally, bumping a message/thread means replying to it. You're leaving a NEW message with no context, no reply, and a different uninformative subject line. And you're leaving it from googlegroups, with two copies. If you want to

Re: Creating a dictionary from a .txt file

2013-04-01 Thread Dave Angel
On 04/01/2013 07:53 PM, C.T. wrote: Thanks for all the help everyone! After I manually edited the txt file, this is what I came up with: car_dict = {} car_file = open('cars.txt', 'r') for line in car_file: temp = line.strip().split(None, 2) temp2 = line.strip().split('\t') i

Re: extending class static members and inheritance

2013-04-02 Thread Dave Angel
On 04/02/2013 09:27 AM, Fabian PyDEV wrote: Hi All, I have a question. Let says I have the following two classes: class Base(object): __mylist__ = ["value1", "value2"] def somemethod(self): pass class Derived(Base): __mylist__ = ["value3", "value4"]

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 04:22 AM, Neil Hodgson wrote: rusi: Can you please try one more experiment Neil? Knock off all non-ASCII strings (paths) from your dataset and try again. Results are the same 0.40 (well, 0.001 less but I don't think the timer is that accurate) for Python 3.2 and 0.78 for Pyt

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread Dave Angel
On 04/03/2013 04:44 AM, D. Xenakis wrote: Hi there, i installed python 2.7 (windows 32bit version) from http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version too. So now i got two python folders like this.. c:/Python27 and c:/Python33 . My problem is t

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 07:05 AM, Neil Hodgson wrote: Dave Angel: That would seem to imply that the speed regression on your data is NOT caused by the differing size encodings. Perhaps it is the difference in MSC compiler version, or other changes made between 3.2 and 3.3 Its not caused by there

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 12:30 PM, Ian Kelly wrote: On Wed, Apr 3, 2013 at 5:52 AM, Dave Angel wrote: I'm also puzzled. I thought that the sort algorithm used a hash of all the items to be sorted, and only reverted to a raw comparison of the original values when the hash collided. Is that not the

Re: Help me with PyCharm on Mac OS

2013-04-04 Thread Dave Angel
On 04/04/2013 04:19 AM, YE SHANG wrote: Hello! I'm a newbie of developing GAE Apps on Mac. My Mac OS is Mountain Lion, I reinstalled python 2.7.3 instead of pre-installed python 2.7.2, as well as GAE SDK. I finished configuration of Python interpreter(/usr/local/bin/python2.7), and Google Ap

Re: How do I tell if I'm running under IDLE?

2013-04-05 Thread Dave Angel
On 04/05/2013 05:30 AM, Steven D'Aprano wrote: (Apologies in advance if you get multiple copies of this. My Usenet connection seems to be having a conniption fit at the moment.) I'm looking for an official way to tell what interpreter (if any) is running, or at least a not-too-horrible unofficia

Re: HTTPserver: how to access variables of a higher class?

2013-04-05 Thread Dave Angel
On 04/05/2013 07:02 AM, Tom P wrote: First, here's a sample test program: import sys from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler class MyRequestHandler(BaseHTTPRequestHandler, object): def do_GET(self): top_self = super(MyRequestHandler, self) # try to access MyW

Re: Python log parser

2013-04-05 Thread Dave Angel
On 04/05/2013 07:20 AM, Nac Temha wrote: I could not do using syslog module. Please don't top-post. It messes up the history order entirely. What could you not do using syslog? What did you try, and what exception did it throw? Show your code, and either say precisely in what way it didn

Re: HTTPserver: how to access variables of a higher class?

2013-04-05 Thread Dave Angel
On 04/05/2013 05:41 PM, Tom P wrote: On 04/05/2013 01:54 PM, Dave Angel wrote: On 04/05/2013 07:02 AM, Tom P wrote: First, here's a sample test program: import sys from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler class MyRequestHandler(BaseHTTPRequestHandler, object):

Re: a couple of questions: pickling objects and strict types

2013-04-05 Thread Dave Angel
On 04/05/2013 10:49 PM, Chris Angelico wrote: On Sat, Apr 6, 2013 at 1:37 PM, Steven D'Aprano wrote: Did you mean "constructor" rather than C T O R ? Perhaps your voice-to- text software (if you are using such) misheard you. Side point: "ctor" is a common abbreviation for "constructor". Chri

Re: Error in Python NLTK

2013-04-06 Thread Dave Angel
On 04/06/2013 03:56 PM, subhabangal...@gmail.com wrote: Dear Group, I was using a package named NLTK in Python. I was trying to write a code given in section 3.8 of http://docs.huihoo.com/nltk/0.9.5/guides/tag.html. Here, in the >>> test = ['up', 'down', 'up'] if I put more than 3 values and

Re: How do I tell if I'm running under IDLE?

2013-04-06 Thread Dave Angel
On 04/06/2013 08:35 PM, Mark Janssen wrote: (Apologies in advance if you get multiple copies of this. My Usenet connection seems to be having a conniption fit at the moment.) I'm looking for an official way to tell what interpreter (if any) is running, or at least a not-too-horrible unofficial w

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
On 04/06/2013 09:03 PM, Frank wrote: Hi all, I would require advise on this question for function call interact: the desire outcome: interact() Friends File: friends.csv Command: f John Cleese John Cleese: Ministry of Silly Walks, 421, 27 October Command: f Michael Palin Unknown friend Micha

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
On 04/06/2013 11:22 PM, Frank wrote: Hi Dave, Sorry for my unclear question. I didn't use the d = load_friends('friends.csv') now because I'm going use it for other function later on, I should have remove it first to avoid confusion. This is the code for load_friends , add_info ,display_frie

Re: raw_input that able to do detect multiple input

2013-04-06 Thread Dave Angel
(You forgot to separate the parts of my comments that you were quoting from your responses. Any decent email program will do that for you automatically, inserting "< " in front of each quoted line. Then you just hit enter a couple of times to type the new stuff right after the part you're quo

<    13   14   15   16   17   18   19   20   21   22   >