Re: XML parsing ExpatError with xml.dom.minidom at line 1, column 0

2014-02-13 Thread MRAB
On 2014-02-13 20:10, Peter Otten wrote: ming wrote: Hi, i've a Python script which stopped working about a month ago. But until then, it worked flawlessly for months (if not years). A tiny self-contained 7-line script is provided below. i ran into an XML parsing problem with xml.dom.minido

Re: Wait... WHAT?

2014-02-13 Thread MRAB
On 2014-02-13 17:46, eneskri...@gmail.com wrote: Can we please revert back to the original problem? def save(): > target = open ("save.swroc", 'w') This opens the file for writing text (assuming you're using Python 3). > target.write([counter, loop, number_of_competitors

Re: [RELEASED] Python 3.4.0 release candidate 1

2014-02-11 Thread MRAB
On 2014-02-11 13:06, David Robinow wrote: On Tue, Feb 11, 2014 at 5:45 AM, Terry Reedy wrote: On 2/11/2014 5:13 AM, Terry Reedy wrote: ... I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in repair mode and again, no problem. With 64 bit 3.4.0, I get "There is a problem wi

Re: Question about `list.insert`

2014-02-06 Thread MRAB
On 2014-02-06 23:59, cool-RR wrote: Hi, I'm curious. If I append an item to a list from the left using `list.insert`, will Python always move the entire list one item to the right (which can be super-slow) or will it check first to see whether it can just allocate more memory to the left of the

Re: parse a csv file into a text file

2014-02-06 Thread MRAB
e > print type(line[1]), repr(line(1)) > It tells me that 'list object is not callable > "line" is a list and within repr you're using (...) (parentheses) instead of [...] (square brackets). It might be clearer if you call the variable "row" because the CS

Re: parse a csv file into a text file

2014-02-05 Thread MRAB
On 2014-02-06 00:10, Zhen Zhang wrote: Hi, every one. I am a second year EE student. I just started learning python for my project. I intend to parse a csv file with a format like 3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 2466023,"Montréal (Que.)"

Re: kivy

2014-02-04 Thread MRAB
On 2014-02-04 19:55, bharath wrote: i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module name

Re: Logging data from Arduino using PySerial

2014-02-04 Thread MRAB
On 2014-02-04 04:07, Thomas wrote: I've written a script to log data from my Arduino to a csv file. The script works well enough but it's very, very slow. I'm quite new to Python and I just wanted to put this out there to see if any Python experts could help optimise my code. Here it is: [sn

Re: Python 3.3 and Pygame 19.2a install problems

2014-02-03 Thread MRAB
On 2014-02-03 06:43, Terry Reedy wrote: On 2/2/2014 10:04 PM, edvoge...@gmail.com wrote: Traceback (most recent call last): File "C:\Users\Ed\Documents\SOMA\Minecraft and Python\inventwithpython_src\dodger.py", line 1, in >> import pygame, random, sys File "C:\Python33\lib\site-packages\py

Re: Help with some python homework...

2014-02-02 Thread MRAB
On 2014-02-02 16:11, David Hutto wrote: price_per_book = 24.95 discount = .40 quantity = 60 The original problem says: Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total

Re: Unable to Launch Python 2.7 after Windows 8.1 Update

2014-02-02 Thread MRAB
On 2014-02-02 15:39, Allison Gray wrote: I recently obtained a new laptop with Windows 8.1 and installed Python 2.7. Everything was working fine. Then after my first update, I was unable to launch Python. After clicking the Python icon, the thinking cursor activated, but Python never opened. I re

Re: Dunder [was Re: __init__ is the initialiser]

2014-01-31 Thread MRAB
On 2014-02-01 02:52, Steven D'Aprano wrote: On Fri, 31 Jan 2014 20:10:46 -0500, Roy Smith wrote: In article , Ethan Furman wrote: I found calling __init__ the constructor very confusing. I've heard many people say this, and it's always sort of befuddled me. In C++, a constructor is reall

Re: Python shell wont open idle or an exisiting py file

2014-01-31 Thread MRAB
On 2014-02-01 01:52, Chris Angelico wrote: On Sat, Feb 1, 2014 at 12:45 PM, Terry Reedy wrote: H:\HP_Documents\0PythonWork\AirplaneKinematics\accel2.py caused this message UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 14: invalid start byte So... something's interpretin

Re: __init__ is the initialiser

2014-01-31 Thread MRAB
On 2014-02-01 01:10, Roy Smith wrote: In article , Ethan Furman wrote: I found calling __init__ the constructor very confusing. I've heard many people say this, and it's always sort of befuddled me. In C++, a constructor is really an initializer too. By the time C++'s Foo::Foo() or Pytho

Re: __init__ is the initialiser

2014-01-31 Thread MRAB
On 2014-01-31 19:52, Ned Batchelder wrote: On 1/31/14 2:33 PM, Mark Lawrence wrote: From http://docs.python.org/3/reference/datamodel.html#object.__init__ which states:- " Called when the instance is created. The arguments are those passed to the class constructor expression. If a base class h

Re: end quote help for a newbie

2014-01-30 Thread MRAB
On 2014-01-30 13:26, Peter Clark wrote: There is probably an easy solution to this – but I have not found it. Trying to terminate a literal in a print statement (from the tutorial). The literal should be enclosed in double quotes “ “ the initial double quote seems to be OK (if I use a different c

Re: Try-except-finally paradox

2014-01-30 Thread MRAB
On 2014-01-30 13:02, Chris Angelico wrote: On Thu, Jan 30, 2014 at 11:05 PM, Dave Angel wrote: The finally has to happen before any return inside the try or the except. And once you're in the finally clause you'll finish it before resuming the except clause. Since it has a return, that wi

Re: pytz question: GMT vs. UTC

2014-01-30 Thread MRAB
On 2014-01-30 08:45, wxjmfa...@gmail.com wrote: Le jeudi 30 janvier 2014 04:27:54 UTC+1, Chris Angelico a écrit : On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote: >> How cruel... I suspect the smack at 0degC is much more painful >> than one >> at room temperature &

Re: pytz question: GMT vs. UTC

2014-01-29 Thread MRAB
On 2014-01-30 01:50, Dennis Lee Bieber wrote: On Thu, 30 Jan 2014 11:28:16 +1100, Chris Angelico declaimed the following: On Thu, Jan 30, 2014 at 11:17 AM, Dennis Lee Bieber wrote: On Wed, 29 Jan 2014 19:02:53 + (UTC), Grant Edwards declaimed the following: to be smacked across the k

Re: Unwanted Spaces and Iterative Loop

2014-01-26 Thread MRAB
On 2014-01-26 21:46, matt.s.maro...@gmail.com wrote: I have been working on a python script that separates mailing addresses into different components. Here is my code: inFile = "directory" outFile = "directory" inHandler = open(inFile, 'r') outHandler = open(outFile, 'w') Shouldn't you be w

Re: The potential for a Python 2.8.

2014-01-23 Thread MRAB
On 2014-01-24 01:00, Chris Angelico wrote: On Fri, Jan 24, 2014 at 11:42 AM, Terry Reedy wrote: Burying 'Python 2.8' was the purpose of PEP 404. It is kind of bizarre. Developers informally said 'No 2.8'. People would not believe that. So developers formally said 'No 2.8'. They even inverted th

Re: Case insensitive exists()?

2014-01-22 Thread MRAB
On 2014-01-23 00:58, Larry Martell wrote: I have the need to check for a files existence against a string, but I need to do case-insensitively. I cannot efficiently get the name of every file in the dir and compare each with my string using lower(), as I have 100's of strings to check for, each i

Re: import file without .py into another module

2014-01-21 Thread MRAB
On 2014-01-21 14:44, kevinber...@gmail.com wrote: I have a python script that accepts two arguments: sys.argv[1] is the full directory path to a config script. The script is python but does not have a .py extension! sys.argv[2] is the file name of the config script For example: mainScript.py .

Re: Python 3.x adoption

2014-01-17 Thread MRAB
On 2014-01-17 23:03, Terry Reedy wrote: [snip] Since 3.0, we have added new syntax ('yield from', u'' for instance) but I do not believe we have deleted or changed any syntax (I might have forgotten something minor) and I do not know of any proposal to do so (except to re-delete u'', which should

Re: Compiling main script into .pyc

2014-01-16 Thread MRAB
On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh? Jus

Re: Bind event is giving me a bug.

2014-01-15 Thread MRAB
On 2014-01-15 20:16, eneskri...@gmail.com wrote: While working with tkinter in python 3.3, I had the following problem. def get_text(event): self.number_of_competitors = entered_text.get() try: self.number_of_competitors = int(self.number_of_competitors)

Re: python-list@python.org

2014-01-14 Thread MRAB
On 2014-01-15 01:25, Florian Lindner wrote: Am Dienstag, 14. Januar 2014, 17:00:48 schrieb MRAB: On 2014-01-14 16:37, Florian Lindner wrote: > Hello! > > I'm using python 3.2.3 on debian wheezy. My script is called from my mail delivery agent (MDA) maildrop (like procmail) throug

Re: Python 3.x adoption

2014-01-14 Thread MRAB
On 2014-01-15 02:55, Steven D'Aprano wrote: On Tue, 14 Jan 2014 20:33:50 +0100, Staszek wrote: Hi What's the problem with Python 3.x? Nothing. It was first released in 2008, That was only five years ago. I know that to young kids today who change their iPhone every six months, five year

Re: dictionary with tuples

2014-01-14 Thread MRAB
On 2014-01-14 21:10, Igor Korot wrote: Hi, ALL, C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. dict = {} dict[(1,2)] = ('a','

Re: Printer list value problem

2014-01-14 Thread MRAB
On 2014-01-14 19:24, Mike wrote: Hello, I confudsed,need printer the value of list (this is reaer from csv) . The reader is ok, but my problem is in the print moment because printer only the last value. For example my csv is: [] us...@example.com;user1;lastName;Name us...@example.com;u

python-list@python.org

2014-01-14 Thread MRAB
On 2014-01-14 16:37, Florian Lindner wrote: Hello! I'm using python 3.2.3 on debian wheezy. My script is called from my mail delivery agent (MDA) maildrop (like procmail) through it's xfilter directive. Script works fine when used interactively, e.g. ./script.py < testmail but when called fro

Re: python first project

2014-01-12 Thread MRAB
On 2014-01-12 06:04, Chris Angelico wrote: On Sun, Jan 12, 2014 at 4:14 PM, ngangsia akumbo wrote: What options do you think i can give the Ceo. Because from what you have outline, i think i will like to follow your advice. If it is just some recording data stuff then some spreadsheet can do t

Re: 'Straße' ('Strasse') and Python 2

2014-01-12 Thread MRAB
On 2014-01-12 08:31, Peter Otten wrote: wxjmfa...@gmail.com wrote: sys.version 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' jmf Signifying nothing. (Macbeth) Python 2.7.2+ (default, Jul 20 2012, 22:15:08) [GCC 4.6.

Re: Send array back in result from urllib2.urlopen(request, postData)

2014-01-10 Thread MRAB
On 2014-01-10 20:57, vanommen.rob...@gmail.com wrote: Hello, I have a Raspberry Pi with 10 temperature sensors. I send the data from the sensors and some other values with json encoding and: result = urllib2.urlopen(request, postData) to a online PHP script wich places the data in a mysql dat

Re: Python 2.x and 3.x usage survey

2014-01-10 Thread MRAB
On 2014-01-10 19:43, John Ladasky wrote: On Friday, January 10, 2014 9:48:43 AM UTC-8, Ned Batchelder wrote: On Python-Dev, Dan Stromberg posted this link with the results: http://stromberg.dnsalias.org/~strombrg/python-2.x-vs-3.x-survey/ That link gave me a 404. :^( It's available here:

Re: Time zones and why they change so damned often

2014-01-10 Thread MRAB
On 2014-01-10 18:22, Peter Pearson wrote: On Thu, 9 Jan 2014 15:14:55 +1100, Chris Angelico wrote: [snip] What I find, most of the time, is that it's Americans who can't handle DST. I run an international Dungeons and Dragons campaign (we play online, and new players are most welcome, as are peo

Re: Re : Python GTK GUI struck when process is going on.

2014-01-09 Thread MRAB
On 2014-01-09 11:53, Prapulla Kumar wrote: Hi all, I'm using python gtk to upload file to S3 service by boto API , GUI struck when uploading file and releases the GUI after completed download I'm using thread to show progress of upload in GUI but it struck. Can you some suggestion how to show pro

Re: [Python-ideas] RFC: bytestring as a str representation [was: a new bytestring type?]

2014-01-07 Thread MRAB
On 2014-01-07 17:46, Andrew Barnert wrote: > I think Stephen's name "7-bit" is confusing people. If you try to > interpret the name sensibly, you get Steven's broken interpretation. > But if you read it as a nonsense word and work through the logic, it > all makes sense. > > On Jan 7, 2014, at 7:4

Re: Trying to wrap my head around futures and coroutines

2014-01-06 Thread MRAB
On 2014-01-07 02:29, Cameron Simpson wrote: On 06Jan2014 18:56, Skip Montanaro wrote: [...] Let's say I have a dead simple GUI with two buttons labeled, "Do A" and "Do B". Each corresponds to executing a particular activity, A or B, which take some non-zero amount of time to complete (as percei

Re: Trying to wrap my head around futures and coroutines

2014-01-06 Thread MRAB
On 2014-01-07 00:56, Skip Montanaro wrote: I've been programming for a long while in an event&callback-driven world. While I am comfortable enough with the mechanisms available (almost 100% of what I do is in a PyGTK world with its signal mechanism), it's never been all that satisfying, breaking

Re: Blog "about python 3"

2014-01-04 Thread MRAB
On 2014-01-05 02:32, Chris Angelico wrote: On Sun, Jan 5, 2014 at 1:27 PM, Steven D'Aprano wrote: But regardless of how fast your path-finder algorithm might become, you're unlikely to be satisfied with a solution that travels around in a circle from A to B a million times then shoots off strai

Re: BLANK PAGE when i try Filtering Adsense with abpy

2013-12-22 Thread MRAB
On 22/12/2013 18:08, Michael Torrie wrote: On 12/22/2013 10:20 AM, em rexhepi wrote: When I use my code it just displays nothing My code: #!/usr/local/bin/python3.1 import cgitb;cgitb.enable() import urllib.request response = urllib.request.build_opener() response.addheaders = [('User-agent',

Re: PDFMiner install question

2013-12-19 Thread MRAB
On 19/12/2013 19:36, Jason Mellone wrote: MRAB: Thank you your exact solution worked perfectly. Now I am trying to run some code from (http://www.unixuser.org/~euske/python/pdfminer/programming.html) under basic usage. If I try to run from pdfminer.pdfparser import PDFParser from

Re: PDFMiner install question

2013-12-17 Thread MRAB
On 17/12/2013 20:59, Jason Mellone wrote:> On Tuesday, December 17, 2013 3:53:24 PM UTC-5, Jason Mellone wrote: >> On Tuesday, December 17, 2013 3:32:56 PM UTC-5, MRAB wrote: >>> On 17/12/2013 20:06, Jason Mellone wrote: >>>> Hello, >>>> >>>>

Re: PDFMiner install question

2013-12-17 Thread MRAB
On 17/12/2013 20:06, Jason Mellone wrote: Hello, I have python up and running using the exact setup as recommended by http://learnpythonthehardway.org/ I am now trying to use pdfminer. I have python here: C:\USERS\Python27 using "import os", i am able to cwd to C:\users\python where i have

Re: Small script to check serial port sucking down system resources.

2013-12-16 Thread MRAB
On 16/12/2013 14:31, sem...@gmail.com wrote: i am new to python and programming all together. i wrote a program to watch a serial port and look for a command. then send a tcp packet. all works great but it takes my processor load to about %25. not sure if there is a way to make this more efficie

Re: Eliminate "extra" variable

2013-12-15 Thread MRAB
On 15/12/2013 22:46, Igor Korot wrote: Tim, On Sun, Dec 15, 2013 at 4:29 AM, Tim Chase wrote: On 2013-12-15 06:17, Tim Chase wrote: conn = sqlite3.connect('x.sqlite', ... detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) Your example code omitted this one crucial line. Do you s

Re: Downloading file

2013-12-12 Thread MRAB
On 12/12/2013 20:45, Matt Graves wrote: I have direct links to a number of csv files to download. Copying and pasting it to my browser would take too long, how would i go to this site for example and get the file? Right when you go to the site the download should start www.example.com/files/do

Re: Tree library - multiple children

2013-12-12 Thread MRAB
On 12/12/2013 19:30, Joel Goldstick wrote: On Thu, Dec 12, 2013 at 2:26 PM, Neil Cerutti mailto:ne...@norwich.edu>> wrote: On 2013-12-12, Ricardo Aráoz mailto:ricar...@gmail.com>> wrote: > I need to use a tree structure. Is there a good and known library? > Doesn't have to be binar

Re: Python Script

2013-12-12 Thread MRAB
On 12/12/2013 18:05, Amimo Benja wrote: I have an issue with a Python script that I will show as follows: http://codepad.org/G8Z2ConI Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet has got a method that is called recursively each time an HTTP response is received.

Re: Optimizing list processing

2013-12-12 Thread MRAB
On 12/12/2013 12:25, Chris Angelico wrote: On Thu, Dec 12, 2013 at 11:08 PM, Steven D'Aprano wrote: P.S. The algorithm I'm working on is a way of generating index and rank tables. Not that it really matters -- what matters is determining whether or not to shift from "make a copy of the list" to

Re: min max from tuples in list

2013-12-12 Thread MRAB
On 12/12/2013 11:44, Steven D'Aprano wrote: On Wed, 11 Dec 2013 23:25:53 -0800, Robert Voigtländer wrote: Hi, I have a list like this: a = [(52, 193), (52, 193), (52, 192), ... I need to find a -performant- way to transform this into a list with tuples (a[0],[a[0][1]min],[a[0][1]max]). I'

Re: Optimizing list processing

2013-12-11 Thread MRAB
On 12/12/2013 01:43, Steven D'Aprano wrote: On Thu, 12 Dec 2013 00:59:42 +0000, MRAB wrote: table = [(x, i) for i,x in enumerate(iterable)] table.sort() This looks wrong to me: for x, i in table: table[i] = x Yes, you're right, I over-simplified the example, and i

Re: Optimizing list processing

2013-12-11 Thread MRAB
On 11/12/2013 23:54, Steven D'Aprano wrote: I have some code which produces a list from an iterable using at least one temporary list, using a Decorate-Sort-Undecorate idiom. The algorithm looks something like this (simplified): table = sorted([(x, i) for i,x in enumerate(iterable)]) table = [i

Re: grab dict keys/values without iterating ?!

2013-12-10 Thread MRAB
On 11/12/2013 00:02, Tamer Higazi wrote: Hi people! Is there a way to get dict by search terms without iterating the entire dictionary ?! Let us assume I have: {'Amanda':'Power','Amaly':'Higgens','Joseph':'White','Arlington','Black','Arnold','Schwarzenegger'} I want to grab the dict's key and

Re: Possible PEP Submission

2013-12-09 Thread MRAB
On 09/12/2013 20:36, Logan Collins wrote: Just checking whether 1) a PEP is the proper place for this and 2) what y'all think about it. I would like to propose a change to the the 're' standard library to support iterables. So, something like the following would work: import re text = """hello

Re: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S SIZE 11.5 NEW IN BOX', '$49.99')'

2013-12-09 Thread MRAB
On 09/12/2013 09:32, Daniel Watkins wrote: On Mon, Dec 09, 2013 at 12:41:57AM -0800, Jai wrote: sql = """insert into `category` (url, catagory,price) VAlUES ('%s', '%s', '%s')"""%(link1,x,y) sql = unicodedata.normalize('NFKD', sql).encode('ascii','ignore') cursor.execute

Re: Is It Bug?

2013-12-07 Thread MRAB
On 08/12/2013 00:59, Mahan Marwat wrote: Why this is not working. 'Hello, World'.replace('\\', '\\') To me, Python will interpret '' to '\\'. And the replace method will replace '\\' with '\'. So, the result will be 'Hello, \World'. But it's give me 'Hello, World'. The result I w

Re: ASCII and Unicode [was Re: Managing Google Groups headaches]

2013-12-06 Thread MRAB
On 07/12/2013 02:41, Chris Angelico wrote: On Sat, Dec 7, 2013 at 1:33 PM, rusi wrote: That seems to suggest that something is not right with the python mailing list config. No?? If in doubt, blame someone else, eh? I'd first check what your browser's actually sending. Firebug will help ther

Re: using ffmpeg command line with python's subprocess module

2013-12-06 Thread MRAB
On 06/12/2013 15:34, Steven D'Aprano wrote: On Fri, 06 Dec 2013 06:52:48 -0800, iMath wrote: yes ,I am a native Chinese speaker.I always post question by Google Group not through email ,is there something wrong with it ? your english is a little strange to me . Mark is writing in fake old-En

Re: Python Unicode handling wins again -- mostly

2013-12-02 Thread MRAB
On 02/12/2013 21:14, Ned Batchelder wrote: On 12/2/13 3:38 PM, Ethan Furman wrote: On 11/29/2013 04:44 PM, Steven D'Aprano wrote: Out of the nine tests, Python 3.3 passes six, with three tests being failures or dubious. If you believe that the native string type should operate on code-points,

Re: how to implement a queue-like container with sort function

2013-11-28 Thread MRAB
On 29/11/2013 01:54, iMath wrote: I want to a fixed length list-like container, it should have a sorted()-like function that I can use to sort it,I think there should also a function I can use it to detect whether the numbers of items in it reaches the length of the container , because if the num

Re: For-each behavior while modifying a collection

2013-11-28 Thread MRAB
On 28/11/2013 17:20, Ned Batchelder wrote: On 11/28/13 10:49 AM, Valentin Zahnd wrote: Hello For-each does not iterate ober all entries of collection, if one removes elements during the iteration. Example code: def keepByValue(self, key=None, value=[]): for row in self.flows: if

Re: Downloading/Saving to a Directory

2013-11-28 Thread MRAB
On 28/11/2013 15:19, TheRandomPast . wrote: Hi, I've created a script that allows me to see how many images are on a webpage and their URL however now I want to download all .jpg images from this website and save them onto my computer. I've never done this before and I've become a little confuse

Re: Python and PEP8 - Recommendations on breaking up long lines?

2013-11-28 Thread MRAB
On 28/11/2013 03:06, Ben Finney wrote: Ned Batchelder writes: The important thing in a with statement is that the assigned name will be closed (or otherwise exited) automatically. The open call is just the expression used to assign the name. The expression there isn't really important. This

Re: Cracking hashes with Python

2013-11-27 Thread MRAB
On 27/11/2013 12:40, TheRandomPast . wrote: Hi, So apparently when I've been staring at code all day and tired my brain doesn't tell my hands to type half of what I want it to. I apologise for my last post. This is my code; import md5 import sys characters=range(48,57)+range(65,90)+range(97,1

Re: cx_Oracle throws: ImportError: DLL load failed: This application has failed to start ...

2013-11-24 Thread MRAB
On 24/11/2013 17:12, Ruben van den Berg wrote: I'm on Windows XP SP3, Python 2.7.1. On running import cx_Oracle I got the error ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this pro

Re: stuck at this from so much time,need help....please ..

2013-11-23 Thread MRAB
On 23/11/2013 22:29, Bhanu Karthik wrote:> On Saturday, 23 November 2013 14:23:08 UTC-8, Chris Angelico wrote: >> On Sun, Nov 24, 2013 at 9:15 AM, Bhanu Karthik >> wrote: >> > data = sock.recv(RECV_BUFFER) >> > username = str(sock.getpeername()) >> >

Re: Recursive generator for combinations of a multiset?

2013-11-22 Thread MRAB
On 23/11/2013 00:58, John O'Hagan wrote: On Thu, 21 Nov 2013 12:59:26 -0800 Dan Stromberg wrote: On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan wrote: > > Short story: the subject says it all, so if you have an answer > already, fire away. Below is the long story of what I'm using it > for, a

Re: using getattr/setattr for local variables in a member function

2013-11-21 Thread MRAB
On 21/11/2013 23:12, Catherine M Moroney wrote: Hello, If I have a class that has some member functions, and all the functions define a local variable of the same name (but different type), is there some way to use getattr/setattr to access the local variables specific to a given function? Obvi

Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend]

2013-11-20 Thread MRAB
On 21/11/2013 00:27, Steven D'Aprano wrote: On Wed, 20 Nov 2013 18:09:42 +, Mark Lawrence defended his reference to Nazism: It's an excellent analogy that I've used before, hence the smiley. Clearly you don't do any research before bothering to say anything. I for one *have* done extensiv

Re: [Python-Dev] PEP 0404 and VS 2010

2013-11-20 Thread MRAB
On 20/11/2013 23:36, Christian Tismer wrote: Hey Barry, On 20.11.13 23:30, Barry Warsaw wrote: On Nov 20, 2013, at 09:52 PM, Christian Tismer wrote: Many customers are forced to stick with Python 2.X because of other products, but they require a Python 2.X version which can be compiled using

Re: Automation

2013-11-19 Thread MRAB
On 19/11/2013 12:59, Alister wrote: On Tue, 19 Nov 2013 23:52:09 +1100, Chris Angelico wrote: On Tue, Nov 19, 2013 at 11:36 PM, Alister wrote: the language & nationality is Scottish, the people are Scots & Scotch is a type of whisky. Hmm, I don't know that it's that clear-cut (other than th

Re: grammar (was Re: Automation)

2013-11-16 Thread MRAB
On 17/11/2013 03:44, Andrew Berg wrote: On 2013.11.16 11:02, Paul Smith wrote: The one that really irks me is people using "loose" when they mean "lose". These words are not related, and they don't sound the same. Plus this mistake is very common; I typically see it at least once a day. Don't

Re: Asyncmongo and Python3: ImportError: No module named 'errors'

2013-11-16 Thread MRAB
On 16/11/2013 18:58, Laszlo Nagy wrote: I'm about to convert a complete library into python3. I need asnycmongo for this. Trying to install it on Ubuntu. After executing "sudo pip3 install asyncmongo" I have the following traceback: Traceback (most recent call last): ... import as

Re: Bug asking for input number

2013-11-15 Thread MRAB
On 16/11/2013 02:15, Arturo B wrote: Hi! I hope you can help me. I'm writting a simple piece of code. I need to keep asking for a number until it has all this specifications: - It is a number - It's lenght is 3 - The hundred's digit differs from the one's digit by at least two My problem is th

Re: Odd msg received from list

2013-11-14 Thread MRAB
On 14/11/2013 13:53, Verde Denim wrote: I got an odd message this morning from the list telling me that my account was de-activated due to excessive bounces. I've only sent a handful of messages to this board, but do read an awful lot of the posts in order to learn more about the language. The me

Re: datetime question

2013-11-12 Thread MRAB
On 13/11/2013 00:37, Dennis Lee Bieber wrote: On Wed, 13 Nov 2013 09:42:38 +1100, Chris Angelico declaimed the following: Plus, they switch clocks at 2am all the time, not at 2am forward and 3am backward. 2AM is the time at which US switches occur also, in either direction. The di

Re: Some python newb help please?

2013-11-12 Thread MRAB
On 12/11/2013 22:27, lrwarre...@gmail.com wrote:> On Tuesday, November 12, 2013 4:21:58 PM UTC-6, Mark Lawrence wrote: >> On 12/11/2013 22:14, lr@gmail.com wrote: >> >> > So I'm trying to write a program for a problem in class, and something strange is happening that I can't figure out why i

Re: datetime question

2013-11-12 Thread MRAB
On 12/11/2013 16:12, Tim Chase wrote: On 2013-11-12 17:57, Ferrous Cranus wrote: > Best practices say to move the value from local time to UTC as > soon as possible, then store/use the UTC time internally for all > operations. Only when it's about to be presented to the user > should you conver

Re: Install Tkinter for Windows 7 64-bit

2013-11-11 Thread MRAB
On 11/11/2013 16:43, jonas.thornv...@gmail.com wrote: Here is the example file i have tried. #!/usr/bin/python # -*- coding: utf-8 -*- """ ZetCode Tkinter tutorial This program draws three rectangles filled with different colors. author: Jan Bodar last modified: January 2011 website: www.zetc

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread MRAB
On 09/11/2013 22:44, Jonathan wrote: On Saturday, November 9, 2013 8:27:02 AM UTC-5, Joshua Landau wrote: `select` is quite an odd statement, in that in most cases it's just a weaker variant of `if`. By the time you're at the point where a `select` is actually more readable you're also at the p

Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf

2013-11-08 Thread MRAB
On 08/11/2013 03:30, iMath wrote: When running the following code on WinXP , all is fine , -- from win32com.shell import shell def launch_file_explorer(path, files): folder_pidl = shell.SHILCreateFromPath(path,0)[0] desktop

Re: Python 3.3.2 Shell Message‏

2013-11-07 Thread MRAB
On 07/11/2013 20:02, Bart Montgomery wrote: My thanks to Ned Deily for his timely response. IDLE is now stable, and I’m at the next step which is to run the file I created called hello.py. I get this message from the shell: Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) [GCC 4.2.1 (A

Re: To whoever hacked into my Database

2013-11-07 Thread MRAB
On 07/11/2013 18:11, Mark Lawrence wrote: On 07/11/2013 17:42, Νίκος Αλεξόπουλος wrote: Στις 7/11/2013 6:34 μμ, ο/η Mark Lawrence έγραψε: On 07/11/2013 13:47, Νίκος Αλεξόπουλος wrote: Στις 7/11/2013 11:31 πμ, ο/η Ferrous Cranus έγραψε: Τη Πέμπτη, 7 Νοεμβρίου 2013 11:15:02 π.μ. UTC+2, ο χρήστη

Re: splitting file/content into lines based on regex termination

2013-11-07 Thread MRAB
On 07/11/2013 17:45, bruce wrote: update... dat=re.compile("#(\d+) / (\d+)#(\d+)#").split(s) almost works.. except i get m = 10116#000#C S#S#100##001##DAY#Fund of Computing#Barrett, William#3#MWF#08:00am#08:50am#3718 HBLL m = 45 m = 58 m = 0 m = 10116#000#C S#S#100##002##DAY#Fund of Computi

Re: Show off your Python chops and compete with others

2013-11-06 Thread MRAB
On 07/11/2013 00:59, Chris Angelico wrote: On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward wrote: Thought this group would appreciate this: www.metabright.com/challenges/python MetaBright makes skill assessments to measure how talented people are at different skills. And recruiters use

Re: Help me with this code

2013-11-05 Thread MRAB
On 06/11/2013 01:51, chovd...@gmail.com wrote: Hi friends help me with the following code. Im able to execute the code but getting wrong output def sequence_b(N): N = 10 result = 0 for k in xrange (1,N): result += ((-1) ** (k+1))/2*k-1 print result print sequ

Re: Automation

2013-11-03 Thread MRAB
On 03/11/2013 21:53, Mark Lawrence wrote: On 03/11/2013 21:22, bob gailer wrote: On 11/3/2013 11:19 AM, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how c

Re: multiprocessing: child process race to answer

2013-11-01 Thread MRAB
On 02/11/2013 02:35, smhall05 wrote: I am using a basic multiprocessing snippet I found: #- from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker pro

Re: New to using re. Search for a number before a string.

2013-11-01 Thread MRAB
On 01/11/2013 21:33, Captain Dunsel wrote: I have a text file that has lines with numbers occasionally appearing right before a person's name. For example: COLLEGE:ENROLLMENT:COMPLETED EVALUATIONS:624309FUDD, ELMER where I want to search for the name "ELMER FUDD" and extract the number right

Re: Python wart

2013-10-31 Thread MRAB
On 01/11/2013 01:45, Mark Lawrence wrote: Quite often I type this print('Total of accounts %.2f', total) when I meant to type this print('Total of accounts %.2f' % total) Do I have to raise a PEP to get this stupid language changed so that it dynamically recognises what I want it to do and ac

Re: how to extract page-URL using BeautifulSoup

2013-10-31 Thread MRAB
On 31/10/2013 15:59, bhaktanish...@gmail.com wrote: I want to extract the page-url. for example: if i have this code import urllib2 from bs4 import BeautifulSoup link = "http://www.google.com"; page = urllib2.urlopen(link).read() soup = BeautifulSoup(page) then i can extract title of page by:

Re: First day beginner to python, add to counter after nested loop

2013-10-30 Thread MRAB
On 30/10/2013 16:31, jonas.thornv...@gmail.com wrote: Den onsdagen den 30:e oktober 2013 kl. 17:22:23 UTC+1 skrev Mark Lawrence: No that is not my problem, apparently so it is that the newsreader constructors do not like the competition of Google groups otherwise they would had written the five

Re: stacked decorators and consolidating

2013-10-29 Thread MRAB
On 29/10/2013 16:54, Tim Chase wrote: I've got some decorators that work fine as such: @dec1(args1) @dec2(args2) @dec3(args3) def myfun(...): pass However, I used that sequence quite a bit, so I figured I could do something like dec_all = dec1(args1)(dec2(args2)(dec3(args3)

Re: trying to strip out non ascii.. or rather convert non ascii

2013-10-26 Thread MRAB
On 26/10/2013 21:11, bruce wrote: hi.. getting some files via curl, and want to convert them from what i'm guessing to be unicode. I'd like to convert a string like this:: Alcántar, Iliana to:: Alcantar, Iliana where I convert the " á " to " a" which appears to be a shift of 128, but I'm not

Re: Check if this basic Python script is coded right

2013-10-26 Thread MRAB
On 26/10/2013 18:36, HC wrote: I'm doing my first year in university and I need help with this basic assignment. Assignment: Write Python script that prints sum of cubes of numbers between 0-200 that are multiples of 3. 3^3+6^3+9^3+12^3+198^3=? My script: count = 0 answer = 0 while count

Re: Unlimited canvas painting program

2013-10-24 Thread MRAB
On 24/10/2013 20:32, markot...@gmail.com wrote: So, i`ll take the canvas, somekind of mouse tracker, for each mouse location il draw a dot or 2X2 square or something. Main thing i have never understood, is how can i get the backround to move. Lets say ia hve 200X200 window. In the middle of it i

Re: functools and objective usage

2013-10-23 Thread MRAB
On 23/10/2013 17:48, Mohsen Pahlevanzadeh wrote: Dear all, I have the following code in each steps of loop: obj = partial(self.myinstance.myfunc) obj.func = self.myinstance.myfunc obj.arg = ["TWCH",self,k

Re: functools and objective usage

2013-10-22 Thread MRAB
On 22/10/2013 23:13, Ben Finney wrote: Mohsen Pahlevanzadeh writes: Suppose i have function name, 3 arguments for it, and object of its caller such as self.blahbalah This doesn't make much sense to me. I think you mean: You have an object, ‘self.blahblah’, which has a function attribute, ‘na

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