RE: Script profiling details

2022-01-11 Thread Joseph L. Casale
> You might try `py-spy`. That worked well, I started trying to get more data from the profile output with the stats module but didn't quite get there. Thank you everyone, jlc -- https://mail.python.org/mailman/listinfo/python-list

Script profiling details

2022-01-10 Thread Joseph L. Casale
I am trying to track down a slow script startup time. I have executed the script using `python -m cProfile -o profile /path/script.py` and read through the results, but the largest culprit only shows various built-ins. I expected this given the implementation, but I was hoping to get some finer de

Re: Getting Directory of Command Line Entry Point For Packages

2021-11-12 Thread David L Neil via Python-list
On 13/11/2021 10.51, Abdur-Rahmaan Janhangeer wrote: > Greetings list, > > Let's say i created a package named miaw > > miaw also has a cli command called miaw > > miaw prints files and folders in the directory it is called in > > except that when miaw is used, it prints the files and folders i

Re: The task is to invent names for things

2021-10-26 Thread David L Neil via Python-list
On 27/10/2021 12.29, Stefan Ram wrote: > dn writes: >> On 27/10/2021 11.16, Stefan Ram wrote: >>> The Mental Game of Python - Raymond Hettinger (PyBay 2019) >>> | "The computer gives us words that do ### things. > ... >> Alternately, if your question was to identify the mumbled word, it is >> (se

Re: XML Considered Harmful

2021-09-24 Thread David L Neil via Python-list
On 25/09/2021 11.00, Chris Angelico wrote: > Invented because there weren't enough markup languages, so we needed another? Anything You Can Do I Can Do Better https://www.youtube.com/watch?v=_UB1YAsPD6U -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread David L Neil via Python-list
Officially April-Fools Day is over (here), but... On 01/04/2021 19.25, Chris Angelico wrote: > On Thu, Apr 1, 2021 at 3:36 PM dn via Python-list > wrote: >> >> On 01/04/2021 13.54, Chris Angelico wrote: >>> Real and imaginary are the same thing, just rotated a quarter turn >> >> In which dim

RE: How to implement logging for an imported module?

2021-03-07 Thread Joseph L. Casale
> I couldn't find any information on how to implement logging in a library that > doesn't know the name of the application that uses it. How is that done? Hello, That's not how it works, it is the opposite. You need to know the name of its logger, and since you imported it, you do. Logging is hi

Overriding property types on instances from a library

2021-02-20 Thread Joseph L. Casale
I have some code that makes use of the typing module. This code creates several instances of objects it creates from a library that has some issues. For example, I have multiple list comps that iterate properties of those instance and the type checker fails with: Expected type 'collections.It

Re: Application window geometry specifier

2021-01-13 Thread David L Neil via Python-list
On 14/01/2021 15.25, boB Stepp wrote: > On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico wrote: > >> I love how "I think" is allowed to trump decades of usability research. I'm just pleased that @Chris has found love! (not detracting from the point though) > Can you recommend a good reference fo

Re: Some problem in code execution in python

2021-01-07 Thread David L Neil via Python-list
On 07/01/2021 22.44, Dario Dario wrote: > Sir, I am one of the user of your python program, that is after completion > of installation I got some statement like "you got code execution problem > ". I don't know how to rectify this problem.so please help me to rectify > this problem . > You send me

asyncio cancellation pattern

2020-12-28 Thread Joseph L. Casale
I've started writing some asyncio code in lieu of using threads and managing concurrency and primitives manually. Having spent a lot of time using c#'s async implementation, I am struggling to see an elegant pattern for implementing cancellation. With the necessity for the loop (that of which I un

RE: pexpect with kadmin

2020-12-23 Thread Joseph L. Casale
> If you have windows 10 can you use Windows Subsystem for Linux (WSL) > to install one of the Linux distros and use that? Interesting idea, sadly I am too far past the deadline on this to go through the red tape needed to get that in place. Thanks, jlc -- https://mail.python.org/mailman/listi

pexpect with kadmin

2020-12-22 Thread Joseph L. Casale
Anyone ever used pexpect with tooling like kadmin and have insight into how to manage interacting with it? After setting up debug logging, I was able to adjust the expect usage to get the input and output logs to at least appear correct when setting a password for a principal, however even with a

RE: setuptools issue

2020-12-17 Thread Joseph L. Casale
> Installed on this Slackware-14.2/x86_64 workstation with python-3.9.1 are: > python-setuptools-22.0.5-x86_64-1 I just ran into this recently, I don't recall the actual source but it was the version of setuptools having been so old. Your version is from Jun 3, 2016... Update it, that was what w

RE: Python Client Rest API Invocation - POST with empty body - Invalid character found in method name [{}POST]. HTTP method names must be tokens

2020-11-20 Thread Joseph L. Casale
> Invalid character found in method name [{}POST]. HTTP method names must be > tokens. /snip > I could see in from wireshark dumps it looked like - {}POST > HTTP/1.1 The error message and your own debugging indicate the error. Your method *name* is {}POST, you have somehow included two brac

Re: Winreg

2020-07-31 Thread David L Neil via Python-list
On 31/07/2020 16:48, R Pasco wrote: Thanks for your extensive info. Its too bad this isn't published in the python winreg/_winreg modules' info. Ray Pasco Welcome to the world of documentation! Perhaps you have 'discovered' something, or maybe you're using the tool in an unusual way, or mayb

Re: Division issue with 3.8.2 on AIX 7.1

2020-06-03 Thread Sherry L. West
I need off this list please. I don’t even have this. On Wed, Jun 3, 2020 at 11:30 PM Albert Chin < python-l...@mlists.thewrittenword.com> wrote: > On Wed, Jun 03, 2020 at 08:11:17PM -0400, Dennis Lee Bieber wrote: > > On Tue, 2 Jun 2020 12:26:16 -0500, Albert Chin > > de

Constructing mime image attachment

2020-05-28 Thread Joseph L. Casale
I have some json encoded input for nodemailer (https://nodemailer.com/message/embedded-images) where the path key is a string value which contains the base64 encoded data such as: { html: 'Embedded image: ', attachments: [{ filename: 'image.png', path: 'data:image/png;bas

Re: Is there a difference between python

2020-04-05 Thread David L Neil via Python-list
On 6/04/20 10:35 AM, Malcolm Greene wrote: Is there a difference between the following 2 ways to launch a console-less script under Windows? python

policy based variable composition

2020-04-03 Thread Joseph L. Casale
I am looking to replace a home built solution which allows a program to derive a series of variable values through configuration or policy. The existing facility allows dependences so one of the requested variables can depend on another, they are ordered and computed. It also allows callbacks so c

Print statement

2020-01-28 Thread L A Smit
Please help me with this. squares =input("\nSquares: ") print(float((squares) *float(.15)) *(1.3)) Cant print answer. print(float((squares) * float(.15)) *(1.3)) TypeError: can't multiply sequence by non-int of type 'float' Thx L Smit -- https://mail.python.or

pyinstaller

2020-01-15 Thread L A Smit
Hi New to programming. Please can u help me. I have python 3.7 installed on linux peppermint 10 and pyinstaller 3.6 but dont know how to run pyinstaller or how to install it on the correct diectory. Thx L Smit -- https://mail.python.org/mailman/listinfo/python-list

Front end

2019-12-28 Thread L A Smit
input. I understand that there is probably hundreds of these programs but to teach myself i want to wright my own program and then i can update it when needed. Thx L Smit -- https://mail.python.org/mailman/listinfo/python-list

Re: TypeError: unhashable type: 'list'

2019-10-23 Thread David L Neil via Python-list
On 23/10/19 8:51 PM, joseph pareti wrote: I am experimnenting with this (reproducer) code: pattern_eur= ['Total amount'] mylines = []# Declare an empty list. with open ('tmp0.txt', 'rt') as myfile: # Open tmp.txt for reading text. for myline in myfile:

Re: Mouse control

2019-10-12 Thread David L Neil via Python-list
On 7/10/19 4:11 AM, Alexander Vergun wrote: Hello all, I am coding a voice assistant under Python 3.7, Windows 7. I am using PYcharm and libraries such as PYSimpleGUI, mouse, keyboard etc. Everything works except for the mouse control and probably keyboard, the problem is following, when I ru

Re: Mouse control

2019-10-07 Thread David L Neil via Python-list
On 7/10/19 4:11 AM, Alexander Vergun wrote: I am coding a voice assistant under Python 3.7, Windows 7. I am using PYcharm and libraries such as PYSimpleGUI, mouse, keyboard etc. Everything works except for the mouse control and probably keyboard, the problem is following, when I run the script

Re: Help to understand the data structure

2019-09-27 Thread Mohan L
Hi All, Please ignore it, I was able to figure out it. for dev in devlist: print (dev.name, dev.id) -- Thanks & Regards Mohan L On Fri, Sep 27, 2019 at 8:41 PM Mohan L wrote: > Hi All, > > I am using get_devices_list method from this module: > https://github.com/

Help to understand the data structure

2019-09-27 Thread Mohan L
: devicename1 10 devicename2 11 devicename3 12 I spend quit some time still not able to figure out how to parse. Can some one through some light on how to phrase it. -- Thanks & Regards Mohan L -- https://mail.python.org/mailman/listinfo/python-list

RE: Class initialization with multiple inheritance

2019-07-20 Thread Joseph L. Casale
-Original Message- From: Barry Scott Sent: Tuesday, July 16, 2019 11:53 AM To: Joseph L. Casale Cc: python-list@python.org Subject: Re: Class initialization with multiple inheritance > And here is the MRO for LeftAndRight. > > >>> import m > LeftAndRight.__ini

Class initialization with multiple inheritance

2019-07-15 Thread Joseph L. Casale
I am trying to find explicit documentation on the initialization logic for a Base class when multiple exist. For the example in the documentation at https://docs.python.org/3/tutorial/classes.html#multiple-inheritance, if Base1 and Base2 both themselves inherited from the same base class, only Base

Type hinting

2019-04-08 Thread Joseph L. Casale
Hi, Is it possible to associate combinations of types for a given signature, for example: T = TypeVar('T', Foo, Bar, Baz) S = TypeVar('S', FooState, BarState, BazState) closure = 'populated dynamically' def foo(factory: Callable[[List[T], str], None], state: S) -> List[T]: results = []

RE: asyncio Question

2019-03-15 Thread Joseph L. Casale
> -Original Message- > From: Python-list bounces+jcasale=activenetwerx@python.org> On Behalf Of Simon > Connah > Sent: Thursday, March 14, 2019 3:03 AM > To: Python > Subject: asyncio Question > > Hi, > > Hopefully this isn't a stupid question. For the record I am using Python > 3.7

RE: Serializing complex objects

2018-09-21 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of Rhodri James Sent: Friday, September 21, 2018 11:39 AM To: python-list@python.org Subject: Re: Serializing complex objects > Depending on what exactly your situation is, you may be able to use the > pickle module (in the standard library)

Serializing complex objects

2018-09-21 Thread Joseph L. Casale
I need to serialize a deep graph only for the purposes of visualizing it to observe primitive data types on properties throughout the hierarchy. In my scenario, I cannot attach a debugger to the process which would be most useful. Using json is not the easiest as I need to chase endless custom seri

RE: lxml namespace as an attribute

2018-08-15 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of Skip Montanaro Sent: Wednesday, August 15, 2018 3:26 PM To: Python Subject: lxml namespace as an attribute > Much of XML makes no sense to me. Namespaces are one thing. If I'm > parsing a document where namespaces are defined at the top

RE: Issue with python365.chm on window 7

2018-04-24 Thread Joseph L. Casale
From: Brian Gibbemeyer Sent: Tuesday, April 24, 2018 12:36 PM To: Joseph L. Casale Cc: python-list@python.org Subject: RE: Issue with python365.chm on window 7 > I right clicked on the file, no option to unblock. Sorry, choose properties, then unblock. -- https://mail.python.org/mail

RE: Issue with python365.chm on window 7

2018-04-24 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of Brian Gibbemeyer Sent: Tuesday, April 24, 2018 11:01 AM To: Ethan Furman Cc: python-list@python.org Subject: Re: Issue with python365.chm on window 7 > The file at > https://www.python.org/ftp/python/3.6.4/python364.chm > > Loads up into

Re: Instance variables question

2018-04-16 Thread Joseph L. Casale
From: Python-list on behalf of Irv Kalb Sent: Monday, April 16, 2018 10:03 AM To: python-list@python.org Subject: Instance variables question   > class PartyAnimal(): >     x = 0 > >     def party(self): >     self.x = self.x + 1 >     print('So far', self.x) Your not accessing the

RE: Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of MRAB Sent: Friday, April 13, 2018 12:05 PM To: python-list@python.org Subject: Re: Python regex pattern from array of hex chars > Use re.escape: > > regex = re.compile('[^{}]+'.format(re.escape(''.join(c for c in > character_class Br

Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in character_class))) I would use that in a re.sub to collapse and replace all but

RE: issues when buidling python3.* on centos 7

2018-03-26 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of joseph pareti Sent: Sunday, March 25, 2018 10:15 AM To: python-list@python.org Subject: issues when buidling python3.* on centos 7 > The following may give a clue because of inconsistent python versions: > > [joepareti54@xxx ~]$ python -V

Re: Context manager on method call from class

2018-03-15 Thread Joseph L. Casale
From: Python-list on behalf of Rob Gaddi Sent: Thursday, March 15, 2018 12:47 PM To: python-list@python.org Subject: Re: Context manager on method call from class   > from contextlib import contextmanager. > > Then you just use the @contextmanager decorator on a function, have it > set up,

Context manager on method call from class

2018-03-15 Thread Joseph L. Casale
I have a class which implements a context manager, its __init__ has a signature and the __enter__ returns an instance of the class. Along with several methods which implement functionality on the instance, I have one method which itself must open a context manager against a call on an instance att

Re: why does memory consumption keep growing?

2017-10-05 Thread Pankaj L Ahire
On Thu, Oct 5, 2017 at 17:07 Fetchinson . via Python-list < python-list@python.org> wrote: > Hi folks, > > I have a rather simple program which cycles through a bunch of files, > does some operation on them, and then quits. There are 500 files > involved and each operation takes about 5-10 MB of m

RE: Python DB API - commit() v. execute("commit transaction")?

2017-05-30 Thread Joseph L. Casale
-Original Message- From: Python-list [mailto:python-list- bounces+jcasale=activenetwerx@python.org] On Behalf Of Ian Kelly Sent: Tuesday, May 30, 2017 8:12 AM To: Python Subject: Re: Python DB API - commit() v. execute("commit transaction")? > There's no difference I'm aware of in the

.Re: scanf string in python

2017-04-21 Thread Robert L.
> > I have a string which is returned by a C extension. > > > > mystring = '(1,2,3)' > > > > HOW can I read the numbers in python ? > > re.findall seems the safest and easiest solution: > > >>> re.findall(r'(\d+)', '(1, 2, 3)') > ['1', '2', '3'] > >>> map(int, re.findall(r'(\d+)', '(1, 2, 3)')) >

RE: Regular Expressions, Speed, Python, and NFA

2017-04-14 Thread Joseph L. Casale
-Original Message- From: Python-list [mailto:python-list- bounces+jcasale=activenetwerx@python.org] On Behalf Of Malik Rumi Sent: Friday, April 14, 2017 9:12 AM To: python-list@python.org Subject: Regular Expressions, Speed, Python, and NFA > I am running some tests using the site rege

Re: Temporary variables in list comprehensions

2017-04-02 Thread Robert L.
On 1/8/2017, Steven D'Aprano wrote: > Suppose you have an expensive calculation that gets used two or > more times in a loop. The obvious way to avoid calculating it > twice in an ordinary loop is with a temporary variable: > > result = [] > for x in data: > tmp = expensive_calculation(x) >

Re: sorting list python

2017-04-01 Thread Robert L.
On 1/18/2017, Peter Otten wrote: > with partite.txt looking like this > > > 74' Kessie' > > 90' + 4' D'alessandro > > 51' Mchedlidze > > 54' Banega > > 56' Icardi > > 65' Icardi > > 14' Sau > > > Assuming you want to perform a numerical sort on the numbers before the ' > you can just apply sor

Re: How to flatten only one sub list of list of lists

2017-04-01 Thread Robert L.
On 3/1/2017, Sayth Renshaw wrote: > How can I flatten just a specific sublist of each list in a list of lists? > > So if I had this data > > > [ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']], > ['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00

Re: Better way to do this dict comprehesion

2017-04-01 Thread Robert L.
On 3/7/2017, Sayth Renshaw wrote: > I have got this dictionary comprehension and it > works but how can I do it better? > > from collections import Counter > > def find_it(seq): > counts = dict(Counter(seq)) > a = [(k, v) for k,v in counts.items() if v % 3 == 0] > return a[0][0] >

RE: What are your opinions on .NET Core vs Python?

2017-01-30 Thread Joseph L. Casale
> C# hardly seems any better than Java to me as far as a language goes. Which sounds pretty good to me, they are both high performance, mature and rich languages. > Being forced into working with classes even when they are not > appropriate is jarring. And 100% irrelevant, it doesn't prevent you

RE: What are your opinions on .NET Core vs Python?

2017-01-30 Thread Joseph L. Casale
> Python still has my heart, but .NET Core tempts me. One great thing of > coding in C# would be no GIL. Seriously, check out the benchmarks at https://github.com/aspnet/benchmarks. I think aside from the obvious, you'll find the Razor engine and the overall library to be a pleasure to work with

RE: What are your opinions on .NET Core vs Python?

2017-01-30 Thread Joseph L. Casale
> What do you mean by "both platforms"? Python scripts already run on > three major operating systems (Win/Lin/Mac) and a good number of > less-popular OSes; a well-written Python script will run in four major > Pythons (CPython, PyPy, Jython, IronPython) and a number of others; > and all manner of

RE: What are your opinions on .NET Core vs Python?

2017-01-29 Thread Joseph L. Casale
> What .NET APIs are anticipated to be released that aren't on the > official CLI list now: > https://en.wikipedia.org/wiki/List_of_CLI_languages#Current_Languages, > and/or, are .NET supported languages expected to expand beyond the CLI > list? I think this (and the last point) misinterprets the

RE: What are your opinions on .NET Core vs Python?

2017-01-29 Thread Joseph L. Casale
> .NET is a library that can be used from many languages, including Python. No. .NET Core (what the OP asked about which is not .NET) is a cross-platform framework. Obviously Python and .NET differ in runtime semantics with respect to the original source code, however they are now roughly equiva

RE: Sockets: IPPROTO_IP not supported

2017-01-16 Thread Joseph L. Casale
> Trying to sniff Ethernet packets, I do this: > >s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) > > but it results in this: > > $ sudo python3 sniff_survey.py > Traceback (most recent call last): > File "sniff_survey.py", line 118, in > s = socket

RE: multiprocessing.Process call blocks other processes from running

2017-01-14 Thread Joseph L. Casale
> while True: >for client in clients: > stats = ThreadStats() > stats.start() > p = Process(target=getWhispererLogsDirSize, args=(client,queue,)) > jobs.append(p) > p.start() > p.join() You start one client then join before starting the next... Start them all an

RE: Can not run the Python software

2017-01-13 Thread Joseph L. Casale
> And this is coming up a lot. This is something that should already be > on all supported versions of Windows if Windows updates are done, right? No, it's not an update. You install the runtime *if* you need it. > but maybe it's time that the > Python installer bundles the redistributable inst

RE: Can not run the Python software

2017-01-13 Thread Joseph L. Casale
> Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello > World" program and got the following message: > "Process finished with exit code 1073741515 (0xC135)" > I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, > x64-based processor). If you track

RE: reactiveX vs Async

2017-01-11 Thread Joseph L. Casale
> So you are saying that nuget-ing .Net core would be a workable pre-requisite > for > Rx on mono? Microsoft open sourced .net a while ago. With that came the movement to bring .net to other platforms. https://en.wikipedia.org/wiki/.NET_Framework#.NET_Core As its currently being heavily develop

RE: reactiveX vs Async

2017-01-11 Thread Joseph L. Casale
> One more question: Do you know if (and how much) of these things would work > in Linux/C# (ie mono)? Mono, I forgot what that is when .net core debuted:) Looks like the .net Rx guys have a port, https://github.com/Reactive-Extensions/Rx.NET/issues/148 A package for .net core is up on nuget.

RE: reactiveX vs Async

2017-01-11 Thread Joseph L. Casale
> Thanks Joseph > Trouble is there is stew of technologies/languages… > (meta)-stewed with more abstract concepts, eg push vs pull, > Enumerable-Observable > duality, continuous vs discrete time > The last causing its own share of confusion with “functional reactive > programming” (FRP) meaning s

RE: reactiveX vs Async

2017-01-11 Thread Joseph L. Casale
>> There is the recent flurry around the new async additions to python > > I meant to add: “… which I dont pretend to understand…” Try these links on for size: https://msdn.microsoft.com/en-us/library/hh242982(v=vs.103).aspx which links to https://msdn.microsoft.com/en-us/library/hh242983(v=vs.10

RE: reactiveX vs Async

2017-01-11 Thread Joseph L. Casale
> Try these links on for size: > > https://msdn.microsoft.com/en-us/library/hh242982(v=vs.103).aspx which links > to > https://msdn.microsoft.com/en-us/library/hh242983(v=vs.103).aspx near the end. These two SO threads have a variation of pretty good explanations: http://stackoverflow.com/questi

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread Michael L Torrie
On 10/27/2016 11:05 PM, Michael Torrie wrote: > On 10/27/2016 04:07 AM, Terry Reedy wrote: >> As I and others have said, those keyboard functions are not available on >> text terminals. I predict that keyboard functions that so not work on >> all systems will never become built-ins. But some ar

thread local storage

2016-10-26 Thread Joseph L. Casale
Looks like the shipped implementation doesn't give access to all the discrete copies of tls for us in a case where a context manager needs to perform any cleanup. Does something exists where I can leverage this feature or do I need to roll my own? Thanks, jlc -- https://mail.python.org/mailman

3.5.2

2016-10-25 Thread Kenneth L Stege
Im running windows 7 pro, 64 bit. I downloaded 3.5.2 64 bit and when I try to run I get the error message  api-ms-win-crt-runtime-l1-1-0.dll is missing. I loaded that file and still will not run.   suggestions? thanks -- https://mail.python.org/mailman/listinfo/python-list

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Interesting. Generally, I allocate cursors exactly at the same time as I open > transactions; > not sure if this works with the mysql connector, but with psycopg2 > (PostgreSQL), my code looks like this: > > with conn, conn.cursor() as cur: > cur.execute(...) > ... = cur.fetchall() > >

RE: MySQL connector issue

2016-10-23 Thread Joseph L. Casale
> Perhaps you simplified too much, but changes between the select and the > update could be lost. I think you need at least three states: > > 1 mark rows where baz is null (by setting baz to some value other than NULL > or 42, 24, say: set baz = 24 where baz is NULL) > 2 show marked rows (select

MySQL connector issue

2016-10-23 Thread Joseph L. Casale
I have some code that I am testing on Windows without c extensions which runs on a RHEL server with c extensions. In a simplified test case as follows: connection = mysql.connector.connect(...) cursor = connection.cursor(cursor_class=MySQLCursorDict) while True: cursor.execute('SELECT foo,biz

Re: Python C API: How to debug reference leak?

2016-09-27 Thread dl l
When I debug in C++, I see the reference count of a PyObject is 1. I don't know where is referencing this object. How can I find out where is referencing this object? 2016-09-27 15:47 GMT+08:00 dl l : > Thanks for reply. Is there any function in C to get the reference objects > of

Re: PyImport_AddModule vs PyImport_Import

2016-09-27 Thread dl l
Thanks. That's helpful. I did not notice the note. 2016-09-27 19:24 GMT+08:00 Ned Batchelder : > On Tuesday, September 27, 2016 at 3:54:01 AM UTC-4, dl l wrote: > > What is the difference between PyImport_AddModule and PyImport_Import? > > > > When need to use PyImpo

PyImport_AddModule vs PyImport_Import

2016-09-27 Thread dl l
What is the difference between PyImport_AddModule and PyImport_Import? When need to use PyImport_AddModule? When need to use PyImport_Import? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python C API: How to debug reference leak?

2016-09-27 Thread dl l
Thanks for reply. Is there any function in C to get the reference objects of a object? I want to debug where are referencing the object. 2016-09-27 15:01 GMT+08:00 dieter : > dl l writes: > > I want to check the references of an object. Any way to get the > references > >

Python C API: How to debug reference leak?

2016-09-26 Thread dl l
I want to check the references of an object. Any way to get the references of an object with Python C API? Like: gc.get_referrs(), is there similar API in C lib? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-20 Thread dl l
= 2016-09-21 13:09 GMT+08:00 dieter : > dl l writes: > > I found the problem is resolved if call PyGC_Collect() after > > PyDict_DelItemString(). Is it expected to call PyGC_Collect() here for > > Python 3.5 which is not needed for Python 3.3? > > Usually, Python use

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-20 Thread dl l
Thank you all for the help. I found the problem is resolved if call PyGC_Collect() after PyDict_DelItemString(). Is it expected to call PyGC_Collect() here for Python 3.5 which is not needed for Python 3.3? 2016-09-20 16:01 GMT+08:00 Chris Angelico : > On Tue, Sep 20, 2016 at 4:19 PM, d

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
equires my customers to update their python scripts. That may make them unhappy :(. Is there a workaround in my code C++ side to call Python C APIs to resolve the memory leak issue? 2016-09-20 13:49 GMT+08:00 Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info>: > On Monday 19 Septembe

Re: Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
Thanks for the replay. I run this script as __main__ module, this module is removed from sys.modules, and the ref count becomes 0. 2016-09-20 0:00 GMT+08:00 Chris Angelico : > On Mon, Sep 19, 2016 at 4:47 PM, dl l wrote: > > I have a app loading python35.dll. Use python API PyImport_

Python 3.5.1 C API, the global available available is not destroyed when delete the module

2016-09-19 Thread dl l
Hi, I have a app loading python35.dll. Use python API PyImport_AddModule to run a py file. And use PyDict_DelItemString to delete the module. There is a global vailable in the py file. The global variable is not destroyed when calling PyDict_DelItemString to delete the module. That cause the memor

RE: SOAP and Zeep

2016-07-29 Thread Joseph L. Casale
> Or any other libraries that can be recommended? I'd recommend Spyne, code and docs are good, but more importantly the lead dev is responsive and very helpful. Can't speak highly enough about him... http://spyne.io/ hth, jlc -- https://mail.python.org/mailman/listinfo/python-list

RE: argparse and subparsers

2016-06-27 Thread Joseph L. Casale
> Not sure if this fits the bill, or makes sense here, but I came cross > "docopt" which touts itself as a "Command-line interface description > language". I used it in a project and it seems to be pretty easy to use > as well as elegant. It stores the arguments & values as a dictionary, > keyed by

argparse and subparsers

2016-06-26 Thread Joseph L. Casale
I have some code where sys.argv is sliced up and manually fed to discrete argparse instances each with a single subparser. The reason the discrete parsers all having a single subparser was to make handling the input simpler, the first arg in the slice could be left in. This has become unmaintai

[pyinotify] help required to send only one mail for chunk of events

2016-05-23 Thread Mohan L
Hi All, I am using the bellow script to watch directories. Using 20 seconds to aggregate together a larger chunk of events and enabled coalescing of events. I wanted to send an email notification with content of logfile after 15 mins on any change. The idea is I want to send only one mail for ch

RE: Ctypes c_void_p overflow

2016-05-05 Thread Joseph L. Casale
> I generally avoid c_void_p because its lenient from_param method > (called to convert arguments) doesn't provide much type safety. If a > bug causes an incorrect argument to be passed, I prefer getting an > immediate ctypes.ArgumentError rather than a segfault or data > corruption. For example, w

Ctypes c_void_p overflow

2016-05-05 Thread Joseph L. Casale
I have CDLL function I use to get a pointer, several other functions happily accept this pointer which is really a long when passed to ctypes.c_void_p. However, only one with same type def in the prototype overflows. Docs suggest c_void_p takes an int but that is not what the first call returns,

RE: Static caching property

2016-03-22 Thread Joseph L. Casale
> If a method call on any instance defines the return value for > all instances, then this method likely should be a class method -- > and use a class attribute to store the result -- something like this: > > class C(object): > > _cache = {} > > @classmethod > def f(cls, ...): >

Re: Static caching property

2016-03-21 Thread Joseph L. Casale
> One solution is to use descriptor protocol on the class, which means > using a metaclass. I'm not sure it's the best option, but it is an > option. I will look at that, I wonder if however I am not over complicating it: class Foo: _bar = None @property def expensive(self): i

Re: Static caching property

2016-03-21 Thread Joseph L. Casale
> I think Joseph is using "static" in the Java sense of being associated with > the class rather than an instance. (In Java, members of classes must be > known at compile-time.) Yup, so a single value on the class itself, not instance specific. > But what you can do is have the property refer to

Static caching property

2016-03-21 Thread Joseph L. Casale
With non static properties, you can use a decorator that overwrites the method on the instance with an attribute containing the methods return effectively caching it. What technique for a static property can be used to accomplish what the descriptor protocol does? I need to cache the results of a

Re: Passing data across callbacks in ThreadPoolExecutor

2016-02-19 Thread Joseph L. Casale
> It's still not clear to me specifically what you're trying to do. It > would really help if you would describe the problem in more detail. > Here's what I think you're trying to do: > > 1) Submit a task to a ThreadPoolExecutor and get back a future. > > 2) When the task is complete, submit anot

Re: Passing data across callbacks in ThreadPoolExecutor

2016-02-18 Thread Joseph L. Casale
On Thur, Feb 17, 2016 at 9:24 AM, Ian Kelly wrote: >> What is the pattern for chaining execution of tasks with ThreadPoolExecutor? >> Callbacks is not an adequate facility as each task I have will generate new >> output. > > Can you specify in more detail what your use case is? > > If you don't m

Passing data across callbacks in ThreadPoolExecutor

2016-02-16 Thread Joseph L. Casale
What is the pattern for chaining execution of tasks with ThreadPoolExecutor? Callbacks is not an adequate facility as each task I have will generate new output. Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

Installation

2016-01-12 Thread Jansen, Ingram L
I can't download Python and I need it for class. Any suggestions? Ingram Jansen Banner ID: 830742998 -- https://mail.python.org/mailman/listinfo/python-list

Re: Subclassing tuple and introspection

2015-12-02 Thread Joseph L. Casale
> If you're not already familiar with collections.namedtuple, have a > look at it, as it sounds like just naming the fields may be all that > you need. You can also subclass it further to add methods if desired. Yeah, all the types in these collections are named tuples... The collection itself isn

Subclassing tuple and introspection

2015-12-02 Thread Joseph L. Casale
I need to return a collection of various types, since python doesn't have the terse facility of extension methods like C#, subclassing tuple and adding a method seems like a terse way to accommodate this. However, if the method returns one element of the collection, how can one enable introspectio

RE: Enum class

2015-10-15 Thread Joseph L. Casale
> Like that? > > >>> class M2(enum.EnumMeta): >... def __contains__(self, value): >... print(value, "? never", sep="") >... return False >... > >>> Colors.__class__ > > >>> Colors.red in Colors > checking Colors.red > True > >>> Colors.__class__ = M2 > >>> Colors.red in Colors

Re: Enum class

2015-10-15 Thread Joseph L. Casale
import enum class M(enum.EnumMeta): >... def __contains__(self, value): >... print("checking", value) >... return super().__contains__(value) >... class Colors(enum.Enum, metaclass=M): >... red = 1 >... green = 2 >... blue = 3 >... Colors.red in C

Enum class

2015-10-15 Thread Joseph L. Casale
Is it possible to override __contains__ from the meta class in the derived class with the Enum type? Thanks, jlc -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   >