RE: Python application launcher (for Python code)

2017-02-23 Thread Deborah Swanson
Gregory Ewing wrote, on February 23, 2017 9:13 PM > > Deborah Swanson wrote: > > As for it phoning home... Wonder what value they think this has, other > > than giving them a nosecount of how many active copies there are at > > any given time. > > It gives them a kill switch. If they decide the

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Gregory Ewing wrote, on February 23, 2017 9:07 PM > > Deborah Swanson wrote: > > I've run into this kind of problem with namedtuples before, > trying to > > access field values with variable names, like: > > > > label = 'Location' > > records.label > > If you need to access an attribute whose

Re: Python application launcher (for Python code)

2017-02-23 Thread Gregory Ewing
Deborah Swanson wrote: As for it phoning home... Wonder what value they think this has, other than giving them a nosecount of how many active copies there are at any given time. It gives them a kill switch. If they decide they don't want it to be free any more, they can stop us from using it.

Re: Namedtuples problem

2017-02-23 Thread Gregory Ewing
Deborah Swanson wrote: I've run into this kind of problem with namedtuples before, trying to access field values with variable names, like: label = 'Location' records.label If you need to access an attribute whose name is computed at run time, you want getattr() and setattr(): value = geta

Re: Disallowing instantiation of super class

2017-02-23 Thread Irv Kalb
> On Feb 23, 2017, at 4:40 PM, MRAB wrote: > > On 2017-02-24 00:19, Irv Kalb wrote: >> Hi, >> >> I have built a set of three classes: >> >> - A super class, let's call it: Base >> >> - A class that inherits from Base, let's call that: ClassA >> >> - Another class that inherits from Base,

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Erik wrote, on February 23, 2017 4:03 PM > > On 23/02/17 23:00, Deborah Swanson wrote: > >> It looks to me like you are indexing into a single-element > list that > >> you are creating using the literal list syntax in the middle of > >> the expression. > > > > Actually, group is essentially a 2-

RE: Python application launcher (for Python code)

2017-02-23 Thread Deborah Swanson
Michael Torrie wrote, on February 23, 2017 7:43 AM > > On 2017-02-22 09:49 PM, Deborah Swanson wrote: > > Didn't even look. Visual Studio has always been pricey, and it never > > occurred to me that they might have a free or cheap version now. > > You can get the full edition of Visual Studio, c

RE: Python application launcher (for Python code)

2017-02-23 Thread Deborah Swanson
Cholo Lennon wrote, on February 23, 2017 7:58 AM > > On 02/20/2017 07:56 PM, Deborah Swanson wrote: > > Basically, I now have quite a few Python programs I use frequently, > > and as time goes on my collection and uses of it will grow. > Right now > > I just want a way to select which one I'd l

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Irv Kalb wrote, on February 23, 2017 3:51 PM > > > On Feb 23, 2017, at 3:00 PM, Deborah Swanson > > > wrote: > > > > The weirdness is that > > > > group[0][4] > > > > gets the right answer, but > > > > group[[idx][records_idx[label]]], > > where idx = 0 and

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Ben Bacarisse wrote, on February 23, 2017 4:24 PM > > "Deborah Swanson" writes: > > >> -Original Message- > >> From: Erik [mailto:pyt...@lucidity.plus.com] > >> Sent: Thursday, February 23, 2017 2:09 AM > >> To: pyt...@deborahswanson.net; python-list@python.org > >> Subject: Re: Namedtup

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
MRAB wrote, on Thursday, February 23, 2017 4:06 PM > > On 2017-02-23 23:00, Deborah Swanson wrote: > > > > > >> -Original Message- > >> From: Erik [mailto:pyt...@lucidity.plus.com] > >> Sent: Thursday, February 23, 2017 2:09 AM > >> To: pyt...@deborahswanson.net; python-list@python.org > >

Re: Disallowing instantiation of super class

2017-02-23 Thread Peter Otten
Irv Kalb wrote: > Hi, > > I have built a set of three classes: > > - A super class, let's call it: Base > > - A class that inherits from Base, let's call that: ClassA > > - Another class that inherits from Base, let's call that: ClassB > > ClassA and ClassB have some code in their __init__

Re: Disallowing instantiation of super class

2017-02-23 Thread MRAB
On 2017-02-24 00:19, Irv Kalb wrote: Hi, I have built a set of three classes: - A super class, let's call it: Base - A class that inherits from Base, let's call that: ClassA - Another class that inherits from Base, let's call that: ClassB ClassA and ClassB have some code in their __init__

Re: Namedtuples problem

2017-02-23 Thread Irv Kalb
> On Feb 23, 2017, at 3:00 PM, Deborah Swanson > wrote: > > The weirdness is that > > group[0][4] > > gets the right answer, but > > group[[idx][records_idx[label]]], > where idx = 0 and records_idx[label]] = 4 If that's the case, then I think you need t

Spyder 3.1.3 update

2017-02-23 Thread Pablo Lozano
Good day, I installed the Spyder 3.6 IDE from the Anaconda package and at the start k to the IDE I get the Spyder Update saying Spyder 3.1.3 is available. Did it incorrectly install Anaconda? As far as I know Spyder 3.1.3 is rather old and the latest is 3.6 Regards Pablo -- https://mail.p

Re: Namedtuples problem

2017-02-23 Thread Ben Bacarisse
"Deborah Swanson" writes: >> -Original Message- >> From: Erik [mailto:pyt...@lucidity.plus.com] >> Sent: Thursday, February 23, 2017 2:09 AM >> To: pyt...@deborahswanson.net; python-list@python.org >> Subject: Re: Namedtuples problem >> >> >> Hi, >> >> On 23/02/17 09:38, Deborah Swans

Disallowing instantiation of super class

2017-02-23 Thread Irv Kalb
Hi, I have built a set of three classes: - A super class, let's call it: Base - A class that inherits from Base, let's call that: ClassA - Another class that inherits from Base, let's call that: ClassB ClassA and ClassB have some code in their __init__ methods that set some instance variab

Re: Namedtuples problem

2017-02-23 Thread MRAB
On 2017-02-23 23:00, Deborah Swanson wrote: -Original Message- From: Erik [mailto:pyt...@lucidity.plus.com] Sent: Thursday, February 23, 2017 2:09 AM To: pyt...@deborahswanson.net; python-list@python.org Subject: Re: Namedtuples problem Hi, On 23/02/17 09:38, Deborah Swanson wrote:

Re: Namedtuples problem

2017-02-23 Thread Erik
On 23/02/17 23:00, Deborah Swanson wrote: It looks to me like you are indexing into a single-element list that you are creating using the literal list syntax in the middle of the expression. Actually, group is essentially a 2-element list. Each group has a list of rows, and each row has a set o

Re: Namedtuples problem

2017-02-23 Thread MRAB
On 2017-02-23 22:51, Deborah Swanson wrote: Peter Otten wrote, on February 23, 2017 2:34 AM [snip] #untested def split_into_groups(records, key): groups = defaultdict(list) for record in records: # no need to check if a group already exists # an empty list will automati

Re: How to create a Python 3.6 traceroute without SOCK RAW?

2017-02-23 Thread Irmen de Jong
On 24-2-2017 0:20, Juan C. wrote: > On Thu, Feb 23, 2017 at 7:42 PM, Irmen de Jong wrote: >> >> import os >> os.system("traceroute www.google.com") > > Indeed, that would work, but it isn't a great approach in my opinion > because I would rely on a system command, in this case Windows uses > trac

Re: How to create a Python 3.6 traceroute without SOCK RAW?

2017-02-23 Thread Juan C.
On Thu, Feb 23, 2017 at 7:42 PM, Irmen de Jong wrote: > > import os > os.system("traceroute www.google.com") Indeed, that would work, but it isn't a great approach in my opinion because I would rely on a system command, in this case Windows uses tracert while UNIX uses traceroute, one could fix t

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
> -Original Message- > From: Erik [mailto:pyt...@lucidity.plus.com] > Sent: Thursday, February 23, 2017 2:09 AM > To: pyt...@deborahswanson.net; python-list@python.org > Subject: Re: Namedtuples problem > > > Hi, > > On 23/02/17 09:38, Deborah Swanson wrote: > > group[[idx][records_id

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Peter Otten wrote, on February 23, 2017 2:34 AM > > Deborah Swanson wrote: > > > > Can anyone see why I'm getting this Index error? and how to fix it? > > I'm not completely sure I can follow you, but you seem to be > mixing two problems > > (1) split a list into groups > (2) convert a list o

Re: How to create a Python 3.6 traceroute without SOCK RAW?

2017-02-23 Thread Irmen de Jong
On 23-2-2017 22:33, Juan C. wrote: > I need to implement a traceroute inside my script but I can't escalate > privileges. Unix uses UDP for traceroute, but I didn't find any material > regarding UDP traceroute in Python. import os os.system("traceroute www.google.com") -- https://mail.python.

How to create a Python 3.6 traceroute without SOCK RAW?

2017-02-23 Thread Juan C.
I need to implement a traceroute inside my script but I can't escalate privileges.  Unix uses UDP for traceroute, but I didn't find any material regarding UDP traceroute in Python. -- https://mail.python.org/mailman/listinfo/python-list

Re: Metaclass to rewrite class __doc__?

2017-02-23 Thread Peter Otten
Skip Montanaro wrote: > I stumbled upon this use of a metaclass to modify function docstrings: > > http://www.jesshamrick.com/2013/04/17/rewriting-python-docstrings-with-a-metaclass/ > > In certain circumstances (mostly when extending some Pybind11 wrappers), > it might be nice to extend/modify

Metaclass to rewrite class __doc__?

2017-02-23 Thread Skip Montanaro
I stumbled upon this use of a metaclass to modify function docstrings: http://www.jesshamrick.com/2013/04/17/rewriting-python-docstrings-with-a-metaclass/ In certain circumstances (mostly when extending some Pybind11 wrappers), it might be nice to extend/modify a class's docstring in a similar ma

Re: concurrent futures, async futures and await

2017-02-23 Thread Ian Kelly
On Thu, Feb 23, 2017 at 9:44 AM, Nagy László Zsolt wrote: > >> My guess: because asyncio wouldn't know what to do with a >> concurrent.futures.Future. > I see that as a problem. >> >> The tornado docs say that "You can also use >> tornado.gen.convert_yielded to convert anything that would work wit

RE: Namedtuples problem

2017-02-23 Thread Deborah Swanson
Thanks all of you for replying. I'm going to have to study your responses a bit before I can respond. I wrote this code the way I did because I was getting errors that I stopped getting with these fixes and I got the correct results from this code, up until the last line. All of you introduced con

Re: concurrent futures, async futures and await

2017-02-23 Thread Nagy László Zsolt
> My guess: because asyncio wouldn't know what to do with a > concurrent.futures.Future. I see that as a problem. > > The tornado docs say that "You can also use > tornado.gen.convert_yielded to convert anything that would work with > yield into a form that will work with await": > http://www.torn

Re: Python application launcher (for Python code)

2017-02-23 Thread Cholo Lennon
On 02/20/2017 07:56 PM, Deborah Swanson wrote: Basically, I now have quite a few Python programs I use frequently, and as time goes on my collection and uses of it will grow. Right now I just want a way to select which one I'd like to run and run it. I'd like it to be a standalone application and

Re: Python application launcher (for Python code)

2017-02-23 Thread Michael Torrie
On 2017-02-22 09:49 PM, Deborah Swanson wrote: Didn't even look. Visual Studio has always been pricey, and it never occurred to me that they might have a free or cheap version now. You can get the full edition of Visual Studio, called Visual Studio Community Edition for free. They still offer

Re: Python application launcher (for Python code)

2017-02-23 Thread Cholo Lennon
On 02/21/2017 10:52 AM, BartC wrote: The only problem I found, when launching in GUI mode, was that a console-mode Python program would briefly open a console window that would then promptly disappear if it finished immediately and there was no interaction. If you want to avoid a console just

Re: Namedtuples problem

2017-02-23 Thread Peter Otten
Pavol Lisy wrote: > If we are talking about less code than necessary then probably we > could use something from python's ecosystem... > import pandas as pd # really useful package Yes, pandas looks like the perfect fit here. There is a learning curve, though, so that it will probably pay

Re: Namedtuples problem

2017-02-23 Thread Pavol Lisy
On 2/23/17, Peter Otten <__pete...@web.de> wrote: > Peter Otten wrote: > >> Functions to the rescue: > > On second thought this was still more code than necessary. If we are talking about less code than necessary then probably we could use something from python's ecosystem... >>> import pandas as

Re: Namedtuples problem

2017-02-23 Thread Steve D'Aprano
On Thu, 23 Feb 2017 08:38 pm, Deborah Swanson wrote: > However, > > group[[idx][records_idx[label]]] > gets an Index Error: list index out of range That's not very helpful: judging from that line alone, there could be as many as THREE places in that line of code that might generate IndexError.

Re: end=

2017-02-23 Thread Chris Angelico
On Fri, Feb 24, 2017 at 12:23 AM, wrote: > Using python at home as oppose to using it at school and getting a syntax > error for the line end= but this has worked previously at school. I think the > version I've got at home is newer than the one at school - should this affect > it? > Yes, it

end=

2017-02-23 Thread peterreavey32
Using python at home as oppose to using it at school and getting a syntax error for the line end= but this has worked previously at school. I think the version I've got at home is newer than the one at school - should this affect it? -- https://mail.python.org/mailman/listinfo/python-list

Re: any one used moviepy please come in!!! I need help, thanks!

2017-02-23 Thread Billy Earney
imagemagick (ie, convert) has a policy.xml file that stops you from accessing any resource that starts with '@'. type 'identify -list policy' the first line should tell you where your policy.xml file is located. My policy.xml file is lcoated at /etc/ImageMagick-6/policy.xml open that file, and g

Re: [Glitch?] Python has just stopped working

2017-02-23 Thread eryk sun
On Thu, Feb 23, 2017 at 8:14 AM, wrote: > W dniu wtorek, 16 lutego 2016 21:09:50 UTC+1 użytkownik Theo Hamilton napisał: >> I woke up two days ago to find out that python literally won't work any >> more. I have looked everywhere, asked multiple Stack Overflow questions, >> and am ready to give u

Re: Namedtuples problem

2017-02-23 Thread Peter Otten
Peter Otten wrote: > Functions to the rescue: On second thought this was still more code than necessary. Why not calculate a column on demand? Here's a self-containe example: $ cat swanson_grouped_columns_virtual.py import operator from collections import defaultdict, namedtuple def split_into_

Re: Namedtuples problem

2017-02-23 Thread Peter Otten
Deborah Swanson wrote: > This is how the list of namedtuples is originally created from a csv: > > infile = open("E:\\Coding projects\\Pycharm\\Moving\\Moving 2017 in - > test.csv") > rows = csv.reader(infile)fieldnames = next(rows) > Record = namedtuple("Record", fieldnames) > records = [Record.

Re: Namedtuples problem

2017-02-23 Thread Erik
Hi, On 23/02/17 09:38, Deborah Swanson wrote: group[[idx][records_idx[label]]] gets an Index Error: list index out of range [snip] Can anyone see why I'm getting this Index error? and how to fix it? It looks to me like you are indexing into a single-element list that you are creating usin

Namedtuples problem

2017-02-23 Thread Deborah Swanson
This is how the list of namedtuples is originally created from a csv: infile = open("E:\\Coding projects\\Pycharm\\Moving\\Moving 2017 in - test.csv") rows = csv.reader(infile)fieldnames = next(rows) Record = namedtuple("Record", fieldnames) records = [Record._make(fieldnames)] records.extend(R

Re: [Glitch?] Python has just stopped working

2017-02-23 Thread tomasz . wisniewski . gm
W dniu wtorek, 16 lutego 2016 21:09:50 UTC+1 użytkownik Theo Hamilton napisał: > I woke up two days ago to find out that python literally won't work any > more. I have looked everywhere, asked multiple Stack Overflow questions, > and am ready to give up. Whenever I run python (3.5), I get the follo