Re: Python Gotcha's?

2012-04-15 Thread Bryan
Steven D'Aprano wrote: > And how is that different from any other two versions of Python? Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever *intentionally backwards incompatible* Python release. --GVR > Unless both versions include the same libraries (either standard modules >

Re: sort by column a csv file case insensitive

2012-04-15 Thread Peter Otten
Lee Chaplin wrote: > Hi all, > > I am trying to sort, in place, by column, a csv file AND sort it case > insensitive. > I was trying something like this, with no success: > > import csv > import operator > > def sortcsvbyfield(csvfilename, columnnumber): > with open(csvfilename, 'rb') as f: >

Re: Python Gotcha's?

2012-04-15 Thread Paul Rubin
Steven D'Aprano writes: >> Running both Python 2 and Python 3 on Windows is painful where it >> doesn't need to be. > And how is that different from any other two versions of Python? 1. The backwards incompatibility between 2 and 3 is much more serious than between 2.x and 2.(x-1). 2. There is

Re: Python Gotcha's?

2012-04-15 Thread alex23
On Apr 16, 3:34 pm, Steven D'Aprano wrote: > The situation is worse on Windows, as Windows doesn't support hash-bang > syntax. But that is being looked at now: > > http://www.python.org/dev/peps/pep-0397/ > > which should make supporting multiple Python versions much more pleasant > Real Soon Now.

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread alex23
On Apr 16, 2:30 pm, vmars316 wrote: > windows7, portablePython3.2: Is there a reason why you're using Portable Python over the standard install? > What if i wanted to send myProg.py to a friend to RUN (who has python > installed). > Isn't there a way just to doubleClick on myProg.py, to get it i

Re: Python Gotcha's?

2012-04-15 Thread Steven D'Aprano
On Sun, 15 Apr 2012 13:01:54 -0700, Bryan wrote: > Steven wrote: >> Yes, but I have reasons for disagreeing, which you trimmed out of your >> response. If you have reasons for thinking that a separate file >> extension for Python 3 is a good idea, you are keeping it to yourself. > > On Windows th

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Steven D'Aprano
On Sun, 15 Apr 2012 21:30:48 -0700, vmars316 wrote: > Greetings, > windows7, portablePython3.2: > What if i wanted to send myProg.py to a friend to RUN (who has python > installed). If your friend has Python installed, then double-clicking the .py file should work fine. > Isn't there a way ju

Re: sort by column a csv file case insensitive

2012-04-15 Thread Dave Angel
On 04/16/2012 01:11 AM, Lee Chaplin wrote: > Hi all, > > I am trying to sort, in place, by column, a csv file AND sort it case > insensitive. > I was trying something like this, with no success: Could you perhaps qualify that "no success" bit? Do you mean it didn't output a file, or that the file

sort by column a csv file case insensitive

2012-04-15 Thread Lee Chaplin
Hi all, I am trying to sort, in place, by column, a csv file AND sort it case insensitive. I was trying something like this, with no success: import csv import operator def sortcsvbyfield(csvfilename, columnnumber): with open(csvfilename, 'rb') as f: readit = csv.reader(f) thedata = li

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Dave Angel
On 04/16/2012 12:30 AM, vmars316 wrote: > Greetings, > windows7, portablePython3.2: > What if i wanted to send myProg.py to a friend to RUN (who has python > installed). > Isn't there a way just to doubleClick on myProg.py, to get it into the > interpret/RUN? > Could i RUN a myProg.o ? > There must

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Andrew Berg
On 4/15/2012 11:30 PM, vmars316 wrote: > Isn't there a way just to doubleClick on myProg.py, to get it into the > interpret/RUN? Use the standard installer from python.org if you want to do things with the registry. The standard installer sets up the registry for you so that the interpreter will be

How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread vmars316
Greetings, windows7, portablePython3.2: What if i wanted to send myProg.py to a friend to RUN (who has python installed). Isn't there a way just to doubleClick on myProg.py, to get it into the interpret/RUN? Could i RUN a myProg.o ? There must be a way to initiate the RUNning of a myProg.py without

Re: escaping

2012-04-15 Thread Steven D'Aprano
On Sun, 15 Apr 2012 23:07:36 +0200, Kiuhnm wrote: > This is the behavior I need: > path = path.replace('\\', '') > msg = ". {} .. '{}' .. {} .".format(a, path, b) > Is there a better way? This works for me: >>> a = "spam" >>> b = "ham" >>> path = r"C:\a\b\c\d\e.txt" >>> msg = ". %

Re: Python Gotcha's?

2012-04-15 Thread Andrew Berg
On 4/15/2012 3:01 PM, Bryan wrote: > I'd like to encourage my users to check out > Python 3, but installing it on Windows will take over the '.py' > extension and break stuff that currently works. Have you tried telling your users to tell the installer not to do that? IIRC, it's a simple checkbox o

Re: f python?

2012-04-15 Thread Terry Reedy
On 4/15/2012 6:59 PM, Ian Kelly wrote: On Sun, Apr 15, 2012 at 4:49 PM, Terry Reedy wrote: On 4/15/2012 12:16 PM, Ian Kelly wrote: On Sat, Apr 14, 2012 at 8:57 PM, Shmuel Metz wrote: In<87aa2iz3l1@kuiper.lan.informatimago.com>, on 04/11/2012 at 05:32 PM, "Pascal J. Bourguignon"

Re: Python Gotcha's?

2012-04-15 Thread David Robinow
On Sun, Apr 15, 2012 at 4:01 PM, Bryan wrote: > On Windows the file extension determines what executable opens the > file. Running both Python 2 and Python 3 on Windows is painful where > it doesn't need to be. I'd like to encourage my users to check out > Python 3, but installing it on Windows wi

Re: Python Gotcha's?

2012-04-15 Thread Mark Lawrence
On 15/04/2012 21:01, Bryan wrote: Steven wrote: Yes, but I have reasons for disagreeing, which you trimmed out of your response. If you have reasons for thinking that a separate file extension for Python 3 is a good idea, you are keeping it to yourself. On Windows the file extension determines

Re: Python Gotcha's?

2012-04-15 Thread Terry Reedy
On 4/15/2012 4:01 PM, Bryan wrote: On Windows the file extension determines what executable opens the file. Running both Python 2 and Python 3 on Windows is painful where it doesn't need to be. I'd like to encourage my users to check out Python 3, but installing it on Windows will take over the

Re: f python?

2012-04-15 Thread Ian Kelly
On Sun, Apr 15, 2012 at 4:49 PM, Terry Reedy wrote: > On 4/15/2012 12:16 PM, Ian Kelly wrote: >> >> On Sat, Apr 14, 2012 at 8:57 PM, Shmuel  Metz >>  wrote: >>> >>> In<87aa2iz3l1@kuiper.lan.informatimago.com>, on 04/11/2012 >>>   at 05:32 PM, "Pascal J. Bourguignon"  said: >>> You're

Re: No such file or directory: 'c:\\windows\\temp\\test'

2012-04-15 Thread Terry Reedy
On 4/15/2012 5:13 AM, contro opinion wrote: >>> f=open(r'c:\windows\temp\test','r') >>> f=open('c:\\windows\\temp\\test','r') Your life will be much happier is you use forward slashes for filenames in Python programs. f = open('c:/windows/temp/test', 'r') You only need backslashes when

Re: f python?

2012-04-15 Thread Terry Reedy
On 4/15/2012 12:16 PM, Ian Kelly wrote: On Sat, Apr 14, 2012 at 8:57 PM, Shmuel Metz wrote: In<87aa2iz3l1@kuiper.lan.informatimago.com>, on 04/11/2012 at 05:32 PM, "Pascal J. Bourguignon" said: You're confused. C doesn't have arrays. Lisp has arrays. C only has vectors Neither C

Re: escaping

2012-04-15 Thread Terry Reedy
On 4/15/2012 5:07 PM, Kiuhnm wrote: This is the behavior I need: path = path.replace('\\', '') Is there a better way? For one-time use, and given that you cannot un-double with the r prefix, not that I know of. For using the substrings multiple times, name them. >>> s = r'abc\cd\ef' >>>

Re: Naming future objects and their methods

2012-04-15 Thread Cameron Simpson
On 15Apr2012 00:22, Stefan Schwarzer wrote: | I wrote a `Connection` class that can be found at [1]. A | `Connection` object has a method `put_bytes(data)` which | returns a "future" [2]. The data will be sent asynchronously | by a thread attached to the connection object. [...] | put_result =

Re: escaping

2012-04-15 Thread Steve Howell
On Apr 15, 2:07 pm, Kiuhnm wrote: > This is the behavior I need: >      path = path.replace('\\', '') >      msg = ". {} .. '{}' .. {} .".format(a, path, b) > Is there a better way? > A little more context would help. The quadruple-toothpick idiom predates Python. It's a little hard on the

escaping

2012-04-15 Thread Kiuhnm
This is the behavior I need: path = path.replace('\\', '') msg = ". {} .. '{}' .. {} .".format(a, path, b) Is there a better way? Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Gotcha's?

2012-04-15 Thread Bryan
Steven wrote: > Yes, but I have reasons for disagreeing, which you trimmed out of your > response. If you have reasons for thinking that a separate file extension > for Python 3 is a good idea, you are keeping it to yourself. On Windows the file extension determines what executable opens the file.

Re: Python Gotcha's?

2012-04-15 Thread Steven D'Aprano
On Sun, 15 Apr 2012 15:30:39 +, Curt wrote: > On 2012-04-15, Steven D'Aprano > wrote: >>> >>> We disagree. Not surprising in a "gotcha's" thread. >> >> Yes, but I have reasons for disagreeing, which you trimmed out of your >> response. If you have reasons for thinking that a separate file >>

Re: Naming future objects and their methods

2012-04-15 Thread Laurent Pointal
Stefan Schwarzer wrote: > Hello, > > I wrote a `Connection` class that can be found at [1]. A > `Connection` object has a method `put_bytes(data)` which > returns a "future" [2]. The data will be sent asynchronously > by a thread attached to the connection object. > > The future object returned

Re: Newbie python questions...

2012-04-15 Thread rusi
On Apr 14, 11:25 pm, vmars316 wrote: > win7HomePremium: > Greetings, > 1) > I installed portablePython(pP) here: > C:\Users\vmars\Python3 >  ?Does that look ok? A brief look at portable python's website indicates that its meant for running off usb sticks (ie without installation) If you are insta

Re: Newbie python questions...

2012-04-15 Thread rusi
On Apr 15, 7:47 am, Steven D'Aprano wrote: > On Sat, 14 Apr 2012 11:25:57 -0700, vmars316 wrote: > > win7HomePremium: > > Greetings, > > 1) > > I installed portablePython(pP) here: > > C:\Users\vmars\Python3 > >  ?Does that look ok? > > Sure, why not? > > > 2) > > I would like to try pyWin, but it

Re: f python?

2012-04-15 Thread Ian Kelly
On Sat, Apr 14, 2012 at 8:57 PM, Shmuel Metz wrote: > In <87aa2iz3l1@kuiper.lan.informatimago.com>, on 04/11/2012 >   at 05:32 PM, "Pascal J. Bourguignon" said: > >>You're confused. C doesn't have arrays.  Lisp has arrays. C only has >>vectors > > Neither C nor any other programming langua

Re: Writing Android application using GPS data with Python

2012-04-15 Thread Boris FELD
You can try appaccelerator, it seems to support python and you should be able to access geolocalisation (according to wikipedia: https://en.wikipedia.org/wiki/Appcelerator_Titanium) Le 15 avril 2012 16:44, Noam Peled a écrit : > I want to write an Android application using Python. I've found 2 o

Re: Python Gotcha's?

2012-04-15 Thread Curt
On 2012-04-15, Steven D'Aprano wrote: >> >> We disagree. Not surprising in a "gotcha's" thread. > > Yes, but I have reasons for disagreeing, which you trimmed out of your > response. If you have reasons for thinking that a separate file extension > for Python 3 is a good idea, you are keeping i

Re: Python Gotcha's?

2012-04-15 Thread Steven D'Aprano
On Sun, 15 Apr 2012 02:23:27 -0700, Bryan wrote: > Steven D'Aprano wrote: >> Bryan wrote: >> > Python 3(K) likes to use the same '.py' file extension as its >> > incompatible predecessors, >> >> And so it should. > > We disagree. Not surprising in a "gotcha's" thread. Yes, but I have reasons for

Writing Android application using GPS data with Python

2012-04-15 Thread Noam Peled
I want to write an Android application using Python. I've found 2 options for that: kivy and SL4A. In kivy, at least for now, I can't use the GPS data. Anyone knows if I can get the GPS data using SL4A with Python? As I understood, one can write commercial apps using kivy. On the other hand, wit

Re: Naming future objects and their methods

2012-04-15 Thread Michael Torrie
On 04/14/2012 04:22 PM, Stefan Schwarzer wrote: > However, I'm not comfortable with the combination of the > names of the future and its method. After all, not the > `put_result` was sent, but the data that was the argument in > the `put_bytes` call. Maybe `data_was_sent` is better than > `was_sent

Whither paramiko?

2012-04-15 Thread Bryan
Paramiko is a Python library for SSH (Secure Shell). Over about the last year, I've grown dependent upon it. Its home page is still easy to search up, but the links to its mailing list and repository don't work. Paramiko depends on PyCrypto, and not so long ago that dependency was the stated reaso

Re: f python?

2012-04-15 Thread Seymour J.
In <87aa2iz3l1@kuiper.lan.informatimago.com>, on 04/11/2012 at 05:32 PM, "Pascal J. Bourguignon" said: >You're confused. C doesn't have arrays. Lisp has arrays. C only has >vectors Neither C nor any other programming language has vectors ;-) >That C calls its vectors "array", or its byt

Re: Python Gotcha's?

2012-04-15 Thread Mark Lawrence
On 15/04/2012 10:23, Bryan wrote: My perspective is simply different from yours. I'm not the one who installs python on most of the boxes where I work or play. There's little consistency, so I love conventions that usually work. I'd like to advocate for Python 3, but the default install on Windo

Re: Naming future objects and their methods

2012-04-15 Thread Almar Klein
Hi Stefan, What do you think would be a "natural" way to name the > future returned by `put_bytes` and possibly the `was_sent` > method attached to it? Can you even come up with nice naming > rules for futures and their methods? :-) > I think the intended way to get notified when a future is done

Re: No such file or directory: 'c:\\windows\\temp\\test'

2012-04-15 Thread Chris Angelico
On Sun, Apr 15, 2012 at 7:13 PM, contro opinion wrote: > in my computer > C:\Python27>python > Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on > win > 32 > Type "help", "copyright", "credits" or "license" for more information. > 1. f=open(r'c:\windows\temp\test','

Re: File traversing

2012-04-15 Thread Chris Angelico
On Sun, Apr 15, 2012 at 7:15 PM, Nibin V M wrote: > res_own_file = open('/bah') > res_own_list = res_own_file.readline() > res_tot_list=[] > while res_own_list: >   res_own_list=res_own_list.strip() >   res_own_list=res_own_list.replace(' ', '') >   res_name=res_own_list.split(':') >   if res_name

Re: Python Gotcha's?

2012-04-15 Thread Chris Angelico
On Sun, Apr 15, 2012 at 7:23 PM, Bryan wrote: > Yes, that was just silly of me to write that. All I want is a new > general convention for the most-likely-to-work invocation that won't > break with the change: "#!/usr/bin/env python" for Python 2 versus, > for example, "#!/usr/bin/env python3". Of

Re: No such file or directory: 'c:\\windows\\temp\\test'

2012-04-15 Thread Almar Klein
> IOError: [Errno 2] No such file or directory: 'c:\\windows\\temp\\test.txt' > would you mind telling me what's wrong ? > I think the file that you try to open does not exists :) Please be more specific. What are you trying to achieve, and are you absolutely sure that such a file exist? Almar

Re: Python Gotcha's?

2012-04-15 Thread Bryan
Steven D'Aprano wrote: > Bryan wrote: > > Python 3(K) likes to use the same '.py' file extension as its > > incompatible predecessors, > > And so it should. We disagree. Not surprising in a "gotcha's" thread. > > and in some/many/most *nix implementations, > > it likes to install in the same plac

File traversing

2012-04-15 Thread Nibin V M
Hello, First of all..I am very new to python with no background in development area! :) Ok, here is my problem.I have opened a file and I need to check each line of that file. I have done it with a while loop. res_own_file = open('/bah') res_own_list = res_own_file.readline() res_tot_list=[]

No such file or directory: 'c:\\windows\\temp\\test'

2012-04-15 Thread contro opinion
in my computer C:\Python27>python Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. 1. >>> f=open(r'c:\windows\temp\test','r') Traceback (most recent call last): File "", line 1, in IOError:

Re: How to get a package pip installable?

2012-04-15 Thread Fayaz Yusuf Khan
nbvf...@gmail.com wrote: > (test)chris@amnesia:~$ pip install django-easydump > Downloading/unpacking django-easydump > Could not find any downloads that satisfy the requirement django-easydump > No distributions at all found for django-easydump > Storing complete log in /Users/chris/.pip/pip.log