Re: Is there a graphical GUI builder?

2013-02-19 Thread Steve Simmons
On 19/02/2013 23:19, Rex Macey wrote: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to buil

Re: Import Json web data source to xls or csv

2013-02-19 Thread io
Hi Michael (name of my son) and thanks for the big help. I'm starting to love python sintax (did they call it python for the slim it is compared to other languages?) Your code didn't work immediatley as it was givin an indentation error that i sorted out quickly fixing the last two lines. It w

Re: Import Json web data source to xls or csv

2013-02-19 Thread Cousin Stanley
io wrote: > > How do i manage to read the data source > from http://bitcoincharts.com/t/markets.json > > I just need currency, symbol, bid, ask, volume > Following is a simple way load the json data and write the desired fields to a .csv file import json import urllib url

Re: Awsome Python - chained exceptions

2013-02-19 Thread alex23
On Feb 20, 3:14 am, rusi wrote: > How do you "revert to old interface"? > So far I have managed to keep to the old by > - logging out of gmail > - reload GG -- now the choice to revert should appear > > It seems everyone does not get that option In an amazing piece of software engineering, you ne

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 2:38 PM, Terry Reedy wrote: > Liskov Substitution Principle (LSP): I met this over 15 years ago reading > debates among OOP enthusiasts about whether Rectangle should be a subclass > of Square or Square a subclass of Rectangle, and similarly, whether Ostrich > can be a legi

Re: encoding error

2013-02-19 Thread Terry Reedy
On 2/19/2013 8:07 PM, halagamal2...@gmail.com wrote: UnicodeEncodeError: 'decimal' codec can't encode character u'\ufeff' in position 0: invalid decimal Unicode string I believe that is a byte-order mark, which should only be the first 2 bytes in the file and which should be removed if you use

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Gregory Ewing
Chris Angelico wrote: On Wed, Feb 20, 2013 at 7:28 AM, Serhiy Storchaka wrote: 10-15% faster: ... num = max(range(2, M + 1), key=g) ... Yes, but 20-30% less clear and readable. Though I do like the idea of playing this code in the key of G Major. On the SmartStupid, presumably. http://wor

Re: Python problem

2013-02-19 Thread ach360
Loop_variable= 1 Pi=1.0 term=0 T=1.0 While (loop_variable> 0): Loop_variable=Loop_variable+1 T=T+2.0 If (loop_variable%2 ==0): Term=0; Else: term=1; If term ==0: Pi=Pi- float(1/T); Else: Pi=Pi+ float(1/T); -- http://mail.python.org/mai

Re: Python problem

2013-02-19 Thread Steven D'Aprano
On Tue, 19 Feb 2013 19:01:53 -0800, ach360 wrote: > I'm so lost. Given the formula pi=4-4/3+4/5-4/7+4/9-4/11+.. How do I > print a table showing approximate value of pi by computing one term4-4/3 > then two terms4-4/3+4/5, and so on.Then how many terms of the series > before I get 3.14, 3.141,

Re: Is there a graphical GUI builder?

2013-02-19 Thread Michael Torrie
On 02/19/2013 07:53 PM, Roland Koebler wrote: > Hi, > >> I'm new to Python and only a hobbyist programmer. A long time ago >> I used Microsoft's Visual Basic which had a nice (graphical) >> facility for creating GUIs which was part of the development >> environment. I'm wondering if there's a ut

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread Terry Reedy
On 2/18/2013 7:18 PM, Steven D'Aprano wrote: Terry Reedy wrote: On 2/18/2013 6:47 AM, John Reid wrote: I was hoping namedtuples could be used as replacements for tuples in all instances. This is a mistake in the following two senses. First, tuple is a class with instances while namedtuple

Python problem

2013-02-19 Thread ach360
I'm so lost. Given the formula pi=4-4/3+4/5-4/7+4/9-4/11+.. How do I print a table showing approximate value of pi by computing one term4-4/3 then two terms4-4/3+4/5, and so on.Then how many terms of the series before I get 3.14, 3.141, 3.1415, 3.14159. Please helps computer teacher literall

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread workshed
On Tuesday, February 19, 2013 3:28:25 PM UTC-5, Serhiy Storchaka wrote: > 10-15% faster: > > > def f(M): > def g(n, cache = {1: 0}): > if n in cache: > return cache[n] > if n % 2: > m = 3 * n + 1 > else: > m = n // 2 >

Re: Is there a graphical GUI builder?

2013-02-19 Thread Roland Koebler
Hi, > I'm new to Python and only a hobbyist programmer. A long time ago I used > Microsoft's Visual Basic which had a nice (graphical) facility for creating > GUIs which was part of the development environment. I'm wondering if there's > a utility for Python to build GUIs. yes, there are seve

Re: Is there a graphical GUI builder?

2013-02-19 Thread duncan smith
On 19/02/13 22:19, Rex Macey wrote: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to build

Re: Import Json web data source to xls or csv

2013-02-19 Thread Michael Herman
First - you can use Python in Excel. http://www.python-excel.org/ or https://www.datanitro.com/ Updated code: import json import urllib import csv url = "http://bitcoincharts.com/t/markets.json"; response = urllib.urlopen(url); data = json.loads(response.read()) f = open("bitcoin.csv","wb") c =

encoding error

2013-02-19 Thread halagamal2009
i'm trying to make indexing of csv file contain arabic words my code: from whoosh import fields, index import os.path import csv import codecs # This list associates a name with each position in a row columns = ["juza","chapter","verse","voc","analysis", "unvoc","root"] schema = fields.Schema(juza

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 5:23 PM, Alexander Blinne wrote: > If changed into > > signed int n; > > there is a veeery long, perhaps infinite loop. Yes, infinite. Here's the first such sequence encountered with a signed 32-bit int. [113383, 340150, 170075, 510226, 255113, 765340, 382670, 191335, 57

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Alexander Blinne
Am 19.02.2013 12:42, schrieb Piet van Oostrum: > Terry Reedy writes: >> I find this surprising too. I am also surprised that it even works, >> given that the highest intermediate value is about 57 billion and I do >> not remember that Basic had infinite precision ints. > > That may explain why th

Re: Simulation of human body in movement

2013-02-19 Thread Nick Mellor
LOL thanks Rick, I'm a movement teacher and want to demonstrate how head balance affects the rest of the body. I want to do something simple to start with, probably with blocks, hinges and springs. Ideally I'd like the simulation to be an interactive, real-time element on a web page. By moving

Import Json web data source to xls or csv

2013-02-19 Thread io
Hi, i'm new to python and programming with it and so for json format. I have my excel 2010 program with vba that does the following : - read the data flow from http://bitcoincharts.com/t/markets.json - elaborate it and puts it in excel 2010 for further calculations What i'm willing to do is the

Re: Is there a graphical GUI builder?

2013-02-19 Thread Miki Tebeka
> I'm wondering if there's a utility for Python to build GUIs. IIRC the Qt builder can generate Python code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Verification of bank number using modulus 11

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 3:59 PM, Morten Engvoldsen wrote: > But can you tell me how could i implement below > > "If digits 5 and 6 of the account number are zeros, the check digit is > calculated on the 7, 8, 9 and 10th digit of the account number." > > which means if account number is "8601.00.17

Re: Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
Hi Team, Thanks for the code. I have altered the code with below code, it is able to validate the number now, def calc_checkdigit(isbn): isbn = isbn.replace(".", "") check_digit = int(isbn[-1]) isbn = isbn[:-1] if len(isbn) != 10: return False weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2] result = s

Re: Is there a graphical GUI builder?

2013-02-19 Thread Phil
On 20/02/13 08:19, Rex Macey wrote: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to build

Re: Is there a graphical GUI builder?

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 9:19 AM, Rex Macey wrote: > I'm new to Python and only a hobbyist programmer. A long time ago I used > Microsoft's Visual Basic which had a nice (graphical) facility for creating > GUIs which was part of the development environment. I'm wondering if there's > a utility

Re: Is there a graphical GUI builder?

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 3:19 PM, Rex Macey wrote: > I'm new to Python and only a hobbyist programmer. A long time ago I used > Microsoft's Visual Basic which had a nice (graphical) facility for creating > GUIs which was part of the development environment. I'm wondering if there's > a utility

Re: Is there a graphical GUI builder?

2013-02-19 Thread Mark Lawrence
On 19/02/2013 22:19, Rex Macey wrote: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to buil

Is there a graphical GUI builder?

2013-02-19 Thread Rex Macey
I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. I'm wondering if there's a utility for Python to build GUIs. I see that there is TKinter, wh

Re: Python module import failed error

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 4:45 AM, wrote: > The directory /home/matt/bin contains "multimode_helper.py" and this file > path is in the PYTHONPATH. I still get the import error however. so now that > i know the file path is in PYTHONPATH but i am still getting the import error > i am really conf

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 7:28 AM, Serhiy Storchaka wrote: > 10-15% faster: > ... num = max(range(2, M + 1), key=g) ... Yes, but 20-30% less clear and readable. Though I do like the idea of playing this code in the key of G Major. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
Here is the PYTHONPATH >>> import sys >>> sys.path ['', '/home/matt', '/users/matt/bin', '/home/matt/bin', '/Home/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/

Re: Verification of bank number using modulus 11

2013-02-19 Thread MRAB
On 2013-02-19 20:50, Morten Engvoldsen wrote: Hi Team, I am trying to verify the account number using the following algorithm: > "The valid account number is 11 numeric digit without seperator. Eg. 8607947 is a valid account number. All banks apply a modulus-based method for the validation

Re: Verification of bank number using modulus 11

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 1:50 PM, Morten Engvoldsen wrote: > Here is my code: > def calc_checkdigit(isbn): > isbn = isbn.replace(".", "") > check_digit = int(isbn[-1]) > isbn = isbn[:-1] > if len(isbn) != 10: >return False > result = sum((10

Re: First attempt at a Python prog (Chess)

2013-02-19 Thread Neil Cerutti
On 2013-02-15, MRAB wrote: > On 2013-02-15 16:17, Neil Cerutti wrote: >> On 2013-02-15, Oscar Benjamin wrote: >>> if score > best_score or best_score is None: >> >> You need the None check first to avoid an exception from the >> comparison. > > Only in Python 3. It is a more difficult to find bu

Re: Verification of bank number using modulus 11

2013-02-19 Thread Dave Angel
On 02/19/2013 03:50 PM, Morten Engvoldsen wrote: Hi Team, I am trying to verify the account number using the following algorithm: "The valid account number is 11 numeric digit without seperator. Eg. 8607947 is a valid account number. All banks apply a modulus-based method for the validation

Re: backporting PEP 3134 "Exception Chaining and Embedded Tracebacks" to Python 2.7

2013-02-19 Thread Demian Brecht
Zero. There are no new features being added to 2.7. Demian Brecht http://demianbrecht.github.com On 2013-02-19 12:54 PM, "Piotr Dobrogost" wrote: >Hi! > >What is a chance of backporting PEP 3134 "Exception Chaining and Embedded >Tracebacks" to Python 2.7? > > >Regards, >Piotr Dobrogost >--

backporting PEP 3134 "Exception Chaining and Embedded Tracebacks" to Python 2.7

2013-02-19 Thread Piotr Dobrogost
Hi! What is a chance of backporting PEP 3134 "Exception Chaining and Embedded Tracebacks" to Python 2.7? Regards, Piotr Dobrogost -- http://mail.python.org/mailman/listinfo/python-list

Verification of bank number using modulus 11

2013-02-19 Thread Morten Engvoldsen
Hi Team, I am trying to verify the account number using the following algorithm: "The valid account number is 11 numeric digit without seperator. Eg. 8607947 is a valid account number. All banks apply a modulus-based method for the validation of the account structure. The 10-digit account numb

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Serhiy Storchaka
On 19.02.13 20:31, Ian Kelly wrote: On Tue, Feb 19, 2013 at 7:46 AM, Tim Daneliuk wrote: Are you sure you wouldn't like to share with the class? I'd be interested in seeing your approach... Very well: def collatz(n, memo): if n not in memo: if n % 2 == 0: next_n =

Re: First attempt at a Python prog (Chess)

2013-02-19 Thread Ian Kelly
On Mon, Feb 18, 2013 at 9:15 PM, Tim Roberts wrote: > Chris Hinsley wrote: >> >>Is a Python list as fast as a bytearray ? > > Python does not actually have a native array type. Everything in your > program that looked like an array was actually a list. How do you mean? >>> isinstance(bytearray

Re: Double posts (was Re: Python module import failed error)

2013-02-19 Thread matt . doolittle33
Thanks Lele. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Ian Kelly
On Tue, Feb 19, 2013 at 7:46 AM, Tim Daneliuk wrote: > Are you sure you wouldn't like to share with the class? I'd be interested > in seeing your approach... Very well: def collatz(n, memo): if n not in memo: if n % 2 == 0: next_n = n // 2 else: next_

Double posts (was Re: Python module import failed error)

2013-02-19 Thread Lele Gaifax
matt.doolittl...@gmail.com writes: > Does anyone know why i keep having these double posts? That's because your posts carry the following headers: To: python-list@python.org Cc: python-list@python.org or these (from a previous message): To: comp.lang.pyt...@googlegroups.com Cc: python-

Re: improving performance of writing into a pipe

2013-02-19 Thread Michael Torrie
On 02/19/2013 02:24 AM, mikp...@gmail.com wrote: > Or rather: what would you try to catch in this particular case? As Peter said, nothing for now. But you seem very resistant to telling us what exception was raised. Though looking at your code more closely I can see that likely the error is rela

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
> > gnuradiocompanion.py ? And does the error message/stacktrace appear in > > the same terminal window? > hi. ok so i am trying to run the python module (multimode_helper.py) in the GNU radio companion (GRC) which is sort of like an IDE which lets you organize code blocks by arranging

Re: Python module import failed error

2013-02-19 Thread Mark Lawrence
On 19/02/2013 16:57, matt.doolittl...@gmail.com wrote: What is PYTHONPATH actually set to? You can find out by running python interactively, then i dont know. how do i run pythoin interactively? Type python at a command prompt :) -- Cheers. Mark Lawrence -- http://mail.python.org/mai

Re: Python module import failed error

2013-02-19 Thread Dave Angel
On 02/19/2013 11:57 AM, matt.doolittl...@gmail.com wrote: What is PYTHONPATH actually set to? You can find out by running python interactively, then i dont know. how do i run pythoin interactively? By typing the simple command 'python' davea@think2:~$ python Python 2.7.3 (default, A

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
> > What is PYTHONPATH actually set to? OK so i ran python and then : import sys sys.path bash returned: ['', '/home/matt', '/users/matt/bin', '/home/matt/bin', '/Home/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',

Re: Awsome Python - chained exceptions

2013-02-19 Thread rusi
On Feb 19, 7:18 am, alex23 wrote: > On Feb 18, 3:51 pm, Rick Johnson wrote: > > > I apologize for this doubling of my messages and i can assure you i > > don't do this intentionally. Proper netiquette is very important to me. > > These double posts are another unfortunate side-effect of using the

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
Does anyone know why i keep having these double posts? please excuse them; i am a super newbie to this forum (and python obviously). Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
> What is PYTHONPATH actually set to? You can find out by running python > > interactively, then i dont know. how do i run pythoin interactively? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
On Tuesday, February 19, 2013 11:44:32 AM UTC-5, Thomas Calmant wrote: > Hi, > > Do you run Python in the same terminal than where you run the export command ? > no i dont. the python program looking for the modules in the ~/bin directory is called GNU radio companion. -- http://mail.python.

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
On Tuesday, February 19, 2013 11:39:14 AM UTC-5, Chris Angelico wrote:> > > What exactly do you mean by "no luck"? More details would be good. > The program i am using (GNU radio companion) that wants to import the modules from the ~/bin folder shows this error: Block - import_0_0_0 - Import(

Re: Python module import failed error

2013-02-19 Thread Mark Lawrence
On 19/02/2013 16:28, matt.doolittl...@gmail.com wrote: My guess would be /home/matt/bin - note the leading slash. ChrisA correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command? What is PYTHONPATH act

Re: Python module import failed error

2013-02-19 Thread Thomas Calmant
Hi, Do you run Python in the same terminal than where you run the export command ? ++ Thomas 2013/2/19 > My guess would be /home/matt/bin - note the leading slash. > > > > > > > > ChrisA > > correct. and in the home directory i run export > PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had

Re: Python module import failed error

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 3:28 AM, wrote: > My guess would be /home/matt/bin - note the leading slash. >> >> >> >> ChrisA > > correct. and in the home directory i run export > PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the > wrong command? What exactly do you mean

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
My guess would be /home/matt/bin - note the leading slash. > > > > ChrisA correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module import failed error

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 3:17 AM, wrote: > thats the file path. the directory "bin" in my home directory. in bash it > obviously looks like this "~/bin" using the file system folder the path is > home/Home/bin. i have tried commands like, export > PYTHONPATH=${PYTHONPATH}:/users/matt/bin or

Re: Python module import failed error

2013-02-19 Thread matt . doolittle33
> > What do you mean by that path? That doesn't look like an Ubuntu/Linux > > path name. Pull up a terminal (Ctrl-Alt-T should do that for you, > > though I haven't used an Ubuntu since 10.10) and see if you can 'ls' > > the path - once you have the real path name (it might start with > > /ho

Re: IOerror : need urgent help

2013-02-19 Thread Mark Lawrence
On 19/02/2013 15:40, Thomas Calmant wrote: hi It seems you forgot to escape the escape character in the file names ('\'): "C:\Users\inshu.chauhan\Desktop\test.arff" => r"C:\Users\inshu.chauhan\Desktop\test.arff" or => "C:\\Users\\inshu.chauhan\\Desktop\\test.arff" ++ Thomas Yuck :) -- Cheer

Re: IOerror : need urgent help

2013-02-19 Thread inshu chauhan
On Tue, Feb 19, 2013 at 4:54 PM, MRAB wrote: > On 2013-02-19 15:27, inshu chauhan wrote: > >> Here is my attempt to merge 10 files stored in a folder into a single >> file : >> >> import csv >> >> with open("C:\Users\inshu.chauhan\**Desktop\test.arff", "w") as w: >> writer = csv.writer(w) >>

Re: Awsome Python - chained exceptions

2013-02-19 Thread rurpy
On 02/18/2013 07:18 PM, alex23 wrote: >[...] > Weird, I'm using GG too and not seeing any doubling of my messages. I > have reverted to using the old interface, though, so it might be a > side-effect of the new version they're hyping, which does seem to have > been designed by Satan himself (the wa

Re: CBT code in python

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 2:49 AM, Megha Agrawal wrote: > I am not getting my answer thats why I am asking. Making repeated requests is usually not an effective way to get information. Especially considering how brief and incomplete your original question was, I suspect a lot of people deleted it a

Re: IOerror : need urgent help

2013-02-19 Thread MRAB
On 2013-02-19 15:27, inshu chauhan wrote: Here is my attempt to merge 10 files stored in a folder into a single file : import csv with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w: writer = csv.writer(w) for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For Model_600\*.

Re: CBT code in python

2013-02-19 Thread Megha Agrawal
I am not getting my answer thats why I am asking. On Tue, Feb 19, 2013 at 9:10 PM, Mark Lawrence wrote: > On 19/02/2013 15:27, Megha Agrawal wrote: > >> Plsss help !! >> >> On Tue, Feb 19, 2013 at 12:40 AM, Megha Agrawal > > wrote: >> >> Hi, >> >> Does any

Re: Facebook Graph API

2013-02-19 Thread Сахнов Михаил
You need to get token from API server before signing requests with it, don't you? 19.02.2013 16:42 пользователь "takeshi honda" написал: > The following code gave me the error, "facebook.GraphAPIError: Unsupported > operation". How can I fix this error? > > import facebook > import sys; > > token

Re: IOerror : need urgent help

2013-02-19 Thread Mark Lawrence
On 19/02/2013 15:27, inshu chauhan wrote: Here is my attempt to merge 10 files stored in a folder into a single file : import csv with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w: writer = csv.writer(w) for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For Model_600\*.

Re: CBT code in python

2013-02-19 Thread Mark Lawrence
On 19/02/2013 15:27, Megha Agrawal wrote: Plsss help !! On Tue, Feb 19, 2013 at 12:40 AM, Megha Agrawal mailto:me...@greybatter.com>> wrote: Hi, Does anybody have code for Complete Binary tree for a given no of leaves?? Thanks in advance!! Search engines are available t

Re: IOerror : need urgent help

2013-02-19 Thread Thomas Calmant
hi It seems you forgot to escape the escape character in the file names ('\'): "C:\Users\inshu.chauhan\Desktop\test.arff" => r"C:\Users\inshu.chauhan\Desktop\test.arff" or => "C:\\Users\\inshu.chauhan\\Desktop\\test.arff" ++ Thomas 2013/2/19 inshu chauhan > Here is my attempt to merge 10 files

IOerror : need urgent help

2013-02-19 Thread inshu chauhan
Here is my attempt to merge 10 files stored in a folder into a single file : import csv with open("C:\Users\inshu.chauhan\Desktop\test.arff", "w") as w: writer = csv.writer(w) for f in glob.glob("C:\Users\inshu.chauhan\Desktop\For Model_600\*.arff"): rows = open(f, "r").readlines(

Re: Facebook Graph API

2013-02-19 Thread Terry Reedy
On 2/19/2013 7:37 AM, takeshi honda wrote: The following code gave me the error, "facebook.GraphAPIError: Unsupported operation". How can I fix this error? import facebook import sys; token = 'mytokenx'; graph = facebook.GraphAPI(token) profile = graph.get_object("myusername") friends

Re: CBT code in python

2013-02-19 Thread Megha Agrawal
Plsss help !! On Tue, Feb 19, 2013 at 12:40 AM, Megha Agrawal wrote: > Hi, > > > Does anybody have code for Complete Binary tree for a given no of leaves?? > > > Thanks in advance!! > -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module import failed error

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 2:23 AM, wrote: > Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to add a > directory to the PYTHONPATH. All of the commands I have found on the web > have failed. Please help me to add a directory to the PYHONPATH. The file > path is Home/home/bi

Python module import failed error

2013-02-19 Thread matt . doolittle33
Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to add a directory to the PYTHONPATH. All of the commands I have found on the web have failed. Please help me to add a directory to the PYHONPATH. The file path is Home/home/bin. Thanks in advance. -- http://mail.python.or

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Tim Daneliuk
On 02/18/2013 03:54 PM, Ian Kelly wrote: On Mon, Feb 18, 2013 at 12:13 PM, John Immarino wrote: I coded a Python solution for Problem #14 on the Project Euler website. I was very surprised to find that it took 107 sec. to run even though it's a pretty simple program. I also coded an equivale

Re: improving performance of writing into a pipe

2013-02-19 Thread mikprog
> > Thanks a lot Serhiy to you and to everyone else. > > > Do you mind telling us what fix you applied? Oh, apologies Peter, I thought it was clear as I posted it after the lines written by Serhiy. So it was what Serhiy suggest in addition to some (?minor?) modification to the pipe itself, wh

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Olive
> max=0 > m=0 > while m<=100: > m+=1 > count=0 > n=m > while n!=1: > count+=1 > if n%2==0: > n=n//2 > else: > n=3*n+1 > if count>max: > max=count > num=m > print(num,max) > I have tried to run your program

Re: improving performance of writing into a pipe

2013-02-19 Thread Peter Otten
mikp...@gmail.com wrote: >> def write_to_pipe(line): >> hexbytes = ''.join('\\x%02x' % ord(c) for c in line) I thought this was only needed to have 'echo' except your data. >> with open('/tmp/mypipe', 'w') as f: >> f.write(hexbytes) > Update: > with a fix in the pipe THIS was

Re: Making unhashable object

2013-02-19 Thread Peter Otten
Olive wrote: > I am trying to define a class whose instances should not be hashable, > following: > http://docs.python.org/2/reference/datamodel.html#object.__hash__ > > class A: > def __init__(self,a): > self.value=a > __hash__=None > > > Then: > a=A(3) hash(a) >

Re: Making unhashable object

2013-02-19 Thread Chris Angelico
On Wed, Feb 20, 2013 at 12:38 AM, Olive wrote: > I am trying to define a class whose instances should not be hashable, > following: http://docs.python.org/2/reference/datamodel.html#object.__hash__ > > class A: > def __init__(self,a): > self.value=a > __hash__=None This is an old

Re: Making unhashable object

2013-02-19 Thread Jean-Michel Pichavant
- Original Message - > I am trying to define a class whose instances should not be hashable, > following: > http://docs.python.org/2/reference/datamodel.html#object.__hash__ > > class A: > def __init__(self,a): > self.value=a > __hash__=None > > > Then: > > >>> a=A(3

Making unhashable object

2013-02-19 Thread Olive
I am trying to define a class whose instances should not be hashable, following: http://docs.python.org/2/reference/datamodel.html#object.__hash__ class A: def __init__(self,a): self.value=a __hash__=None Then: >>> a=A(3) >>> hash(a) Traceback (most recent call last): Fil

Re: improving performance of writing into a pipe

2013-02-19 Thread mikprog
> > def write_to_pipe(line): > > hexbytes = ''.join('\\x%02x' % ord(c) for c in line) > > with open('/tmp/mypipe', 'w') as f: > > f.write(hexbytes) Update: with a fix in the pipe THIS was the right way to do it, and it now works. Thanks a lot Serhiy to you and to everyone e

ANN: pyftpdlib 1.0.0 released

2013-02-19 Thread Giampaolo Rodolà
Hi there guys, After 1 year of development and refinements I'm pleased to announce a release of pyftpdlib which appears to be the fastest FTP server out there (on UNIX at least)! See: http://code.google.com/p/pyftpdlib/wiki/Benchmarks 1.0.0 release introduces serious improvements amongst which pyt

Re: Data Tree urgent help!!!!!!

2013-02-19 Thread Ana Dionísio
Thank you so much!!! It works perfectly!!! ;) -- http://mail.python.org/mailman/listinfo/python-list

Facebook Graph API

2013-02-19 Thread takeshi honda
The following code gave me the error, "facebook.GraphAPIError: Unsupported operation". How can I fix this error? import facebook import sys; token = 'mytokenx'; graph = facebook.GraphAPI(token) profile = graph.get_object("myusername") friends = graph.get_connections("myusername", "frien

Re: Data Tree urgent help!!!!!!

2013-02-19 Thread Peter Otten
anadionisio...@gmail.com wrote: > Hello! > I have this lists with information and I need to make a "tree" by > associating the information inside the lists. For example: > > l1 = [apple, pear] > l2 = [dog, cat] > l3 = [fork, spoon] > > And I need to make something like this: > > l4 = [apple, do

Data Tree urgent help!!!!!!

2013-02-19 Thread anadionisio257
Hello! I have this lists with information and I need to make a "tree" by associating the information inside the lists. For example: l1 = [apple, pear] l2 = [dog, cat] l3 = [fork, spoon] And I need to make something like this: l4 = [apple, dog, fork] l5 = [apple, dog, spoon] l6= [apple, cat, fo

Re: improving performance of writing into a pipe

2013-02-19 Thread mikprog
On Monday, February 18, 2013 7:29:09 PM UTC, Serhiy Storchaka wrote: > On 18.02.13 17:12, mikp...@gmail.com wrote: > > > on an embedded linux system (BeagleBoard) I am writing data coming from > > bluetooth dongle into a pipe. > > > The function is the following one: > > > > > > > > > def wri

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Piet van Oostrum
Terry Reedy writes: > On 2/18/2013 2:13 PM, John Immarino wrote: >> I coded a Python solution for Problem #14 on the Project Euler >> website. I was very surprised to find that it took 107 sec. to run >> even though it's a pretty simple program. I also coded an equivalent >> solution for the pro

Re: improving performance of writing into a pipe

2013-02-19 Thread Oscar Benjamin
On 19 February 2013 10:27, wrote: >> can work. As a few people already told you the built-in open() > > > Few people? > I thought Oscar was a singular person, not a group of people :-) Serhiy also suggested it. > Seriously, I am convinced by that approach (thanks) and I wish to go that > way,

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Serhiy Storchaka
On 18.02.13 21:13, John Immarino wrote: max=0 m=0 while m<=100: m+=1 count=0 n=m while n!=1: count+=1 if n%2==0: n=n//2 else: n=3*n+1 if count>max: max=count num=m print(num,max) Some minor tip

Re: Python 3.3 vs. MSDOS Basic

2013-02-19 Thread Anssi Saari
John Immarino writes: > I coded a Python solution for Problem #14 on the Project Euler > website. I was very surprised to find that it took 107 sec. to run > even though it's a pretty simple program. I also coded an equivalent > solution for the problem in the old MSDOS basic. (That's the 16 bit

Re: improving performance of writing into a pipe

2013-02-19 Thread mikprog
> > Once you get your script working you can try to provoke errors, and for > > those errors you can recover from you can write error handlers. For IOError > > and Python < 3.3 that may involve inspecting the errno attribute and > > conditionally reraising. Ok. > By the way, I don't thi

Re: Instances as dictionary key, __hash__ and __eq__

2013-02-19 Thread Jean-Michel Pichavant
> > Additionally, If I'm making things much more complicated than they > > need to be, let me know. > > You are. There are ways to achieve what you want, but it requires a > lot more setup and discipline. The simplest way is probably to have > a _equal_fields() method that subclasses override, r

Re: improving performance of writing into a pipe

2013-02-19 Thread Peter Otten
mikp...@gmail.com wrote: > On Monday, February 18, 2013 6:12:01 PM UTC, Michael Torrie wrote: >> On 02/18/2013 10:00 AM, mikp...@gmail.com wrote: >> >> > [..] >> >> >> >> >> >> I don't see an exception in your answer. Where did you put it for us? >> >> >> >> >> > >> >> > well I just did pri

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread Steven D'Aprano
On Mon, 18 Feb 2013 23:48:46 -0800, raymond.hettinger wrote: [...] > If your starting point is an existing iterable such as s=['Guido', > 'BDFL', 1], you have a couple of choices: p=Person(*s) or > p=Person._make(s). The latter form was put it to help avoid unpacking > and repacking the argumen

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread Steven D'Aprano
On Mon, 18 Feb 2013 23:48:46 -0800, raymond.hettinger wrote: [...] > If your starting point is an existing iterable such as s=['Guido', > 'BDFL', 1], you have a couple of choices: p=Person(*s) or > p=Person._make(s). The latter form was put it to help avoid unpacking > and repacking the argumen

Re: Differences creating tuples and collections.namedtuples

2013-02-19 Thread Steven D'Aprano
Pardon me for the double-post, if any, my news client appears to have eaten my first reply. On Mon, 18 Feb 2013 23:48:46 -0800, raymond.hettinger wrote: [...] > If your starting point is an existing iterable such as s=['Guido', > 'BDFL', 1], you have a couple of choices: p=Person(*s) or > p=Pe

  1   2   >