Re: OS X Menubar in Tkinter

2014-10-20 Thread Mark Lawrence
On 21/10/2014 02:34, Noble Bell wrote: Creating the app with py2app fixed my problem. I'm pleased to see that you have an answer. In return would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/Googl

Re: Flush stdin

2014-10-20 Thread Marko Rauhamaa
Dan Stromberg : > Often with TCP protocols, line buffered is preferred to character > buffered, Terminal devices support line buffering on write. Line buffering on read is an illusion created by higher-level libraries. The low-level read function reads in blocks of bytes. > Also, it's a straigh

Re: Py2App - Could not import Tkinter error from resulting app

2014-10-20 Thread Terry Reedy
On 10/20/2014 9:29 PM, Noble Bell wrote: I have just created a python 3.4 application and created the setup.py file and then created an app with py2app. When I ran the resulting application I get an error in the console telling me that it could not import tkinter. Any ideas on how to correct

Re: Sqlite3 help

2014-10-20 Thread Chuck
Thanks a bunch Sibylle! That seems like a better approach. -- https://mail.python.org/mailman/listinfo/python-list

Re: OS X Menubar in Tkinter

2014-10-20 Thread Noble Bell
On Monday, October 20, 2014 5:47:14 AM UTC-5, Noble Bell wrote: > On Sunday, October 19, 2014 7:49:34 PM UTC-5, Ned Deily wrote: > > > In article , > > > > > > Noble Bell wrote: > > > > > > > I am using Python 3.4 on Mac OS X and Tinter 8.5. Does anyone have any > > > code > > > > > >

Py2App - Could not import Tkinter error from resulting app

2014-10-20 Thread Noble Bell
I have just created a python 3.4 application and created the setup.py file and then created an app with py2app. When I ran the resulting application I get an error in the console telling me that it could not import tkinter. Any ideas on how to correct this? Did I do something wrong? -- https:/

Re: Flush stdin

2014-10-20 Thread Dan Stromberg
On Mon, Oct 20, 2014 at 4:18 PM, Marko Rauhamaa wrote: > Dan Stromberg : >> ...then everything acts line buffered, or perhaps even character >> buffered [...] >> >> That, or we're using two different versions of netcat (there are at >> least two available). > > Let's unconfuse the issue a bit. I'l

RE: Simple import in python 3 errors with complaint about bytes

2014-10-20 Thread Mike Boyle
Ah, yes.  Thanks to that clever import debug hack, and the suggestion that it would actually be an import within the module causing the trouble, I managed to track it down.  I had tried copying some py3k changes from the "rational" module in numpy/numpy-dtypes, but evidently didn't do it right,

Re: Building lists

2014-10-20 Thread Seymore4Head
On Tue, 21 Oct 2014 10:55:08 +1100, Steven D'Aprano wrote: >Seymore4Head wrote: > >> For starters I would like to know if you can make a single item list >> and then turn it into a 2 item list. Is there a command for that? >> >> Do you have to know the number of items the list will have before

Re: Building lists

2014-10-20 Thread Steven D'Aprano
Seymore4Head wrote: > For starters I would like to know if you can make a single item list > and then turn it into a 2 item list. Is there a command for that? > > Do you have to know the number of items the list will have before > making it? Now these are the right sort of questions that you sh

Re: Simple import in python 3 errors with complaint about bytes

2014-10-20 Thread Chris Angelico
On Tue, Oct 21, 2014 at 10:29 AM, Mike Boyle wrote: > But when it hits that line, python 3 throws its hands up in disgust: > >> python -c 'import quaternion' Just something crazy to try: Instead of using python -c, create an actual script with just that one line in it. It might be that you have s

Re: Simple import in python 3 errors with complaint about bytes

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 5:29 PM, Mike Boyle wrote: > I'm modifying an extension written with the c-api to have a datatype of > quaternions , with one of the > goals being python 3 support. It works nicely in python 2.7, but for python > 3.x gives an e

Re: Simple import in python 3 errors with complaint about bytes

2014-10-20 Thread Chris Kaynor
Are you perhaps doing an import inside of the C code? Chris On Mon, Oct 20, 2014 at 4:29 PM, Mike Boyle wrote: > I'm modifying an extension written with the c-api to have a datatype of > quaternions , with one of the > goals being python 3 support. It

Simple import in python 3 errors with complaint about bytes

2014-10-20 Thread Mike Boyle
I'm modifying an extension written with the c-api to have a datatype of quaternions , with one of the goals being python 3 support.  It works nicely in python 2.7, but for python 3.x gives an error that I can't find anywhere on the google.  The director

Re: Flush stdin

2014-10-20 Thread Marko Rauhamaa
Dan Stromberg : > ...then everything acts line buffered, or perhaps even character > buffered [...] > > That, or we're using two different versions of netcat (there are at > least two available). Let's unconfuse the issue a bit. I'll take line buffering, netcat and the OS out of the picture. He

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. T

Re: Flush stdin

2014-10-20 Thread Marko Rauhamaa
Dan Stromberg : > On Sun, Oct 19, 2014 at 9:45 PM, Marko Rauhamaa wrote: >> I found this comment in CPython's source code (pythonrun.c): >> >> /* stdin is always opened in buffered mode, first because it shouldn't >>make a difference in common use cases, second because TextIOWrapper >

Re: Flush stdin

2014-10-20 Thread Dan Stromberg
If I run the following in one tty: nc -l localhost 9000 | /tmp/z ...where /tmp/z has just: #!/usr/bin/python3 import sys for line in sys.stdin.buffer: print(line) And then run the following in another tty on the same computer: while read line; do echo $line; sleep 1;

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 22:40:50 + (UTC), Denis McMahon wrote: >On Mon, 20 Oct 2014 15:49:15 -0400, Seymore4Head wrote: > >> For starters I would like to know if you can make a single item list and >> then turn it into a 2 item list. Is there a command for that? > >Yes, it's called assignment. Y

Re: Building lists

2014-10-20 Thread Denis McMahon
On Mon, 20 Oct 2014 15:49:15 -0400, Seymore4Head wrote: > For starters I would like to know if you can make a single item list and > then turn it into a 2 item list. Is there a command for that? Yes, it's called assignment. You can for example change a member of a list from an string to a tuple

Re: Building lists

2014-10-20 Thread Denis McMahon
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. That > means it would be a list of dicts

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

2014-10-20 Thread Juan Christian
Sorry guys, my post about SQL was not meant to be here!!! On Mon, Oct 20, 2014 at 5:43 PM, MRAB wrote: > 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 T

Re: Building lists

2014-10-20 Thread Seymore4Head
On Tue, 21 Oct 2014 10:54:55 +1300, Gregory Ewing wrote: >Seymore4Head wrote: >> Say I want a >> Grocery list and it will have a maximum size of 50 items. > >In Python it's actually easier to deal with variable-sized >lists having no maximum size. Instead of pre-creating a list >of a given size,

Re: Flush stdin

2014-10-20 Thread Dan Stromberg
On Sun, Oct 19, 2014 at 9:45 PM, Marko Rauhamaa wrote: > I found this comment in CPython's source code (pythonrun.c): > > /* stdin is always opened in buffered mode, first because it shouldn't >make a difference in common use cases, second because TextIOWrapper >depends on the

Re: Building lists

2014-10-20 Thread Gregory Ewing
Seymore4Head wrote: Say I want a Grocery list and it will have a maximum size of 50 items. In Python it's actually easier to deal with variable-sized lists having no maximum size. Instead of pre-creating a list of a given size, just start with an empty list and append things to it. Unless ther

Re: Building lists

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 3:25 PM, Seymore4Head wrote: > I think what I am going to have to have is a master list that keeps > track of several things and I will need to change some of them so I > know that rules out tuples. It sounds to me like what you really want is a list of class instances. De

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 20:48:54 + (UTC), John Gordon wrote: >In Seymore4Head > writes: > >> Will Python work like this: > >Python is a capable general-purpose language, so yes, it can pretty >much do anything you want. The trick is knowing how to do it. > >> Make a list of 0-50. >> Then can I

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 14:45:19 -0600, Ian Kelly wrote: >On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head > wrote: >> On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly >> wrote: >> >>>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head >>> wrote: For starters I would like to know if you can make a single i

Re: Building lists

2014-10-20 Thread Mark Lawrence
On 20/10/2014 21:23, Seymore4Head wrote: On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly wrote: On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head wrote: For starters I would like to know if you can make a single item list and then turn it into a 2 item list. Is there a command for that? You mea

Re: Building lists

2014-10-20 Thread John Gordon
In Seymore4Head writes: > Will Python work like this: Python is a capable general-purpose language, so yes, it can pretty much do anything you want. The trick is knowing how to do it. > Make a list of 0-50. > Then can I add to that list so the second item will hold something > like cheese, e

Re: Building lists

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head wrote: > On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly > wrote: > >>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head >> wrote: >>> For starters I would like to know if you can make a single item list >>> and then turn it into a 2 item list. Is there a c

Women's Rights in Islam

2014-10-20 Thread BV BV
Women's Rights in Islam Islam is the sole religion that gave women her rights, these are so many and recorded in the Quran verses and the traditional sayings of the prophet, these rights are condensed in points here as holy texts, if all written, will take many pages. Equality between man and

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 20:57:52 +0100, Mark Lawrence wrote: >On 20/10/2014 20:49, Seymore4Head wrote: >> On Mon, 20 Oct 2014 20:40:18 +0100, MRAB >> wrote: >> >>> 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 apprec

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly wrote: >On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head > wrote: >> For starters I would like to know if you can make a single item list >> and then turn it into a 2 item list. Is there a command for that? > >You mean like this? > the_list = ['fir

Re: Building lists

2014-10-20 Thread Mark Lawrence
On 20/10/2014 20:49, Seymore4Head wrote: On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote: 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 a

Re: Building lists

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head wrote: > For starters I would like to know if you can make a single item list > and then turn it into a 2 item list. Is there a command for that? You mean like this? >>> the_list = ['first_item'] >>> the_list.append('second_item') >>> the_list ['fir

Re: Building lists

2014-10-20 Thread Mark Lawrence
On 20/10/2014 19:33, sohcahto...@gmail.com wrote: Oh shit! It's the magic word! I better get right on it! While you're at it would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython t

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 20:40:18 +0100, MRAB wrote: >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 >

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 insert

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

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 1:04 PM, Juan Christian wrote: > Ok, new code using ?: I suspect you meant to post this to some other thread. > def get_db(_id): > cursor = db.execute("SELECT ID, URL, AUTHOR, MESSAGE FROM TOPICS WHERE ID = > ?", (_id)) > return cursor.fetchone() (_id) is not a tuple; it

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 wan

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

2014-10-20 Thread Juan Christian
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 insert_db(_id, url, auth

Re: Building lists

2014-10-20 Thread sohcahtoa82
On Monday, October 20, 2014 11:23:36 AM UTC-7, Seymore4Head wrote: > On Mon, 20 Oct 2014 11:18:26 -0700 (PDT), sohcahtoa82 wrote: > > > > >On Monday, October 20, 2014 11:13:17 AM UTC-7, Seymore4Head wrote: > > >> I haven't had a lot of practice doing this. If anyone knows of a site > > >> >

Re: Building lists

2014-10-20 Thread Seymore4Head
On Mon, 20 Oct 2014 11:18:26 -0700 (PDT), sohcahto...@gmail.com wrote: >On Monday, October 20, 2014 11:13:17 AM UTC-7, 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

Re: Building lists

2014-10-20 Thread sohcahtoa82
On Monday, October 20, 2014 11:13:17 AM UTC-7, 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

Building lists

2014-10-20 Thread Seymore4Head
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 want to do this with one list. Make a list of

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

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 11:54 AM, Ian Kelly wrote: > On Mon, Oct 20, 2014 at 9:54 AM, Simon Kennedy wrote: >> Not having ever attempted to go beyond even the basics of Perl, the aspect >> that causes me to refer to Perl 'dismissively' as well comment in this >> thread, is that I don't find Perl

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

2014-10-20 Thread Ian Kelly
On Mon, Oct 20, 2014 at 9:54 AM, Simon Kennedy wrote: > Not having ever attempted to go beyond even the basics of Perl, the aspect > that causes me to refer to Perl 'dismissively' as well comment in this > thread, is that I don't find Perl to be an aesthetically pleasing language > and I consid

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

2014-10-20 Thread Simon Kennedy
On Saturday, 18 October 2014 11:53:16 UTC+1, Steven D'Aprano wrote: > I'm curious what aspect of idiomatic Perl code you are referring to. When > people talk about Perl code dismissively, I normally think of three things: > > - excessively long one-liners; > - excessive use of symbols and sigils

Re: Question about PANDAS

2014-10-20 Thread Johann Hibschman
giacomo boffi writes: > 2. choose ONE flavour of python, either 2.7.x or 3.4.x > - future is with 3.4, > - most exaples you'll find were written (are still written...) > for 2.7.x If you're interested in statistics (as comparisons to R suggest), I'd recommend anaconda. It comes w

formal program verification in python?

2014-10-20 Thread Rustom Mody
A colleague asked me if there were any formal program verification (or derivation) books which are python based. Sometimes known as 'Hoare/Dijkstra logic' I would be pleasantly surprised if there are! Still... In case anyone knows of any -- https://mail.python.org/mailman/listinfo/python-list

Re: OS X Menubar in Tkinter

2014-10-20 Thread Noble Bell
On Sunday, October 19, 2014 7:49:34 PM UTC-5, Ned Deily wrote: > In article , > > Noble Bell wrote: > > > I am using Python 3.4 on Mac OS X and Tinter 8.5. Does anyone have any code > > > that they would share with me on how to remove the "Python" menu in the > > > menubar at the top next t

Re: Question about PANDAS

2014-10-20 Thread giacomo boffi
Ryan Shuell writes: > Thanks guys.  I just feel frustrated that I can't do something useful. I had read many of your messages in the recent past, and I'm under the impression that your frustration has more to do with "Python the Infrastructure" rather than "Python the Language" my suggestions w

Re: Quick Question About Setting Up Pytz

2014-10-20 Thread Mark Lawrence
On 19/10/2014 21:18, Ryan Shuell wrote: Ok, thanks everyone. I just need to spend more time with this stuff. It's definitely slow going. Please don't top post on this list, thank you. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. M

Re: Question about PANDAS

2014-10-20 Thread Mark Lawrence
On 19/10/2014 20:57, Ryan Shuell wrote: Thanks guys. I just feel frustrated that I can't do something useful. I'm reading all about dictionaries, and types, and touples. Then I read about string manipulation and loops; two of my favorite things to do. Then I read about logic: -719 >= 833 False

Re: time.perf_counter in Python 2?

2014-10-20 Thread Peter Otten
Florian Lindner wrote: > Hello, > > I wrote a script that does some time measurements. It uses > time.perf_counter() from Python 3 which works very well. Now I need to > backport it to python 2. > > Docs say that time.clock() is way to go: > > time.clock() > On Unix, return the current processo

Re: time.perf_counter in Python 2?

2014-10-20 Thread Chris Angelico
On Mon, Oct 20, 2014 at 6:47 PM, Florian Lindner wrote: > time.clock() > On Unix, return the current processor time as a floating point number > expressed in seconds. The precision, and in fact the very definition of the > meaning of “processor time”, depends on that of the C function of the same

time.perf_counter in Python 2?

2014-10-20 Thread Florian Lindner
Hello, I wrote a script that does some time measurements. It uses time.perf_counter() from Python 3 which works very well. Now I need to backport it to python 2. Docs say that time.clock() is way to go: time.clock() On Unix, return the current processor time as a floating point number express

Re: Quick Question About Setting Up Pytz

2014-10-20 Thread Ryan Shuell
Ok, thanks everyone. I just need to spend more time with this stuff. It's definitely slow going. On Sat, Oct 18, 2014 at 11:16 PM, Rustom Mody wrote: > On Sunday, October 19, 2014 8:25:53 AM UTC+5:30, Ben Finney wrote: > > Chris Angelico writes: > > > > Try learning Python itself, rather than

Re: Question about PANDAS

2014-10-20 Thread Ryan Shuell
Thanks guys. I just feel frustrated that I can't do something useful. I'm reading all about dictionaries, and types, and touples. Then I read about string manipulation and loops; two of my favorite things to do. Then I read about logic: -719 >= 833 False That's great, but it's just not very use