Re: codecs.StreamRecoder not doing what I expected.

2015-12-12 Thread D'Arcy J.M. Cain
On Sat, 12 Dec 2015 21:35:36 +0100 Peter Otten <__pete...@web.de> wrote: > def read_file(filename): > for encoding in ["utf-8", "iso-8859-1"]: > try: > with open(filename, encoding=encoding) as f: > return f.read() > except UnicodeDecodeError: >

Re: Problem with sqlite3 and Decimal

2015-12-12 Thread Frank Millman
"Chris Angelico" wrote in message news:CAPTjJmrfw-qNx-a=3q2qj244fgvxz3mpe4wa-wdusmchxuf...@mail.gmail.com... On Sun, Dec 13, 2015 at 4:00 PM, Frank Millman wrote: > My new solution is to pass a 'scale' factor into my aggregate function. > The > function uses the Decimal quantize method to ro

Re: Problem with sqlite3 and Decimal

2015-12-12 Thread Chris Angelico
On Sun, Dec 13, 2015 at 4:00 PM, Frank Millman wrote: > My new solution is to pass a 'scale' factor into my aggregate function. The > function uses the Decimal quantize method to round the result before > returning. So far it seems to be working. So, effectively, you're using fixed point arithmet

Re: Problem with sqlite3 and Decimal

2015-12-12 Thread Frank Millman
"Frank Millman" wrote in message news:n4gigr$f51$1...@ger.gmane.org... I have found a workaround for my problem, but first I needed to understand what was going on more clearly. This is what I have figured out. [...] The reason for the '#' in the above function is that sqlite3 passes the cu

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Steven D'Aprano
On Sun, 13 Dec 2015 01:31 pm, Robert wrote: > pydoc.help('module1') > Help on module module1: You don't need to do all that. help() has been a built-in command for Python for, oh, probably a decade or more. Technically, it is added to the built-ins on startup, so if you mess about with the site.

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Robert
On Saturday, December 12, 2015 at 7:36:21 PM UTC-5, Peter Otten wrote: > Robert wrote: > > > On Saturday, December 12, 2015 at 7:05:39 PM UTC-5, Robert wrote: > >> On Saturday, December 12, 2015 at 6:24:25 PM UTC-5, Erik wrote: > >> > On 12/12/15 23:08, Robert wrote: > >> > > In fact, I wanted to

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 15:01:54 -0800, Robert writes: >Hi, > >I want to use pydoc as some online tutorial shows, but it cannot run as >below. What is wrong? > > >Thanks, > > > > import pydoc pydoc > pydoc sys >SyntaxError: invalid syntax import sys pydoc sys >Syn

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Peter Otten
Robert wrote: > On Saturday, December 12, 2015 at 7:05:39 PM UTC-5, Robert wrote: >> On Saturday, December 12, 2015 at 6:24:25 PM UTC-5, Erik wrote: >> > On 12/12/15 23:08, Robert wrote: >> > > In fact, I wanted to run the following code. When it failed, I moved >> > > to the original question abo

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Erik
On 13/12/15 00:19, Robert wrote: It turns out that Enthought does not allow pydoc as the link said: http://stackoverflow.com/questions/12063718/using-help-and-pydoc-to-list-python-modules-not-working I don't think that's what the article is telling you. Try what I said in my previous message.

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Robert
On Saturday, December 12, 2015 at 7:05:39 PM UTC-5, Robert wrote: > On Saturday, December 12, 2015 at 6:24:25 PM UTC-5, Erik wrote: > > On 12/12/15 23:08, Robert wrote: > > > In fact, I wanted to run the following code. When it failed, I moved to > > > the original question above. > > > > How did

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Erik
Hi Robert, On 13/12/15 00:04, Robert wrote: Excuse me for the incomplete information on previous posts. Here is the message when I run it on Canopy (module1.py and module2.py are in the current folder): Welcome to Canopy's interactive data-analysis environment! with pylab-backend set to: qt T

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Robert
On Saturday, December 12, 2015 at 6:24:25 PM UTC-5, Erik wrote: > On 12/12/15 23:08, Robert wrote: > > In fact, I wanted to run the following code. When it failed, I moved to > > the original question above. > > How did it fail? Tell us what _did_ happen. > > It works fine for me: > > $ pydoc mo

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Erik
On 12/12/15 23:08, Robert wrote: In fact, I wanted to run the following code. When it failed, I moved to the original question above. How did it fail? Tell us what _did_ happen. It works fine for me: $ pydoc module1 Help on module module1: NAME module1 FILE /tmp/robert/module1.py D

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Ben Finney
Robert writes: > I want to use pydoc as some online tutorial shows Which online tutorial? Please give the URL to the page that instructs you to use ‘pydoc’ in that manner. > >>> import pydoc Allows you to use, in Python code, the ‘pydoc’ module by name. > >>> pydoc > Accesses the ‘pydoc’ na

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Erik
Hi Robert, On 12/12/15 23:01, Robert wrote: I want to use pydoc as some online tutorial shows, but it cannot run as below. What is wrong? "some online tutorial"? import pydoc pydoc Correct - in the interactive interpreter, typing the name of an object prints its value. You have imported

Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Robert
On Saturday, December 12, 2015 at 6:02:11 PM UTC-5, Robert wrote: > Hi, > > I want to use pydoc as some online tutorial shows, but it cannot run as > below. What is wrong? > > > Thanks, > > > > > >>> import pydoc > >>> pydoc > > >>> pydoc sys > SyntaxError: invalid syntax > >>> import sys

Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Robert
Hi, I want to use pydoc as some online tutorial shows, but it cannot run as below. What is wrong? Thanks, >>> import pydoc >>> pydoc >>> pydoc sys SyntaxError: invalid syntax >>> import sys >>> pydoc sys SyntaxError: invalid syntax >>> help(pydoc) Help on module pydoc: .. -- https://m

Re: appending a line to a list based off of a string found in a previous list

2015-12-12 Thread Pedro Vincenty
On Saturday, December 12, 2015 at 4:48:46 PM UTC-5, Pedro Vincenty wrote: > Hello, I'm wondering how to append a line from a file onto a list(easy part) > provided that the line contains strings specific to a previous list I've > already made(hard part). I have this right now, > for line in sat

Re: appending a line to a list based off of a string found in a previous list

2015-12-12 Thread Erik
Hi Pedro, It would be _really useful_ if you included code that could be pasted into an interpreter or file directly to show your problem. You are referencing several data sources ("satellite_dataread" and "list2") that we can only guess at. On 12/12/15 21:48, Pedro Vincenty wrote: Hello, I'm w

Re: appending a line to a list based off of a string found in a previous list

2015-12-12 Thread Terry Reedy
On 12/12/2015 4:48 PM, Pedro Vincenty wrote: Hello, I'm wondering how to append a line from a file onto a list(easy part) provided that the line contains strings specific to a previous list I've already made(hard part). I have this right now, for line in satellite_dataread: if any(i i

appending a line to a list based off of a string found in a previous list

2015-12-12 Thread Pedro Vincenty
Hello, I'm wondering how to append a line from a file onto a list(easy part) provided that the line contains strings specific to a previous list I've already made(hard part). I have this right now, for line in satellite_dataread: if any(i in line for i in list2): line= line.

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 20:24:10 +, Tony van der Hoff writes: >On 12/12/15 17:54, Laura Creighton wrote: >> In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes: >>> On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff >>> wrote: Thanks, Laura, and others who hav

Re: codecs.StreamRecoder not doing what I expected.

2015-12-12 Thread Peter Otten
D'Arcy J.M. Cain wrote: > More Unicode bafflement. What I am trying to do is pretty simple I > think. I have a bunch of files that I am pretty sure are either utf-8 > or iso-8859-1. I try utf-8 and fall back to iso-8859-1 if it throws a > UnicodeError. Here is my test. > > #! /usr/pkg/bin/pyt

Re: tkinter: Switch between two grids

2015-12-12 Thread Terry Reedy
On 12/12/2015 1:24 PM, sms wrote: What I need: 1. Fullscreen application Not directly relevant to the below. 2. On the home screen: Three row 3. When I click on the main screen, it switches to one row only. Create homescreen Frame(master=root) or subclasses thereof. Pack the homescreen.

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 17:54, Laura Creighton wrote: In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes: On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff wrote: Thanks, Laura, and others who have replied. You're right; python-3-pygame exists in unstable, but has not yet made it to j

Re: 2to3 translation problem

2015-12-12 Thread Terry Reedy
On 12/12/2015 12:30 PM, Tony van der Hoff wrote: Thanks, Laura, and others who have replied. You're right; python-3-pygame exists in unstable, but has not yet made it to jessie, even in backports. So, I'll stick with python 2.7 for the time being; really no hardship :) pygame itself was porte

codecs.StreamRecoder not doing what I expected.

2015-12-12 Thread D'Arcy J.M. Cain
More Unicode bafflement. What I am trying to do is pretty simple I think. I have a bunch of files that I am pretty sure are either utf-8 or iso-8859-1. I try utf-8 and fall back to iso-8859-1 if it throws a UnicodeError. Here is my test. #! /usr/pkg/bin/python3.4 # Running on a NetBSD 7.0 serv

tkinter: Switch between two grids

2015-12-12 Thread sms
Hello all, I'm sorry to ask this question, but I am a very beginer. What I need: 1. Fullscreen application 2. On the home screen: Three row 3. When I click on the main screen, it switches to one row only. Actually, I am not able to switch from Window1 to Window2, Window2 comes under Window1

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes: >On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff wrote: >> Thanks, Laura, and others who have replied. You're right; python-3-pygame >> exists in unstable, but has not yet made it to jessie, even in backports. >> >> So, I'l

Re: 2to3 translation problem

2015-12-12 Thread Chris Angelico
On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff wrote: > Thanks, Laura, and others who have replied. You're right; python-3-pygame > exists in unstable, but has not yet made it to jessie, even in backports. > > So, I'll stick with python 2.7 for the time being; really no hardship :) The easies

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread mkatietola
Thank you so much Steven you've given me a really great head start -- https://mail.python.org/mailman/listinfo/python-list

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 17:09, Laura Creighton wrote: In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes: Tony van der Hoff wrote: On 12/12/15 15:09, Mark Lawrence wrote: On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using py

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes: >Tony van der Hoff wrote: > >> On 12/12/15 15:09, Mark Lawrence wrote: >>> On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that w

Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 16:31:54 +, Tony van der Hoff writes: >On 12/12/15 15:09, Mark Lawrence wrote: >> On 12/12/2015 14:42, Tony van der Hoff wrote: >>> Debian Jessie, python 2.7; python 3.4 >>> >>> I have an application, using pygame for graphics, that works fine under >>> python2.

Re: 2to3 translation problem

2015-12-12 Thread Peter Otten
Tony van der Hoff wrote: > On 12/12/15 15:09, Mark Lawrence wrote: >> On 12/12/2015 14:42, Tony van der Hoff wrote: >>> Debian Jessie, python 2.7; python 3.4 >>> >>> I have an application, using pygame for graphics, that works fine under >>> python2.7. I have run it through 2to3, but when running

Re: 2to3 translation problem

2015-12-12 Thread Mark Lawrence
On 12/12/2015 16:31, Tony van der Hoff wrote: On 12/12/15 15:09, Mark Lawrence wrote: On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when runn

Re: 2to3 translation problem

2015-12-12 Thread Tony van der Hoff
On 12/12/15 15:09, Mark Lawrence wrote: On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when running the result under python 3.4, I get the erro

Re: 2to3 translation problem

2015-12-12 Thread Mark Lawrence
On 12/12/2015 14:42, Tony van der Hoff wrote: Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when running the result under python 3.4, I get the error : Traceback (most recent call last):

2to3 translation problem

2015-12-12 Thread Tony van der Hoff
Debian Jessie, python 2.7; python 3.4 I have an application, using pygame for graphics, that works fine under python2.7. I have run it through 2to3, but when running the result under python 3.4, I get the error : Traceback (most recent call last): File "ppm304.py", line 9, in import py

Re: python unit test frame work

2015-12-12 Thread Peter Otten
Ganesh Pal wrote: > On Thu, Dec 10, 2015 at 9:20 PM, Peter Otten <__pete...@web.de> wrote: >> Ganesh Pal wrote: >> > >> I recommend that you reread the unittest documentation. >> >> setUpClass() should be a class method, and if it succeeds you can release >> the ressources it required in the corr

XMPP pub sub setup and working

2015-12-12 Thread satish
I am using xmpppy python library to connect with XMPP server(ejabberd2) but unable to connect and actually don't have clarity on how to connect, authenticate and send a message to the server. Please help me to make it working If possible please provide some code snippet using XMPPPY. This

Re: python unit test frame work

2015-12-12 Thread Ganesh Pal
On Thu, Dec 10, 2015 at 9:20 PM, Peter Otten <__pete...@web.de> wrote: > Ganesh Pal wrote: > > I recommend that you reread the unittest documentation. > > setUpClass() should be a class method, and if it succeeds you can release > the ressources it required in the corresponding tearDownClass() met

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Steven D'Aprano
On Sat, 12 Dec 2015 08:05 pm, Harbey Leke wrote: > Create a class called BankAccount class BankAccount: pass That's easy. Unfortunately, that class does nothing, but at least it exists! Now all you have to do is create *methods* of the class that do the work. Here I give it a method calle

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Chris Warrick
On 12 December 2015 at 11:29, Harbey Leke wrote: > oh oh okay start it for me please > thanks or guide me about it then. > -- > https://mail.python.org/mailman/listinfo/python-list class BankAccount(object): # your code goes here Seriously: read the materials you got with your course, or the

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Harbey Leke
oh oh okay start it for me please thanks or guide me about it then. -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Harbey Leke
oh oh okay start it for me please thanks or guide me about it then. -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Chris Angelico
On Sat, Dec 12, 2015 at 9:09 PM, Harbey Leke wrote: > i need help with every part of the project, like a complete text of scripts > for it, thrn i can practise with it on my own and then u can give me > assignments to improve on > thanks No. You're the one taking the course; you write the code

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Harbey Leke
i need help with every part of the project, like a complete text of scripts for it, thrn i can practise with it on my own and then u can give me assignments to improve on thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Chris Angelico
On Sat, Dec 12, 2015 at 8:05 PM, Harbey Leke wrote: > Create a class called BankAccount > > .Create a constructor that takes in an integer and assigns this to a > `balance` property. > > .Create a method called `deposit` that takes in cash deposit amount and > updates the balance accordingly. >

Need help on a project To :"Create a class called BankAccount with the following parameters "

2015-12-12 Thread Harbey Leke
Create a class called BankAccount .Create a constructor that takes in an integer and assigns this to a `balance` property. .Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly. .Create a method called `withdraw` that takes in cash withdrawal a