Re: Using Python 2

2017-09-08 Thread Larry Martell
On Fri, Sep 8, 2017 at 8:42 AM, Marko Rauhamaa wrote: > Chris Angelico : >> But as others have said, upgrading to 3.4+ is not as hard as many >> people fear, and your code generally improves as a result > > That's somewhat irrelevant. Point is, Python 2 will quickly become a > pariah in many corpo

Python dress

2017-09-12 Thread Larry Martell
Not too many females here, but anyway: https://svahausa.com/collections/shop-by-interest-1/products/python-code-fit-flare-dress (And if any guys want to wear this, there's nothing wrong with that.) -- https://mail.python.org/mailman/listinfo/python-list

trace not working with rpy2

2017-09-13 Thread Larry Martell
When I invoke my script with trace it fails with: /usr/local/lib/python2.7/site-packages/rpy2/rinterface/__init__.py:186: RRuntimeWarning: Fatal error: unable to open the base package and the trace file has: __init__.py(1): __init__.py(19): from rpy2.robjects.robject import RObjectMixin, RObjec

rmtree message

2017-09-13 Thread Larry Martell
I have a script that creates a tmp dir, create a lot of files in it, and when done, does a rmtree on the dir. When it does that I get this message: shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory But no exception is thrown. How c

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
On Sun, Sep 17, 2017 at 9:34 AM, wrote: > Experienced Python programmers use the logging module for debugging, write > once, delete (maybe) never. I use pdb for debugging (but I also log a lot which helps with prod system when users report a problem). -- https://mail.python.org/mailman/listinf

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
On Sun, Sep 17, 2017 at 11:44 AM, Dennis Lee Bieber wrote: > The only pocket calculators I know of that have "integers" are those > with a "programmer's mode" -- ie; binary (displayed in > binary/octal/decimal/hex) but needing to be converted back to "normal" if > one wants to use them wit

Re: rmtree message

2017-09-17 Thread Larry Martell
On Wed, Sep 13, 2017 at 5:39 PM, Sean DiZazzo wrote: > On Wednesday, September 13, 2017 at 12:06:20 PM UTC-7, larry@gmail.com > wrote: >> I have a script that creates a tmp dir, create a lot of files in it, >> and when done, does a rmtree on the dir. When it does that I get this >> message: >

Re: Old Man Yells At Cloud

2017-09-19 Thread Larry Martell
On Mon, Sep 18, 2017 at 11:23 PM, Dan Sommers wrote: > How relevant is the "people use calculators to do arithmetic" argument > today? Okay, so I'm old and cynical, but I know [young] people who > don't (can't?) calculate a gratuity without an app or a web page. I use a calculator all the time -

Re: Old Man Yells At Cloud

2017-09-19 Thread Larry Martell
On Tue, Sep 19, 2017 at 10:30 AM, D'Arcy Cain wrote: > On 09/19/2017 06:46 AM, Larry Martell wrote: >> >> True story - the other day I was in a store and my total was $10.12. I > > > One time I was at a cash with three or four items which were taxable. The > cash

Re: Even Older Man Yells at Whippersnappers

2017-09-19 Thread Larry Martell
On Tue, Sep 19, 2017 at 1:38 PM, ROGER GRAYDON CHRISTMAN wrote: > I recall giving a quiz to my college students sometime back around > the late nineties which had a little bit of arithmetic involved in the answer. > It's been too long ago to still have the exact details, but I remember > a couple

Re: Even Older Man Yells at Whippersnappers

2017-09-19 Thread Larry Martell
On Tue, Sep 19, 2017 at 2:41 PM, Chris Angelico wrote: > On Wed, Sep 20, 2017 at 4:33 AM, Larry Martell > wrote: >> On Tue, Sep 19, 2017 at 1:38 PM, ROGER GRAYDON CHRISTMAN >> wrote: >>> I recall giving a quiz to my college students sometime back around >&g

Re: Even Older Man Yells At Whippersnappers

2017-09-19 Thread Larry Martell
On Tue, Sep 19, 2017 at 12:12 PM, Rhodri James wrote: > > Eh, my school never 'ad an electronics class, nor a computer neither. Made > programming a bit tricky; we 'ad to write programs on a form and send 'em > off to next county. None of this new-fangled VHDL neither, we 'ad to do our > simulat

Re: Even Older Man Yells At Whippersnappers

2017-09-20 Thread Larry Martell
On Wed, Sep 20, 2017 at 5:09 AM, Gregory Ewing wrote: > > Never mind that fake assembly rubbish, learn a real assembly > language! And hand-assemble it and toggle it into the front > panel switches like I did! 1979, I was working at Bausch and Lomb in Rochester NY. We had a 16 bit Data General No

Re: Beginners and experts (Batchelder blog post)

2017-09-27 Thread Larry Martell
On Wed, Sep 27, 2017 at 12:41 PM, leam hall wrote: > The question is, what should a person "know" when hiring out as a > programmer? What is 'know" and what should be "known"? Specifically with > Python. Fake it till you make it! -- https://mail.python.org/mailman/listinfo/python-list

Re: Beginners and experts (Batchelder blog post)

2017-09-28 Thread Larry Martell
On Thu, Sep 28, 2017 at 5:08 PM, Chris Angelico wrote: > Yep. Pick anyone on this list that you believe is an expert, and ask > him/her for a story of a long debug session that ended up finding a > tiny problem. I can pretty much guarantee that every expert programmer > will have multiple such exp

zlib OverflowError: 'size does not fit in an int'

2017-12-04 Thread Larry Martell
Trying to zip a large file is failing with OverflowError: 'size does not fit in an int'. Googling I found this: https://bugs.python.org/issue23306 and this: https://hg.python.org/cpython/rev/2192edcfea02 which seems to make me think this was fixed this was fixed on Jul 23 2016. I am running Ce

Re: zlib OverflowError: 'size does not fit in an int'

2017-12-04 Thread Larry Martell
On Mon, Dec 4, 2017 at 7:15 PM, Chris Angelico wrote: > On Tue, Dec 5, 2017 at 10:46 AM, Larry Martell > wrote: >> Trying to zip a large file is failing with OverflowError: 'size does >> not fit in an int'. Googling I found this: >> >> https://b

Re: zlib OverflowError: 'size does not fit in an int'

2017-12-04 Thread Larry Martell
On Mon, Dec 4, 2017 at 7:36 PM, Thomas Jollans wrote: > On 05/12/17 01:21, Larry Martell wrote: >> On Mon, Dec 4, 2017 at 7:15 PM, Chris Angelico wrote: >>> On Tue, Dec 5, 2017 at 10:46 AM, Larry Martell >>> wrote: >>>> Trying to zip a large file is

Re: SystemError: error return without exception set

2017-12-07 Thread Larry Martell
On Thu, Dec 7, 2017 at 10:36 AM, Natalie Leung wrote: > I am trying to use Python to communicate and send commands in MSC Marc. A > part of the code looks something like this: > > from py_mentat import* > > directory = '[specified the file path to my model]' > marcModel = '[name of my model]' > >

scipy

2017-12-08 Thread Larry Martell
Trying to install scipy on ubuntu-trusty-64 running Python 2.7.6. It's failing with: $ sudo pip install scipy Downloading/unpacking scipy Downloading scipy-1.0.0.tar.gz (15.2MB): 15.2MB downloaded Running setup.py (path:/tmp/pip_build_root/scipy/setup.py) egg_info for package scipy /usr/li

Re: scipy

2017-12-11 Thread Larry Martell
On Sat, Dec 9, 2017 at 11:43 AM, Thomas Jollans wrote: > > On 08/12/17 23:57, Larry Martell wrote: > > Trying to install scipy on ubuntu-trusty-64 running Python 2.7.6. > > I STRONGLY recommend moving to Python 3 if you can. The scientific > python ecosystem has had good sup

Re: Python Learning

2017-12-17 Thread Larry Martell
On Sun, Dec 17, 2017 at 4:18 PM, Chris Angelico wrote: > On Mon, Dec 18, 2017 at 6:51 AM, Bill wrote: >> The point is that it takes a certain amount of what is referred to as >> "mathematical maturity" (not mathematical knowledge) to digest a book >> concerning computer programming. > > Emphasis

Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 9:09 AM, Rhodri James wrote: > On 18/12/17 13:28, Marko Rauhamaa wrote: >> >> However, I have been doing quite a bit of hiring, quite successfully, I >> might add. I am not prejudiced one way or another. Your résumé doesn't >> count. Your education doesn't count. What you c

Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa wrote: > However, one great way to stand out is a portfolio of GitHub projects. > Several people have gotten an offer largely based on those (after they > aced the technical interviews). For example, we just hired someone who > had written a game in

Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 12:05 PM, Chris Angelico wrote: > On Tue, Dec 19, 2017 at 3:45 AM, Larry Martell > wrote: >> On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa wrote: >>> However, one great way to stand out is a portfolio of GitHub projects. >>> Sever

Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 4:05 PM, Rob Gaddi wrote: > On 12/18/2017 08:45 AM, Larry Martell wrote: >> >> On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa wrote: >>> >>> However, one great way to stand out is a portfolio of GitHub projects. >>> Several pe

Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 4:52 PM, Gene Heskett wrote: > On Monday 18 December 2017 16:05:10 Rob Gaddi wrote: > >> On 12/18/2017 08:45 AM, Larry Martell wrote: >> > On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa > wrote: >> >> However, one great way t

Re: Python Learning

2017-12-21 Thread Larry Martell
On Mon, Dec 18, 2017 at 3:22 PM, Marko Rauhamaa wrote: > > Larry Martell : > > > On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa wrote: > >> However, one great way to stand out is a portfolio of GitHub > >> projects. Several people have gotten an offer largel

Re: has sourceforge exposed the dirty little secret ?

2018-01-05 Thread Larry Martell
On Fri, Jan 5, 2018 at 11:27 AM, Kim of K. wrote: > > "Background > > We feel that the world still produces way too much software that is > frankly substandard. The reasons for this are pretty simple: software > producers do not pay enough attention [...]" > > > quote from http://texttest.sourcefo

Re: Simple graphic library for beginners

2018-01-10 Thread Larry Martell
On Wed, Jan 10, 2018 at 7:42 AM Jan Erik Moström wrote: > I'm looking for a really easy to use graphic library. The target users > are teachers who have never programmed before and is taking a first (and > possible last) programming course. > > I would like to have the ability to draw lines, circ

documentation on read.encode

2018-01-16 Thread Larry Martell
Looking for 2.7 docs on read.encode - googling did not turn up anything. Specifically, looking for the supported options for base64, and how to specify them, e.g. Base64.NO_WRAP -- https://mail.python.org/mailman/listinfo/python-list

Re: documentation on read.encode

2018-01-16 Thread Larry Martell
On Tue, Jan 16, 2018 at 12:00 PM, Larry Martell wrote: > Looking for 2.7 docs on read.encode - googling did not turn up anything. > > Specifically, looking for the supported options for base64, and how to > specify them, e.g. Base64.NO_WRAP So I just realized that encode() is not

Re: documentation on read.encode

2018-01-16 Thread Larry Martell
On Tue, Jan 16, 2018 at 2:35 PM, Gene Heskett wrote: > On Tuesday 16 January 2018 14:19:38 Larry Martell wrote: > >> On Tue, Jan 16, 2018 at 12:00 PM, Larry Martell > wrote: >> > Looking for 2.7 docs on read.encode - googling did not turn up >> > anything. >&g

Re: documentation on read.encode

2018-01-16 Thread Larry Martell
On Tue, Jan 16, 2018 at 3:17 PM, Ned Batchelder wrote: > On 1/16/18 2:19 PM, Larry Martell wrote: >> >> On Tue, Jan 16, 2018 at 12:00 PM, Larry Martell >> wrote: >>> >>> Looking for 2.7 docs on read.encode - googling did not turn up anything. >>

Re: documentation on read.encode

2018-01-17 Thread Larry Martell
On Tue, Jan 16, 2018 at 3:58 PM, MRAB wrote: > On 2018-01-16 19:52, Larry Martell wrote: >> >> On Tue, Jan 16, 2018 at 2:35 PM, Gene Heskett >> wrote: >>> >>> On Tuesday 16 January 2018 14:19:38 Larry Martell wrote: >>> >>>> On

Re: documentation on read.encode

2018-01-18 Thread Larry Martell
On Thu, Jan 18, 2018 at 12:47 AM, Steven D'Aprano wrote: > On Wed, 17 Jan 2018 16:54:37 -0500, Larry Martell wrote: > >> The code that was receiving the >> PNG was not reading and writing the file as binary. Strangely that >> worked on Linux but not on Windows. >

error from Popen only when run from cron

2018-01-27 Thread Larry Martell
I have a script that does this: subprocess.Popen(['service', 'some_service', 'status'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) When I run it from the command line it works fine. When I run it from cron I get: subprocess.Popen(['service', 'some_service', 'status'], stdout=subproces

Re: error from Popen only when run from cron

2018-01-27 Thread Larry Martell
On Sat, Jan 27, 2018 at 11:09 AM, Chris Angelico wrote: > On Sun, Jan 28, 2018 at 2:58 AM, Larry Martell > wrote: >> I have a script that does this: >> >> subprocess.Popen(['service', 'some_service', 'status'], >> stdout=subprocess.

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Larry Martell
On Sun, Jan 28, 2018 at 10:04 AM, Steven D'Aprano wrote: > I'm seeing this annoying practice more and more often. Even for trivial > pieces of text, a few lines, people post screenshots instead of copying > the code. > > Where has this meme come from? It seems to be one which inconveniences > *eve

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Larry Martell
On Thu, Feb 8, 2018 at 12:36 PM, Gilmeh Serda wrote: > On Sat, 03 Feb 2018 04:33:36 +1200, breamoreboy wrote: > >>> When trying to access comp.lang.idl-pvwave, a message is now displayed, >> stating that the group owner needs to remove the spam, and can then >> apply to Google in order to have acc

atws

2018-02-21 Thread Larry Martell
I want to use the atws package (https://atws.readthedocs.io/readme.html). I am using python 2.7.6 on ubuntu-trusty-64 3.13.0-87-generic. I get this error when importing the package: >>> import atws Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-pack

Re: atws

2018-02-22 Thread Larry Martell
On Thu, Feb 22, 2018 at 2:00 AM, Chris Angelico wrote: > On Thu, Feb 22, 2018 at 5:27 PM, Larry Martell > wrote: >> I want to use the atws package >> (https://atws.readthedocs.io/readme.html). I am using python 2.7.6 on >> ubuntu-trusty-64 3.13.0-87-generic. I get t

Re: atws

2018-02-22 Thread Larry Martell
On Thu, Feb 22, 2018 at 10:25 AM, Mark Lawrence wrote: > On 22/02/18 15:06, Larry Martell wrote: >> >> On Thu, Feb 22, 2018 at 2:00 AM, Chris Angelico wrote: >>> >>> On Thu, Feb 22, 2018 at 5:27 PM, Larry Martell >>> wrote: >>&g

Re: atws

2018-02-23 Thread Larry Martell
On Fri, Feb 23, 2018 at 2:01 AM, dieter wrote: > Larry Martell writes: >> ... >> I had 2.2.1. I updated requests to 2.18.4 and now when I import atws I get: >> >> No handlers could be found for logger "atws.connection" > > This is a warning (only), tel

Re: atws

2018-02-23 Thread Larry Martell
On Fri, Feb 23, 2018 at 8:34 AM, Chris Angelico wrote: > On Sat, Feb 24, 2018 at 12:08 AM, Larry Martell > wrote: >> On Fri, Feb 23, 2018 at 2:01 AM, dieter wrote: >>> Larry Martell writes: >>>> ... >>>> I had 2.2.1. I updated requests to 2.18.4 a

Re: help me ?

2018-02-27 Thread Larry Martell
On Tue, Feb 27, 2018 at 12:56 PM, Ian Kelly wrote: > On Tue, Feb 27, 2018 at 10:16 AM, Igor Korot wrote: >> Congratulations! >> You have an "A" for solving the problem and "F" for helping the guy cheat. >> You should be expelled from the course. > > In my experience, this is what happens pretty m

psutil

2018-02-27 Thread Larry Martell
Trying to install psutil (with pip install psutil) on Red Hat EL 7. It's failing with: Python.h: No such file or directory Typically that means the python devel libs are not installed, but they are: [root@liszt ~]# yum install python-devel Package python-devel-2.7.5-58.el7.x86_64 already install

Re: psutil

2018-02-27 Thread Larry Martell
On Tue, Feb 27, 2018 at 7:37 PM, Chris Angelico wrote: > On Wed, Feb 28, 2018 at 11:29 AM, Larry Martell > wrote: >> Trying to install psutil (with pip install psutil) on Red Hat EL 7. >> It's failing with: >> >> Python.h: No such file or directory >>

Re: psutil

2018-02-27 Thread Larry Martell
On Tue, Feb 27, 2018 at 7:36 PM, José María Mateos wrote: > On Tue, Feb 27, 2018 at 07:29:50PM -0500, Larry Martell wrote: >> Trying to install psutil (with pip install psutil) on Red Hat EL 7. >> It's failing with: >> >> Python.h: No such file or directory &

Re: psutil

2018-02-28 Thread Larry Martell
On Tue, Feb 27, 2018 at 8:30 PM, Matt Wheeler wrote: > > > On Wed, 28 Feb 2018, 00:49 Larry Martell, wrote: >> >> On Tue, Feb 27, 2018 at 7:36 PM, José María Mateos >> wrote: >> > On Tue, Feb 27, 2018 at 07:29:50PM -0500, Larry Martell wrote: >> >

Re: Why no list as dict key?

2022-04-20 Thread Larry Martell
On Wed, Apr 20, 2022 at 2:23 PM Abdur-Rahmaan Janhangeer wrote: > > Greetings list, > > Using Python3.9, i cannot assign a list [1, 2] as key > to a dictionary. Why is that so? Thanks in advanced! Dict keys cannot be mutable. Use a tuple instead. -- https://mail.python.org/mailman/listinfo/pytho

terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread Larry Martell
I have a script that has literally been running for 10 years. Suddenly, for some runs it crashes with the error: terminate called after throwing an instance of 'boost::python::error_already_set No stack trace. Anyone have any thoughts on what could cause this and/or how I can track it down? -- h

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread Larry Martell
On Fri, May 27, 2022 at 5:51 PM dn wrote: > On 28/05/2022 08.14, Larry Martell wrote: > > I have a script that has literally been running for 10 years. > > Suddenly, for some runs it crashes with the error: > > > > terminate called after throwing an i

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Larry Martell
On Thu, Jun 9, 2022 at 11:44 AM Dave wrote: > > Hi, > > Before I write my own I wondering if anyone knows of a function that will > print a nicely formatted dictionary? > > By nicely formatted I mean not all on one line! >>> import json >>> d = {'John': 'Cleese', 'Eric': "Idle", 'Micheal': 'Pali

Re: flattening lists

2022-10-11 Thread Larry Martell
On Tue, Oct 11, 2022 at 12:48 PM SquidBits _ wrote: > > Does anyone else think there should be a flatten () function, which just > turns a multi-dimensional list into a one-dimensional list in the order it's > in. e.g. > > [[1,2,3],[4,5,6,7],[8,9]] becomes [1,2,3,4,5,6,7,8,9]. > > I have had to

Re: Rob Cliffe should stop sending me rude email messages.

2023-02-26 Thread Larry Martell
On Sun, Feb 26, 2023 at 3:49 PM Hen Hanna wrote: > > Rob Cliffe should stop sending me rude email messages. You should stop spamming this lists with with meaningless posts. -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: can only concatenate str (not "int") to str

2023-02-26 Thread Larry Martell
On Sun, Feb 26, 2023 at 5:46 PM Chris Angelico wrote: > On Mon, 27 Feb 2023 at 12:44, MRAB wrote: > > Oh dear. An example of Godwin's Law. > > Yeah, is that finally enough to get this user banned ? I hope so > -- https://mail.python.org/mailman/listinfo/python-list

Re: comparing two lists

2021-02-24 Thread Larry Martell
On Wed, Feb 24, 2021 at 4:45 PM Davor Levicki wrote: > > i have two lists > > list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ] > list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ] > > and when I loop through the list > > > list_difference = [] > for item in list1: > > if item no

Re: yield from () Was: Re: weirdness with list()

2021-03-02 Thread Larry Martell
On Tue, Mar 2, 2021 at 2:16 PM Chris Angelico wrote: > > On Tue, Mar 2, 2021 at 5:51 AM Alan Gauld via Python-list > wrote: > > > > On 28/02/2021 00:17, Cameron Simpson wrote: > > > > > BUT... It also has a __iter__ value, which like any Box iterates over > > > the subboxes. For MDAT that is impl

Best practices regarding PYTHONPATH

2021-03-09 Thread Larry Martell
Which is considered better? Having a long import path or setting PYTHONPATH? For example, in a project where 50% of the imports come from the same top level directory is it better to add that dir to the path or reference it in the import statements? -- https://mail.python.org/mailman/listinfo/pyt

creating raw AWS log event

2021-06-23 Thread Larry Martell
When an AWS cloudwatch event is passed to a consumer it looks like this: { "awslogs": { "data": "ewogICAgIm1l..." } } To get the actual message I do this: def _decode(data): compressed_payload = b64decode(data) json_payload = zlib.decompress(compressed_payload, 16+zlib.

Re: creating raw AWS log event

2021-06-23 Thread Larry Martell
On Wed, Jun 23, 2021 at 7:05 PM Dennis Lee Bieber wrote: > > On Wed, 23 Jun 2021 10:42:42 -0700, Larry Martell > declaimed the following: > > >def _decode(data): > >compressed_payload = b64decode(data) > >json_payload = zlib.decompress(compressed_payload, 16

Re: creating raw AWS log event

2021-06-24 Thread Larry Martell
On Thu, Jun 24, 2021 at 12:20 AM Peter Otten <__pete...@web.de> wrote: > > On 23/06/2021 19:42, Larry Martell wrote: > > When an AWS cloudwatch event is passed to a consumer it looks like this: > > > > { > > "awslogs": { > > "

Re: creating raw AWS log event

2021-06-24 Thread Larry Martell
On Thu, Jun 24, 2021 at 10:38 AM Larry Martell wrote: > > On Thu, Jun 24, 2021 at 12:20 AM Peter Otten <__pete...@web.de> wrote: > > > > On 23/06/2021 19:42, Larry Martell wrote: > > > When an AWS cloudwatch event is passed to a consumer it looks like this:

Re: Is there a conference in the US that is similar to EuroPython?

2021-07-19 Thread Larry Martell
On Mon, Jul 19, 2021 at 10:01 AM Schachner, Joseph wrote: > > I am not going to fly to Europe for a Python conference. But, would consider > going if in the U.S.A. Especially if drivable ... NYC area would be ideal. > > I ask because I have seen ads for EuroPython over several years, and I don

SQLALchemy: update with in clause from kwargs

2021-08-03 Thread Larry Martell
I am trying to write a function that takes kwargs as a param and generates an update statement where the rows to be updated are specified in an in clause. Something like this: def update_by_in(self, **kwargs): filter_group = [] for col in kwargs['query_params']: #

Re: SQLALchemy: update with in clause from kwargs

2021-08-04 Thread Larry Martell
On Tue, Aug 3, 2021 at 7:26 PM dn via Python-list wrote: > > On 04/08/2021 13.08, Larry Martell wrote: > > I am trying to write a function that takes kwargs as a param and > > generates an update statement where the rows to be updated are > > specified in an in clause. >

All permutations from 2 lists

2022-03-01 Thread Larry Martell
If I have 2 lists, e.g.: os = ["Linux","Windows"] region = ["us-east-1", "us-east-2"] How can I get a list of tuples with all possible permutations? So for this example I'd want: [("Linux", "us-east-1"), ("Linux", "us-east-2"), ("Windows", "us-east-1"), "Windows", "us-east-2')] The lists can b

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Tue, Mar 1, 2022 at 7:21 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-03-01 at 19:12:10 -0500, > Larry Martell wrote: > > > If I have 2 lists, e.g.: > > > > os = ["Linux","Windows"] > > region = ["us-east-1"

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
le, I'm not sure of the > correct technical term). > If you only want to use the result once you can write e.g. > > for ops, reg in itertools.product(opsys, region): > etc. > > If you need it more than once, you can convert it to a list (or tuple), > as above. > Best

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > Op 2/03/2022 om 14:27 schreef Larry Martell: > > On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: > >> On 2022-03-01 at 19:12:10 -0500, > >> Larry Martell wrote: > >&g

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 8:54 AM Joel Goldstick wrote: > > On Wed, Mar 2, 2022 at 8:46 AM Larry Martell wrote: > > > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > > > > > > > Op 2/03/2022 om 14:27 schreef Larry Martell: > &g

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: > > Op 2/03/2022 om 14:44 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > >> > >> Op 2/03/2022 om 14:27 schreef Larry Martell: > >>> On Tue, Mar 1, 2022 at

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: > > > > Op 2/03/2022 om 15:29 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: > >> Op 2/03/2022 om 14:44 schreef Larry Martell: > >>> On Wed, Mar 2, 2022 at 8:37 AM Antoo

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 10:26 AM Antoon Pardon wrote: > > > > Op 2/03/2022 om 15:58 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: > >> > >>>>> If one list is empty I want just the other list. What I am doing is >

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > On 02Mar2022 08:29, Larry Martell wrote: > >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe wrote: > >> I think itertools.product is what you need. > >> Example program: > >> > >> import iterto

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 5:31 PM Joel Goldstick wrote: > > On Wed, Mar 2, 2022 at 5:07 PM Larry Martell wrote: > > > > On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > > > > > On 02Mar2022 08:29, Larry Martell wrote: > > > >On Tue,

Re: All permutations from 2 lists

2022-03-03 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > > Larry, > > i waited patiently to see what others will write and perhaps see if you > explain better what you need. You seem to gleefully swat down anything > offered. So I am not tempted to engage. But then you gave in to the t

calling a function asynchronously

2022-03-30 Thread Larry Martell
I have a django app, and for a certain request I need to kick off a long running task. I want to do this asynchronously and immediately return a response. I tried using subprocess.Process() but the forked process does not have a django database connection. I then tried posting a request using ajax

Re: calling a function asynchronously

2022-03-30 Thread Larry Martell
I do not get the errors I was getting before but it does not appear that my long running task is running at all. Still debugging. But concerting asyncio - doesn't run_until_complete block until long() completes? > > 30.03.2022 19:10, Larry Martell пишет: > > import asyncio > >

Re: type lookuperror

2016-08-18 Thread Larry Martell
On Thu, Aug 18, 2016 at 10:02 AM, Gene Heskett wrote: > On Thursday 18 August 2016 07:28:06 Chris Angelico wrote: > >> On Thu, Aug 18, 2016 at 7:55 PM, meInvent bbird > wrote: >> > actually i would like to remove try except code in all function >> > >> > and i feel that try except code for a larg

saving octet-stream png file

2016-08-19 Thread Larry Martell
I have some python code (part of a django app) that processes a request that contains a png file. The request is send with content_type = 'application/octet-stream' In the python code I want to write this data to a file and still have it still be a valid png file. The data I get looks like this:

Re: saving octet-stream png file

2016-08-19 Thread Larry Martell
On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: > On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell > wrote: >> I have some python code (part of a django app) that processes a >> request that contains a png file. The request is send with >> content_type = 'appli

Re: saving octet-stream png file

2016-08-19 Thread Larry Martell
On Fri, Aug 19, 2016 at 3:00 PM, Larry Martell wrote: > On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: >> On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell >> wrote: >>> I have some python code (part of a django app) that processes a >>> request that co

Re: saving octet-stream png file

2016-08-22 Thread Larry Martell
On Sun, Aug 21, 2016 at 5:24 PM, Jon Ribbens wrote: > On 2016-08-19, Larry Martell wrote: >> fd.write(request.POST[key]) > > You could try: > > request.encoding = "iso-8859-1" > fd.write(request.POST[key].encode("iso-8859-1")) > > It'

Re: saving octet-stream png file

2016-08-22 Thread Larry Martell
On Fri, Aug 19, 2016 at 4:24 PM, Chris Kaynor wrote: > On Fri, Aug 19, 2016 at 12:00 PM, Larry Martell > wrote: > >> On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: >> > On Sat, Aug 20, 2016 at 3:10 AM, Larry Martell >> wrote: >> >> I have so

Re: saving octet-stream png file

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 10:36 AM, Larry Martell wrote: > On Fri, Aug 19, 2016 at 4:24 PM, Chris Kaynor > wrote: >> On Fri, Aug 19, 2016 at 12:00 PM, Larry Martell >> wrote: >> >>> On Fri, Aug 19, 2016 at 1:24 PM, Chris Angelico wrote: >>> > O

Re: saving octet-stream png file

2016-08-22 Thread Larry Martell
On Fri, Aug 19, 2016 at 4:51 PM, Lawrence D’Oliveiro wrote: > On Saturday, August 20, 2016 at 6:03:53 AM UTC+12, Terry Reedy wrote: >> >> An 'octet' is a byte of 8 bits. > > Is there any other size of byte? Many, many years ago, probably c. 1982 my Dad came into my house and saw a Byte Magazine l

Re: DED processing

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 1:52 PM, Gary Sublett wrote: > I have to go out for a while, so for DED processing two options from > my end: > > 1. Process as you all have been in the past for now. If you all do > this, the records that have not been mailed prior to the latest list > are contained in a

Re: saving octet-stream png file

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 1:25 PM, Jon Ribbens wrote: > On 2016-08-22, Larry Martell wrote: >> On Sun, Aug 21, 2016 at 5:24 PM, Jon Ribbens >> wrote: >>> On 2016-08-19, Larry Martell wrote: >>>> fd.write(request.POST[key]) >>> >>> Y

Re: Is duck-typing misnamed?

2016-08-27 Thread Larry Martell
On Fri, Aug 26, 2016 at 7:58 PM, ROGER GRAYDON CHRISTMAN wrote: > "If it walks like a duck, quacks like a duck,... " > > so there is indeed precedence for this so-called 'duck typing' > > > but wouldn't it be more Pythonic to call this 'witch typing'? > > "How do you know she is a witch?" > > "She

Re: while loop

2016-10-11 Thread Larry Martell
On Tue, Oct 11, 2016 at 1:58 PM, wrote: > > n=6 > x=1 > while x<=n: > print "*"*x > x+=1 > while n>=x: > n=n-1 > print "*"* n > > > Only first loop is executing not the second one? Because after the first loop n < x -- https://mail.python.org/mailman/listinfo/python-list

Re: Can somebody tell me what's wrong wrong with my code? I don't understand

2016-11-21 Thread Larry Martell
On Mon, Nov 21, 2016 at 10:10 PM, wrote: > Hi! This is my first post! I'm having trouble understanding my code. I get > "SyntaxError:invalid syntax" on line 49. I'm trying to code a simple > text-based rpg on repl.it. Thank you for reading. > > > > print("Welcome to Gladiator Game! Choose your

dateutil timezone question

2016-12-23 Thread Larry Martell
I have a datetime that looks like this: '2016-11-11T18:10:09-05:00' and when I pass it to dateutil.parser.parse I get back this: datetime.datetime(2016, 11, 11, 18, 10, 9, tzinfo=tzoffset(None, -18000)) And I have other datetimes like this: '2016-04-27T00:00:00', which went passed to dateutil.par

Re: dateutil timezone question

2016-12-23 Thread Larry Martell
On Fri, Dec 23, 2016 at 2:18 PM, Chris Angelico wrote: > On Sat, Dec 24, 2016 at 3:30 AM, Larry Martell > wrote: >> I have a datetime that looks like this: '2016-11-11T18:10:09-05:00' >> and when I pass it to dateutil.parser.parse I get back this: >> >> d

Re: dateutil timezone question

2016-12-23 Thread Larry Martell
On Fri, Dec 23, 2016 at 2:27 PM, Skip Montanaro wrote: >> I need to compare these datetimes, and if I do that I get the dreaded >> "can't compare offset-naive and offset-aware datetimes" error. > > If you're sure the naive datetimes are UTC, this should work: > > import pytz > > dt = pytz.utc.loca

sorting strings numerically while dealing with missing values

2016-12-28 Thread Larry Martell
I have a list containing a list of strings that I want to sort numerically by one of the fields. I am doing this: sorted(rows, key=float(itemgetter(sortby))) Which works fine as long as all the sort keys convert to a float. Problem is that some are blank or None and those throw an exception. How

Re: sorting strings numerically while dealing with missing values

2016-12-29 Thread Larry Martell
On Wed, Dec 28, 2016 at 3:43 PM, Ian Kelly wrote: > On Wed, Dec 28, 2016 at 2:14 PM, Larry Martell > wrote: >> >> I have a list containing a list of strings that I want to sort >> numerically by one of the fields. I am doing this: >> >> sorted(rows, ke

Re: Clickable hyperlinks

2017-01-09 Thread Larry Martell
On Mon, Jan 9, 2017 at 5:33 PM, Deborah Swanson wrote: > Ok, here is the crux of this thread's communication problem. I didn't > ask, or particularly care for all these lectures on the technology of > terminal emulators. I asked how to code Python to make clickable links. > > Since all of you are

sorting a list of dicts by a computed field

2017-01-31 Thread Larry Martell
I have a list of dicts and one item of the dict is a date in m/d/Y format. I want to sort by that. I tried this: sorted(data['trends'], key=lambda k: datetime.strptime(k['date_time'],'%m/%d/%Y')) But that fails with: Exception Type: AttributeError at /report/CDSEM/WaferAlignment/ajax/waChart.jso

  1   2   3   4   5   >