Re: Where is path.py?

2014-11-27 Thread MRAB
On 2014-11-27 14:10, David Aldrich wrote: Hi I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install: easy_install path.py The example code that I've seen imports path.py as follows: from path import path I am fairly new to Python and have a few questions about

Re: Python Signal/Slot + QThred code analysis

2014-11-25 Thread MRAB
On 2014-11-25 13:58, Juan Christian wrote: On Mon Nov 24 2014 at 11:56:31 PM Michael Torrie torr...@gmail.com mailto:torr...@gmail.com wrote: Looks alright. Does it work? Well, no =/ First I had to remove the multiple inheritance, because Qt doesn't allow that, so I removed the QObject.

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-25 Thread MRAB
On 2014-11-25 15:48, Juan Christian wrote: On Tue Nov 25 2014 at 1:42:24 PM MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: I think that the problem there is that strings don't have an __exit__ method. I don't understand what you said, what you mean

Re: scipy shape

2014-11-18 Thread MRAB
On 2014-11-19 02:30, Abdul Abdul wrote: I came across an example that starts as follows: from scipy.ndimage import filters img = zeros(im.shape) What does the second line mean here? Is it setting the image pixels to zero? What is shape here? It looks like it might be using numpy. If 'im' is

Re: from pylab import *

2014-11-16 Thread MRAB
On 2014-11-17 02:04, Abdul Abdul wrote: I came across an example that uses Matplotlib. It used the following import to use that module: from pylab import * When I tried to run the example, I got the following error: C:\Python27\python.exe

Re: Array of Functions

2014-11-14 Thread MRAB
On 2014-11-14 22:17, Richard Riehle wrote: In C, C++, Ada, and functional languages, I can create an array of functions, albeit with the nastiness of pointers in the C family. For example, an array of functions where each function is an active button, or an array of functions that behave like

Re: Help with Python Multiprocessing

2014-11-13 Thread MRAB
On 2014-11-13 18:10, Anurag wrote: On Thursday, November 13, 2014 1:07:56 PM UTC-5, Anurag wrote: I am having trouble understanding the Multiprocessing module. I need to run three different files 'Worker1' , 'Worker2', 'Worker3' all at once. Currently I am doing this : from multiprocessing

Re: How to recover bytes function?

2014-11-13 Thread MRAB
On 2014-11-13 22:32, satishmlm...@gmail.com wrote: file = open('data.bin', 'rb') bytes = file.read() bytes b'\x00\x00\x00\x02spam\x00\x03?\x9d\xf3\xb6' records = [bytes([char] * 8) for char in b'spam'] TypeError: 'bytes' object is not callable How to recover bytes function? The simple answer:

Re: Need some help with NetGroupAddUser

2014-11-11 Thread MRAB
On 2014-11-11 04:30, Jaimin Ajmeri wrote: kcollins15 at cfl.rr.com writes: New B question -- Need help with win32net.NetGroupAddUser. I used Mark Hammond sample code to create a new user from his book Python Programming on Win32. I then added one line to add the newuser to a group. def

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-10 Thread MRAB
On 2014-11-10 20:16, Ethan Furman wrote: On 11/10/2014 11:59 AM, Larry Martell wrote: On Mon, Nov 10, 2014 at 2:49 PM, Roy Smith r...@panix.com wrote: In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an

Re: Python script that does batch find and replace in txt files

2014-11-09 Thread MRAB
On 2014-11-09 21:20, Syed Khalid wrote: Code after adding path of .txt files : import glob, codecs, re, os regex = re.compile(rAge: |Sex: |House No: ) # etc etc for txt in glob.glob(D:/Python/source/*.txt): with codecs.open(txt, encoding=utf-8) as f: oldlines = f.readlines()

Re: Understanding help command description syntax - explanation needed

2014-11-06 Thread MRAB
On 2014-11-06 04:05, Gene Heskett wrote: On Wednesday 05 November 2014 21:52:42 Mark Lawrence did opine And Gene did reply: On 06/11/2014 02:37, Dave Angel wrote: Chris Angelico ros...@gmail.com Wrote in message: On Thu, Nov 6, 2014 at 2:56 AM, Larry Martell larry.mart...@gmail.com wrote:

Re: I need algorithm for my task

2014-11-05 Thread MRAB
On 2014-11-05 11:58, lordvita...@gmail.com wrote: I have line 'pythonpythonpyth'. How do I know which word is the foundation line?. Other examples: pythonpythonpyth is python DOLORIUMD is DOLORIUM HELLOLHELLO is HELLOL thewordword is thewordword I need to know whether the word in the text is

Re: [OFF-TOPIC] It is true that is impossible write in binary code, the lowest level of programming that you can write is in hex code?

2014-11-05 Thread MRAB
On 2014-11-05 02:30, Dennis Lee Bieber wrote: On Tue, 4 Nov 2014 13:45:32 -0300, françai s romaper...@gmail.com declaimed the following: I intend to write in lowest level of computer programming as a hobby. It is true that is impossible write in binary code, the lowest level of programming

Re: I need algorithm for my task

2014-11-05 Thread MRAB
On 2014-11-05 18:05, C@rlos wrote: I thing this work: stg='pythonpython' foundationline=stg[ 0:( stg [ 1: ].index( stg[ 0 ])+1 ) ] It doesn't work for the final example or barbaz. -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem adding a Key Value pair

2014-11-04 Thread MRAB
On 2014-11-04 19:37, Anurag Patibandla wrote: I am trying to add a key value pair of (Priority:1) to queue1, (Priority:2) to queue2, and (Priority:3) to queue3. When I just add (Priority:1) to queue1, it works. But when I run the above code, (Priority:3) is being added to all the queues. This

Re: what can i do to improve my skill after finished python course on codecademy

2014-11-01 Thread MRAB
On 2014-11-02 00:31, Grant Edwards wrote: On 2014-11-01, alister alister.nospam.w...@ntlworld.com wrote: The IETF motto is 'rouch consesus and running code' -- Scott Bradner (Open Sources, 1999 O'Reilly and Associates) I don't get it, and googling didn't help. What is rouch consensus? I

Re: Python Style Question

2014-10-30 Thread MRAB
On 2014-10-30 11:10, Steven D'Aprano wrote: Anton wrote: Let's say I have an incoming list of values *l*. Every element of *l* can be one of the following options: 1) an integer value 2) a string in form of 'int_value', e.g. '7' 3) a string with a json serialization of an integer value, e.g.

Re: Regex substitution trouble

2014-10-28 Thread MRAB
On 2014-10-28 12:28, massi_...@msn.com wrote: Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way: newstring = re.sub(ur(?u)(\$\[\s\w(?=\\)\]+\), subst, oldstring) but it does not work. I'm absolutely not a regex guru so I'm surely

Re: different behavior from idle/pycharm and shell

2014-10-27 Thread MRAB
On 2014-10-27 22:38, kiuhn...@yahoo.it wrote: Consider this code: --- from ctypes import * user32 = windll.user32 user32.MessageBoxA(0, 'ok', 'ok', 0) --- If I run it in idle or from pycharm, the messagebox shows 'o' instead of 'ok', but if I run it from shell, it shows 'ok' like it should.

Re: id == vs is

2014-10-26 Thread MRAB
On 2014-10-27 00:12, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Yes. I ported some Java code to Python, and it was using Java's idea of equality (via ==) in some places. Right now, I have a suite of unit tests working using the second

Re: id == vs is

2014-10-26 Thread MRAB
On 2014-10-27 00:24, Ethan Furman wrote: On 10/26/2014 05:23 PM, Ethan Furman wrote: On 10/26/2014 05:12 PM, Dan Stromberg wrote: Are the following two expressions the same? x is y Id(x) == id(y) ? Listen to MRAB, ignore me. That is all. Well, apart of Joshua's qualifications

Re: (test) ? a:b

2014-10-26 Thread MRAB
On 2014-10-27 00:38, Ben Finney wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Do you really not see the connection between counting and summing? Connection? Of course. But I also see a huge distinction. I'm surprised you could misunderstand my position to the extent you

Re: I am out of trial and error again Lists

2014-10-24 Thread MRAB
On 2014-10-25 00:57, Seymore4Head wrote: [snip] Wait! I don't get it. name=012 b=list(range(3)) print (name[1]) print (b[1]) 1 1 I forgot the b If you print the int 1, you'll see: 1 If you print the string 1, you'll see: 1 Normally you want it to print only the characters of the string.

Re: (test) ? a:b

2014-10-23 Thread MRAB
On 2014-10-23 04:46, Gregory Ewing wrote: Chris Angelico wrote: I've seen much MUCH worse... where multiple conditional expressions get combined arithmetically, and then the result used somewhere... In the days of old-school BASIC it was common to exploit the fact that boolean expressions

Re: I am out of trial and error again Lists

2014-10-23 Thread MRAB
On 2014-10-23 21:44, Seymore4Head wrote: [snip] I tried to make range(10) work in Python 3 by: if int(y) in range(10): name.append(str(y)) It doesn't. You didn't say what happened when you tried, but I can guess. When given, say, g, it complains that it's not valid.

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-22 23:30, Seymore4Head wrote: On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: One more question. if y in str(range(10) Why doesn't that work. In what way doesn't it work? If you want to know what it returns, print it out. I commented it out

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-23 01:02, Seymore4Head wrote: On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence breamore...@yahoo.co.uk wrote: On 23/10/2014 00:26, Seymore4Head wrote: On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence breamore...@yahoo.co.uk wrote: On 22/10/2014 23:30, Seymore4Head wrote: On

Re: I am out of trial and error again Lists

2014-10-22 Thread MRAB
On 2014-10-23 01:10, Seymore4Head wrote: On Thu, 23 Oct 2014 11:05:08 +1100, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Seymore4Head wrote: Those string errors were desperate attempts to fix the append error I didn't understand. Ah, the good ol' make random changes to the

Re: Building lists

2014-10-20 Thread MRAB
On 2014-10-20 19:10, Seymore4Head wrote: I haven't had a lot of practice doing this. If anyone knows of a site I would appreciate it. Will Python work like this: I am trying to come up with an example and work to it. Say I want a Grocery list and it will have a maximum size of 50 items. I

Re: Is there an easy way to control indents in Python

2014-10-20 Thread MRAB
On 2014-10-20 20:04, Juan Christian wrote: Ok, new code using ?: import sqlite3 db = sqlite3.connect('db.sqlite') def create_db(): db.execute(''' CREATE TABLE TOPICS( ID INT PRIMARY KEY NOT NULL, URL VARCHAR NOT NULL, AUTHOR VARCHAR NOT NULL, MESSAGE VARCHAR NOT NULL ); ''') def

Re: Building lists

2014-10-20 Thread MRAB
On 2014-10-20 23:30, Denis McMahon wrote: On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote: There are a number of stores, so that would be a list of stores. For each store you want the price of each item, so that would be a dict where the key is the item and the value is the price of that item

Re: Flush stdin

2014-10-18 Thread MRAB
On 2014-10-18 17:55, Nobody wrote: On Fri, 17 Oct 2014 12:38:54 +0100, Empty Account wrote: I am using netcat to listen to a port and python to read stdin and print to the console. nc -l 2003 | python print_metrics.py sys.stdin.flush() doesn’t seem to flush stdin, You can't flush an input

Re: python3 on mac-mavericks (was trying idle)

2014-10-16 Thread MRAB
On 2014-10-16 14:29, Rustom Mody wrote: On Thursday, October 9, 2014 2:56:56 PM UTC+5:30, Terry Reedy wrote: One may have to install activestate tkc/tk on mac, depending on osx version. This page has details: https://www.python.org/download/mac/tcltk Ok Ive some more information: The

Re: Creating a counter

2014-10-15 Thread MRAB
On 2014-10-15 20:24, Vincent Vande Vyvre wrote: Le 15/10/2014 20:39, Shiva a écrit : Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should

Re: How to debug Python IDLE?

2014-10-15 Thread MRAB
On 2014-10-15 20:36, ryguy7272 wrote: On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote: On 10/15/2014 3:09 PM, ryguy7272 wrote: I'm wondering how to debug code in IDLE Python 3.4. I found this. Use 3.4.2, which has an important bugfix for debugger.

Re: Import Doesn't Import

2014-10-15 Thread MRAB
On 2014-10-16 01:40, ryguy7272 wrote: So sorry everyone. I've posted here several times today. This is VERY frustrating. So, I'm reading this link. https://docs.python.org/2/howto/urllib2.html Fetching URLs The simplest way to use urllib2 is as follows: import urllib2 response =

Re: Parsing Python dictionary with multiple objects

2014-10-14 Thread MRAB
On 2014-10-14 22:15, Anurag Patibandla wrote: On Tuesday, October 14, 2014 12:59:27 PM UTC-4, Dave Angel wrote: anuragpatiband...@gmail.com Wrote in message: I have a dictionary that looks like this: {1:{Key1:Value1, Key2:Value2, Key3:Value3}, 2:{Key1:Value1, Key2:Value2, Key3:Value3},

Re: Make a colour blink

2014-10-10 Thread MRAB
On 2014-10-10 19:51, cru...@gmail.com wrote: Hello. I'm trying to make a colour blink when an event occurs. But the program is displaying only the last colour: self.bttn.bind('ButtonRelease-Return',blink) def blink(self, event=None): lbl['background'] = 'red' sleep(0.5)

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

2014-10-07 Thread MRAB
On 2014-10-07 22:48, jonathan.slend...@gmail.com wrote: Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have to run the regex

Re: Issue in printing top 20 dictionary items by dictionary value

2014-10-04 Thread MRAB
On 2014-10-04 18:36, Shiva wrote: It works : orderedwords = sorted(textstorage.keys(), key=textstorage.get) The method textstorage.get will accept a word and return it's value which in this instance is the count. What I don't understand is: for w in eachword:

Re: Issue in printing top 20 dictionary items by dictionary value

2014-10-04 Thread MRAB
On 2014-10-05 02:11, Denis McMahon wrote: On Sat, 04 Oct 2014 09:11:43 +, Shiva wrote: I have written a function that -reads a file -splits the words and stores it in a dictionary as word(key) and the total count of word in file (value). I want to print the words with top 20 occurrences

Re: Storage Cost Calculation

2014-09-27 Thread MRAB
On 2014-09-27 15:30, Ian Kelly wrote: On Fri, Sep 26, 2014 at 12:53 PM, Abohfu venant zinkeng vice...@gmail.com wrote: This site was written by a person (in 2009) who had considered this amazing trend. He collected a lot of data about hard drive capacity and price. The formula he extrapolated

Re: Dynamically swapping between two algorithms

2014-09-23 Thread MRAB
On 2014-09-23 15:48, Steven D'Aprano wrote: I have a certain calculation which can be performed two radically different ways. With the first algorithm, let's call it SHORT, performance is very fast for small values of the argument, but terrible for large values. For the second algorithm, LARGE,

Re: List insert at index that is well out of range - behaves like append that too SILENTLY

2014-09-16 Thread MRAB
On 2014-09-16 06:58, dieter wrote: Harish Tech technews.f...@gmail.com writes: Let me demonstrate the problem I encountered : I had a list a = [1, 2, 3] when I did a.insert(100, 100) [1, 2, 3, 100] as list was originally of size 4 and I was trying to insert value at index 100 , it

Re: Python 3.3.2 help

2014-09-16 Thread MRAB
On 2014-09-16 12:25, D Moorcroft wrote: Hi, Can i be taken off the list please as i am getting too many e-mails. [snip] It's up to you to unsubscribe from the list. -- https://mail.python.org/mailman/listinfo/python-list

Re: cx_freeze and architecture

2014-09-09 Thread MRAB
On 2014-09-09 14:36, Nagy László Zsolt wrote: Is it possible to create executeable for different architectures on the same windows OS? What I mean is that I can install Python 3 amd64 and then create 64 bit executeables with cx_freeze. But I cannot create 32bit x86 executeables. It would be

Re: How to turn a string into a list of integers?

2014-09-07 Thread MRAB
On 2014-09-07 02:47, Steven D'Aprano wrote: Kurt Mueller wrote: Processing any Unicode string will work with small and wide python 2.7 builds and also with python 3.3? ( parts of small build python will not work with values over 0x ) ( strings with surrogate pairs will not work correctly

Re: We made from water every living thing...

2014-09-07 Thread MRAB
On 2014-09-07 22:41, Tony the Tiger wrote: [snip] As it says here: https://www.python.org/community/lists/ Rudeness and personal attacks, even in reaction to blatant flamebait, are strongly frowned upon. People may strongly disagree on an issue, but usually discussion remains civil. In case of

Re: Storing instances using jsonpickle

2014-09-06 Thread MRAB
On 2014-09-06 01:20, Chris Angelico wrote: On Sat, Sep 6, 2014 at 3:04 AM, MRAB pyt...@mrabarnett.plus.com wrote: JSON has 'true' and 'false'. Python has 'True' and 'False'. Therefore, if you want it to be able to drop it into Python's REPL, it won't be compatible with JSON anyway! (Well

Re: My backwards logic

2014-09-05 Thread MRAB
On 2014-09-05 17:48, Seymore4Head wrote: I'm still doing practice problems. I haven't heard from the library on any of the books I have requested. http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html This is not a hard problem, but it got me to thinking a

Re: Storing instances using jsonpickle

2014-09-05 Thread MRAB
On 2014-09-04 06:17, Chris Angelico wrote: On Thu, Sep 4, 2014 at 9:39 AM, MRAB pyt...@mrabarnett.plus.com wrote: I occasionally think about a superset of JSON, called, say, pyson ... ah, name already taken! :-( While I'm somewhat sympathetic to the concept, there are some parts of your

Re: My backwards logic

2014-09-05 Thread MRAB
On 2014-09-05 18:35, Juan Christian wrote: I made this code just for fun and learning, it's working, but would this be a good approach? Thanks. import sys def prime_checker(start = 1, stop = 1): In Python, the standard is to use a half-open range. for number in range(start, stop + 1):

Re: Storing instances using jsonpickle

2014-09-04 Thread MRAB
On 2014-09-04 06:17, Chris Angelico wrote: On Thu, Sep 4, 2014 at 9:39 AM, MRAB pyt...@mrabarnett.plus.com wrote: I occasionally think about a superset of JSON, called, say, pyson ... ah, name already taken! :-( While I'm somewhat sympathetic to the concept, there are some parts of your

Re: Python is going to be hard

2014-09-03 Thread MRAB
On 2014-09-03 19:10, Seymore4Head wrote: import math import random import sys b=[] steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] for x in steve: print (steve[x]) Traceback (most recent call last): File C:\Functions\blank.py, line 7, in module print (steve[x]) IndexError: list

Re: Storing instances using jsonpickle

2014-09-03 Thread MRAB
On 2014-09-03 23:30, Josh English wrote: On Wednesday, September 3, 2014 1:53:23 PM UTC-7, Ned Batchelder wrote: Pickle (and it looks like jsonpickle) does not invoke the class' __init__ method when it reconstitutes objects. Your new __init__ is not being run, so new attributes it defines are

Re: error while writing program to send mail.

2014-09-01 Thread MRAB
On 2014-09-02 00:35, Om Prakash wrote: Hi, I am writing this program from https://docs.python.org/2/library/email-examples.html but getting the error as singhom@debian:~/pythons$ python send_email.py Traceback (most recent call last): File send_email.py, line 18, in module

Re: More questions on Python strings

2014-08-31 Thread MRAB
On 2014-08-31 18:37, Dennis E. Evans wrote: Hi I have a function that reads some meta data from a database and builds a default order by and where clause for a table. some details, rows is a list of pyOdbc.Row and will look like this [1, 'ColumnName', 3, 5] there will be one to n

Re: This could be an interesting error

2014-08-31 Thread MRAB
On 2014-08-31 22:02, Seymore4Head wrote: import math import random import sys ex='Hey buddy get away from the car' newex = ex.split() sentence= print (newex) wait = input ( Wait) def pigword(test): for x in range(len(test)): if test[x] in AEIOUaeiou: stem =

Re: This could be an interesting error

2014-08-31 Thread MRAB
On 2014-09-01 01:04, Seymore4Head wrote: On Sun, 31 Aug 2014 16:10:27 -0600, Michael Torrie torr...@gmail.com wrote: On 08/31/2014 03:02 PM, Seymore4Head wrote: def pigword(test): for x in range(len(test)): if test[x] in AEIOUaeiou: stem = test [x:] prefix

Re: PySide 1.2.2 and Python 3.4.1 - native Qt signal is not callable

2014-08-30 Thread MRAB
On 2014-08-30 14:35, Juan Christian wrote: Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1 I have this code http://pastebin.com/5NXd4Jkk that I made following a Python tutorial https://www.youtube.com/watch?v=8D_aEYiBU2c, mine is a bit different because the tutorial is

Re: Error reading from 'urllib.request' and iterating over lines

2014-08-30 Thread MRAB
On 2014-08-30 21:16, Juan Christian wrote: My code: http://pastebin.com/CBgVvT4n Line 25 returns the text correctly [1], but it seems not being parsed to line 27-28 correctly. This is just a training program that I'm doing following some books/tutorials/docs, nothing special. [1] Output from

Re: python string, best way to concat

2014-08-28 Thread MRAB
On 2014-08-27 23:59, Peter Otten wrote: Tim Chase wrote: On 2014-08-27 23:42, MRAB wrote: How many parameters are there? len(self.param) Make that many placeholders and then join them together with commas: ', '.join(['?'] * len(self.param)) I prefer the clarity of Peter Otten's suggestion

Re: Python programming

2014-08-27 Thread MRAB
On 2014-08-27 15:36, Neil D. Cerutti wrote: On 8/27/2014 9:40 AM, Jake wrote: Jake I disagree! True. Too confusing. Should be Bruce. -- https://mail.python.org/mailman/listinfo/python-list

Re: python string, best way to concat

2014-08-27 Thread MRAB
On 2014-08-27 21:31, dennisearlev...@gmail.com wrote: Hi, Sorry about the simple question but I am very new to Python. Anyway, I have a function that will be used to call a stored procedure and I need to format the string with the correct number of parameter markers for the ODBC

Re: This formating is really tricky

2014-08-26 Thread MRAB
On 2014-08-26 06:57, Mark Lawrence wrote: On 26/08/2014 02:10, Joel Goldstick wrote: you should try python-tudor mailing list I'd try python-stewart and please don't top post, you've been around long enough and ought to know better :) Should that be python-stuart? --

Re: Working with decimals part 2

2014-08-25 Thread MRAB
On 2014-08-25 18:55, Seymore4Head wrote: import sys import math def row1(number): return str(number).rjust(3) def row2(number): return str(format(number) ',.2f')) That line has to many ')'. The result of 'format' is a string, so there's no need to use 'str'. def row3(number):

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread MRAB
On 2014-08-19 09:05, Furqan wasi wrote: *Hi Mark and all, * Thanks for the replay i appreciate your help but the problem i have is not with the FileNotFoundError exception handling because the file exists but the problem is that the library libsndfile/Sndfile (python third party)

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-19 Thread MRAB
PM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: On 2014-08-19 09:05, Furqan wasi wrote: *Hi Mark and all, * Thanks for the replay i appreciate your help but the problem i have is not with the FileNotFoundError exception

Re: python scikits.audiolab Sndfile special chars in file name

2014-08-18 Thread MRAB
On 2014-08-18 16:34, Furqan wasi wrote: Hi , Could you help me out on this , or guide me to some how can thanks I am trying to get a wav file information but Sndfile is unable to read file with special characters in path and file name(查找問題daw.wav) and i am unable to get information in any way

Re: 'is not' or '!='

2014-08-18 Thread MRAB
On 2014-08-18 21:35, ElChino wrote: A newbie question to you; what is the difference between statements like: if x is not None: and if x != None: Without any context, which one should be preferred? IMHO, the latter is more readable. x == y tells you whether x and y refer to objects that

Re: Using asyncio workers in a `concurrent.futures` interface

2014-08-12 Thread MRAB
On 2014-08-12 18:02, cool-RR wrote: Hello everybody! I have a question. I have a Django app running on Heroku. I need to run about 100 worker threads there to do uploads/downloads simultaneously. A Heroku Dyno has only 512MB of memory, so I'm reluctant to run 100 worker threads. (I've had Dynos

Re: 3 Suggestions to Make Python Easier For Children

2014-08-05 Thread MRAB
On 2014-08-05 14:19, Marko Rauhamaa wrote: Skip Montanaro s...@pobox.com: On Tue, Aug 5, 2014 at 7:04 AM, Marko Rauhamaa ma...@pacujo.net wrote: I wonder if that should be built into dict. Short answer, no. I'm sure it's been proposed before. Attributes ≠ keys. When you see

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-02 Thread MRAB
On 2014-08-02 01:00, Gregory Ewing wrote: MRAB wrote: [snip] And don't mention the menu bar across the top, separated from the window to which it belonged. That seems to be a matter of taste. There are some advantages to the menu-bar-at-top model. It's an easier target to hit, because you

Re: Tkinter grid autosize help

2014-08-02 Thread MRAB
On 2014-08-02 15:38, Nicholas Cannon wrote: So i have a basic calculator program and i have a label that i want to go across the top to show the numbers and stuff like on a normal calculator. The only way i can make the buttons look neat and then when i keep pressing one the label gets larger

Re: Creating a 2s compliment hex string for negitive numbers

2014-08-01 Thread MRAB
On 2014-08-01 21:35, bSneddon wrote: I need to calculate an error correction code for an old protocol. I calculate the integer 4617 and want to code the 2s compliment in ASCII hex EDF7. When issue the following. hex(-4617) '-0x1209' Does anyone know a clean way to get to the desired

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-01 Thread MRAB
On 2014-08-01 18:16, Dietmar Schwertberger wrote: Am 01.08.2014 13:10, schrieb Wolfgang Keller: Because on such operating systems, each and every application is an entirely self-contained package that doesn't need any packages or installers to use it. For people who have never used such a

Re: Subtracting two dates in python

2014-07-31 Thread MRAB
On 2014-07-31 17:08, eshwar...@gmail.com wrote: I would like to subtract two dates i.e I have entered a date into a textbox which is of type String like below type(waitForObject(:VWAP Calculator_LCDateTextField), 07/24/14) I am capturing that date like below Current = (waitForObject(:VWAP

Re: What is best way to learn Python for advanced developer?

2014-07-30 Thread MRAB
On 2014-07-30 21:20, guirec.cor...@gmail.com wrote: Hello, I am a Ruby developer and I want to program in Python. I know how to do simple things like create classes, methods, variables and all the basics. I want to know more. I want to know what is the Python philosophy, how to test, how to

Re: Automating windows media player on win7

2014-07-23 Thread MRAB
On 2014-07-23 10:20, Deogratius Musiige wrote: Hi mate, The fix you provided works perfect. However, if I put it in a class and import, make instance and execute in another file, the audio is not played. What am I missing? This is what I do: I'm assuming that you're not actually calling

Re: What is a nit(sp?) function.

2014-07-23 Thread MRAB
On 2014-07-23 10:43, Antoon Pardon wrote: I have been looking at some python talks on you tube: https://www.youtube.com/watch?v=o9pEzgHorH0 and https://www.youtube.com/watch?v=sPiWg5jSoZI And these two both mentioned nits or nit functions or something like that. I tried to google it but came

Re: Automating windows media player on win7

2014-07-23 Thread MRAB
On 2014-07-23 12:55, Deogratius Musiige wrote: Hi, I have the mentioned imports. And for the matter of fact I can play the audio. The problem is when I make a class with the wmplayer automating code and make an instance of this class in my testing code. When I run this instance, I do not get

Re: Python 3 is killing Python

2014-07-18 Thread MRAB
On 2014-07-18 04:37, Rick Johnson wrote: On Thursday, July 17, 2014 9:15:15 PM UTC-5, Chris Angelico wrote: For myself, though, I completely do not use the editor half of [IDLE]; but it's spectacularly useful (with limitations) as my primary interactive interpreter. Yes Chris, i also think

Re: Python 3 is killing Python

2014-07-18 Thread MRAB
On 2014-07-18 19:20, Steven D'Aprano wrote: On Thu, 17 Jul 2014 11:15:59 -0700, Rick Johnson wrote: On Thursday, July 17, 2014 5:12:23 AM UTC-5, Fabien wrote: For non-informatic students [...] I don't think that's true. Less general languages like Matlab appear much easier to me: unified doc,

Re: Python 3 is killing Python

2014-07-17 Thread MRAB
On 2014-07-17 04:15, Chris Angelico wrote: On Thu, Jul 17, 2014 at 12:51 PM, Steven D'Aprano st...@pearwood.info wrote: Most programming languages are written for J. Random Hacker, not Jランダムハッカー. I had to paste that into Google Translate to be able to understand what you meant (although I

Re: This Python 3 is killing Python thread is killing me.

2014-07-16 Thread MRAB
On 2014-07-16 21:40, Skip Montanaro wrote: On Wed, Jul 16, 2014 at 3:27 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: The difference between our most illustrious resident unicode expert and rr Sorry, who is rr? I went looking in the referenced thread but found nobody with those initials.

Re: Python 3 is killing Python

2014-07-15 Thread MRAB
On 2014-07-15 13:19, alister wrote: Image, for a moment, a world WITHOUT the great USA! Yes, i know you little commies love to curse the USA, and yes, there are many dark sins committed within AND beyond her borders, but try to tell me you bass-turds, what nation in modern history has

Re: Python 3 is killing Python

2014-07-15 Thread MRAB
On 2014-07-16 00:53, Rick Johnson wrote: On Tuesday, July 15, 2014 5:40:29 PM UTC-5, Abhiram R wrote: [snip excessive quotations] Aah. Understood. Apologies for the noobishness :) Noobishness can be tolerated for a reasonable time, especially when the noob actively seeks to improve his

Re: Python 3 is killing Python

2014-07-14 Thread MRAB
On 2014-07-14 23:12, Rick Johnson wrote: On Wednesday, May 28, 2014 3:15:45 PM UTC-5, Chris Angelico wrote: On Thu, May 29, 2014 at 5:58 AM, Larry Martell wrote: No company that I work for is using python 3 - they just have too much of an investment in a python 2 code base to switch. I'm just

Re: Why is it different about '\s' Matches whitespace and Equivalent to [\t\n\r\f]?

2014-07-10 Thread MRAB
On 2014-07-10 11:05, rxjw...@gmail.com wrote: Hi, On a tutorial it says that '\s': Matches whitespace. Equivalent to [\t\n\r\f]. It's equivalent to [ \t\n\r\f], i.e. it also includes a space, so either the tutorial is wrong, or you didn't look closely enough. :-) I test it with:

Re: NaN comparisons - Call For Anecdotes

2014-07-10 Thread MRAB
On 2014-07-10 01:57, Ben Finney wrote: Anders J. Munch 2...@jmunch.dk writes: Joel Goldstick wrote: I've been following along here, and it seems you haven't received the answer you want or need. So far I received exactly the answer I was expecting. 0 examples of NaN!=NaN being beneficial.

Re: Why is it different about '\s' Matches whitespace and Equivalent to [\t\n\r\f]?

2014-07-10 Thread MRAB
On 2014-07-10 14:32, fl wrote: On Thursday, July 10, 2014 7:18:01 AM UTC-4, MRAB wrote: It's equivalent to [ \t\n\r\f], i.e. it also includes a space, so either the tutorial is wrong, or you didn't look closely enough. :-) The string starts with ' ', not '\t'. The string starts

Re: What does (A ``quote'' is the character used to open the string, i.e. either ' or .) mean?

2014-07-10 Thread MRAB
On 2014-07-10 16:23, fl wrote: On Thursday, July 10, 2014 10:14:14 AM UTC-4, Chris Kwpolska Warrick wrote: Please don't learn from this link. It's from 2001. You should learn from modern documentation: https://docs.python.org/ (if not running 3.4.x, change the version in the top) You

Re: How to decipher :re.split(r(\(\([^)]+\)\)) in the example

2014-07-10 Thread MRAB
On 2014-07-10 16:37, fl wrote: Hi, This example is from the link: https://wiki.python.org/moin/RegularExpression I have thought about it quite a while without a clue yet. I notice that it uses double quote , in contrast to ' which I see more often until now. It looks very complicated to me.

Re: Question about metacharacter '*'

2014-07-06 Thread MRAB
On 2014-07-06 13:09, Devin Jeanpierre wrote: On Sun, Jul 6, 2014 at 4:51 AM, rxjw...@gmail.com wrote: Hi, I just begin to learn Python. I do not see the usefulness of '*' in its description below: The first metacharacter for repeating things that we'll look at is *. * doesn't match the

Re: What is the difference between matchObj.group() and matchObj.group(0)

2014-07-06 Thread MRAB
On 2014-07-06 19:26, rxjw...@gmail.com wrote: Hi, I cannot get the difference between matchObj.group() and matchObj.group(0), Although there definitions are obvious different. And group() mentions 'tuple'. tuple means all the elements in line object? Match Object Methods Description

Re: How to write this repeat matching?

2014-07-06 Thread MRAB
On 2014-07-06 19:57, rxjw...@gmail.com wrote: Hi, On Python website, it says that the following match can reach 'abcb' in 6 steps: . A step-by-step example will make this more obvious. Let's consider the expression a[bcd]*b. This matches the letter 'a', zero or more letters from

Re: Question about metacharacter '*'

2014-07-06 Thread MRAB
On 2014-07-06 18:41, Albert-Jan Roskam wrote: In article d8f8d76d-0a47-4f59-8f09-da2a44cc1...@googlegroups.com, Rick Johnson rantingrickjohn...@gmail.com wrote: As an aside i prefer to only utilize a character set when nothing else will suffice. And in this case r[0-9][0-9]* can be

Re: Why is regexp not working?

2014-07-04 Thread MRAB
On 2014-07-04 13:27, Florian Lindner wrote: Hello, I have that piece of code: def _split_block(self, block): cre = [re.compile(r, flags = re.MULTILINE) for r in self.regexps] block = .join(block) print(block) print(---) for

Re: OOP with MyTime

2014-07-03 Thread MRAB
On 2014-07-03 13:51, kjaku...@gmail.com wrote: On Wednesday, July 2, 2014 4:02:00 PM UTC-4, MRAB wrote: If you want 'between' to be an instance method of the MyTime class, it needs 'self' as well as the 2 arguments 't1' and 't2'. You can then compare the hours, minutes and seconds of self

<    11   12   13   14   15   16   17   18   19   20   >