Re: Help with implementing callback functions using ctypes

2013-05-08 Thread dieter
jamadagni writes: > ... I cannot help you with "ctypes". But, if you might be able to use "cython", then calling callbacks is not too difficult (you can find an example in e.g. my "dm.xmlsec.binding"). Note, however, that properly handling the GIL ("Global Interpreter Lock") may be of great impor

Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError.

2013-05-14 Thread dieter
"Mr. Joe" writes: > ... > Sorry for digging this old topic back. I see that my "'property' does not > play well with polymorphic code" comment generated some controversy. So > here's something in my defense: I did not intend to "attack" you. > ... > Yes, I like decorators and descriptors. I also

Re: PDF generator decision

2013-05-14 Thread dieter
Christian Jurk writes: > ... > So far I'd like to ask which is the (probably) best way to create PDFs in > Python (3)? It is important for me that I am able to specify not only > background graphics, paragaphs, tables and so on but also to specify page > headers/footers. The reason is that I h

Re: Generating multi-part emails

2013-05-15 Thread dieter
Steven D'Aprano writes: > I wish to generate some test data for a program that deals with emails. I > need something that can produce multi-part emails, including "broken" > emails that violate email standards, especially when it comes to Unicode. I would start producing legal messages (e.g. w

Re: so if zodb has no index or search, how run fast query?

2013-05-16 Thread dieter
visphatesj...@gmail.com writes: > ... The only service of the ZODB is storing (persistent) objects persistently and providing (almost) transparent acces to them. Persistent objects have a (usually) implicitely managed attribute which contains the object's "object id" and the ZODB can (quite) effici

Re: serialize a class to XML and back

2013-05-24 Thread dieter
Schneider writes: > how can I serialize a python class to XML? Plus a way to get the class > back from the XML? > > My aim is to store instances of this class in a database. In case you want to describe the XML data via an XML-schema (e.g. to exchange it with other applications; maybe via WebSer

Re: authentication with python-ldap

2013-05-24 Thread dieter
avazqu...@grm.uci.cu writes: > import ldap > conn = ldap.initialize("ldap://ldap.uci.cu";) > conn.protocol_version = ldap.VERSION3 > conn.simple_bind_s( "uid=xxx,dc=uci,dc=cu", "xxx" ) > > Result: > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.7/dist-pac

Re: Ldap module and base64 oncoding

2013-05-26 Thread dieter
"Joseph L. Casale" writes: > ... > After parsing the data for a user I am simply taking a value from the ldif > file and writing > it back out to another which fails, the value parsed is: > > officestreetaddress:: T3R0by1NZcOfbWVyLVN0cmHDn2UgMQ== > > > File "C:\Python27\lib\site-packages\ldif.p

Re: Debugging memory leaks

2013-06-12 Thread dieter
writeson writes: > ... > Anyway, my real question is how to go about debugging memory leak problems in > Python, particularly for a long running server process written with Twisted. > I'm not sure how to use heapy or guppy, and objgraph doesn't tell me enough > to locate the problem. Analysin

Re: Any speech to text conversation python library for Linux and mac box

2013-06-12 Thread dieter
Ranjith Kumar writes: > I'm looking for speech to text conversation python library for linux and > mac box, I found few libraries but non of them supports any of these > platform. > I found following libraries speech, dragonfly and pyspeech supports only > windows and sphinx for linux. You will

Re: Debugging memory leaks

2013-06-14 Thread dieter
Chris Angelico writes: > ... > It's terrible advice in generality, because it encourages a sloppiness > of thinking: "Memory usage doesn't matter, we'll just instruct people > to reset everything now and then". "Memory usage" may matter. But if you loose 1 kb a day, your process can run 3 years

Re: Debugging memory leaks

2013-06-15 Thread dieter
Chris Angelico writes: > ... > Right. Everything needs to be scaled. Everything needs to be in > perspective. Losing 1 kilobit per day is indeed trivial; even losing > one kilobyte per day, which is what I assume you meant :), isn't > significant. But it's not usually per day, it's per leaking act

Re: Memory usage steadily going up while pickling objects

2013-06-15 Thread dieter
Giorgos Tzampanakis writes: > ... > So it seems that the pickle module does keep some internal cache or > something like that. This is highly unlikely: the "ZODB" (Zope object database) uses pickle (actually, it is "cPickle", the "C" implementation of the "pickle" module) for serialization. The "

Re: Finding all instances of a string in an XML file

2013-06-20 Thread dieter
Jason Friedman writes: > I have XML which looks like: > > > > > > > > > > > > > > > > > The "Property X" string appears twice times and I want to output the "path" > that leads to all such appearances. You could use "lxml" and its "xpath" support.

Re: Dealing with ' (suds)

2013-06-21 Thread dieter
Ombongi Moraa Fe writes: > I'm working with suds to send send messages to smsc. I've notices the > messages with ' are really not processed on my side (which could mean > an error occurs somewhere - most probably in my php script). SMSC has also > asked that I 'take care of the '' as it's the rea

Re: UnpicklingError: NEWOBJ class argument isn't a type object

2013-07-07 Thread dieter
skunkwerk writes: > Hi, > I'm using a custom pickler that replaces any un-pickleable objects (such as > sockets or files) with a string representation of them, based on the code > from Shane Hathaway here: > http://stackoverflow.com/questions/4080688/python-pickling-a-dict-with-some-unpicklab

Re: AMQP listening and user-facing daemon

2013-07-09 Thread dieter
Justin Chiu writes: > What is the best approach to writing a concurrent daemon that can > execute callbacks for different types of events (AMQP messages, parsed > output of a subprocess, HTTP requests)? I fear your question is too specific (which means you must investigate yourself). First of a

Re: Is PyArg_ParseTuple necessary to parse arguments?

2013-01-22 Thread dieter
rahulgar...@gmail.com writes: > Or can I just loop through the argument tuple manually by using something > like PyTuple_GET_ITEM(args,i), then putting manual code to convert the > objects to appropriate C type? If you like you can do the "parsing" yourself. -- http://mail.python.org/mailman/

Re: XML validation / exception.

2013-01-25 Thread dieter
Andrew Robinson writes: > On xml.etree, > When I scan in a handwritten XML file, and there are mismatched tags -- > it will throw an exception. > and the exception will contain a line number of the closing tag which > does not have a mate of the same kind. > > Is there a way to get the line numbe

Re: Cancel threads after timeout

2013-01-26 Thread dieter
hyperboreean writes: > Here's the use case I want to implement - I have to generate a report > from multiple database servers. This report should be generated every 2 > hours. Sometimes it happens that a query on one of the database servers > takes longer than expected and impedes the generation

Re: CamelCase vs. all-lowercase package names

2013-02-02 Thread dieter
Rhubarb Sin writes: > PEP-8 calls for "short, all-lowercase names" for packages: > > http://www.python.org/dev/peps/pep-0008/#package-and-module-names This is mainly to support case insensitive file systems (and file systems with quite limited path length). With mixed case, some packages/modules

read() does not read new content on FreeBSD/OpenBSD/OSX

2011-06-16 Thread Dieter
leep 1 done The reader: import time import os f=open("./file", "r") while True: print "filelen %d, tell %d, read: %d" % ( os.fstat(f.fileno()).st_size, f.tell(), len(f.read())) time.sleep(1.0) On Linux: dieter@linuxbox$ python reader.py f

Re: read() does not read new content on FreeBSD/OpenBSD/OSX

2011-06-16 Thread Dieter
oh, I forgot the versions: Mac OS X 10.6.7, python 2.6.1 OpenBSD 4.8, python 2.6.5 FreeBSD 8.0, python 2.6.4 dieter -- http://mail.python.org/mailman/listinfo/python-list

Re: non-standard glibc location

2017-09-07 Thread dieter
"Fetchinson . via Python-list" writes: > I'm trying to install a binary package (tensorflow) which contains > some binary C extensions. Now my system glibc is 2.15 but the binaries > in the C extensions were created (apparently) with glibc 2.17. So I > thought no problemo I installed glibc 2.17 t

Re: Why do we nned both - __init__() and __new__()

2017-09-08 Thread dieter
Andrej Viktorovich writes: > For my understanding both - __init__() and __new__() works like constructors. > And __new__() looks is closer to constructor. __init__() is more for variable > initialization. Why I can't just initialize in __init__() ? > > class ExampleClass(object): > def __ne

Re: Merge pdf files using information from two files

2017-09-08 Thread dieter
accessnew...@gmail.com writes: > I have two files (right now they are spreadsheets but I can export them to > any format). > > File1 has StoreID (unique) in one column and a pdf map location in the second > column. (Names not really sequenced numerically) > > 1 C:/maps/map1.pdf > 2 C:/ma

Re: mutiprocessing gui

2017-09-12 Thread dieter
Antoon Pardon writes: > When one wants to combine multithreading and gui programming > all sorts of issues arise. So I wonder how one might combine > multiprocessing with gui programming. > > gui libraries typically have some registration mechanisme, > where you can register a call back for when d

Re: windows 8 versus urllib2 certificate verify

2017-09-12 Thread dieter
Robin Becker writes: > I have an application built on 32 bit windows 7 with python 2.7.10. > The application runs fine on windows 7 and older windows machines, but > it is failing to connect properly using urllib2 when run on windows 8. > > The error CERTIFICATE_VERIFY_FAILED indcates this is som

Re: Creating a python client for an external service advice

2017-09-14 Thread dieter
ivan77 writes: > I would like to create a Python module/client library for a data > visualization service that I use (and will be using more) as my first larger > contribution to open source Python. What kind of service is this "data visualization service"? Is it a library, destined to be linke

Re: speech_to_text python command not working

2017-09-18 Thread dieter
"pizza python" writes: >I'm on Linux Mint 18.2 Cinnamon 64-bit. > >I am trying to get IBM Watson BlueMix Speech-To-Text to transcribe my >spoken-word audio files. Because I'm not a coder, I tried to find the >simplest way to use BlueMix Speech-to-Text. And what I found >is [1]h

Re: How to share class relationship representations?

2017-09-20 Thread dieter
Leam Hall writes: > On 09/19/2017 11:16 AM, Stefan Ram wrote: >> leam hall writes: >>> I'm working on designing the classes, sub-classes, and relationships in my >>> code. What is a good visual way to represent it so it can be stored in git >>> and shared on the list without large images or attac

Re: Sharing code between different projects?

2017-09-27 Thread dieter
> On Monday, August 13, 2012 at 7:53:32 PM UTC+3, andrea crotti wrote: >> I am in the situation where I am working on different projects that >> might potentially share a lot of code. >> >> I started to work on project A, then switched completely to project B >> and in the transiction I copied ove

Re: Distributing multiple packages with on setup.py

2017-09-29 Thread dieter
Jimmy Thrasibule writes: > ... > Is it possible, still keeping one unique ``setup.py`` file, to create > 3 independent packages? > > * ``myproj.common`` > * ``myproj.subpackage1`` > * ``myproj.subpackage2`` > > Also I'd like to specify that when installing ``myproj.subpackage1``, > ``myproj.common

Re: python multiprocessing

2017-10-09 Thread dieter
Xristos Xristoou writes: > I have three functions in the python that each one puts an image (image path) > as input and makes a simple image processing and creates a new image (image > path) as output. In order to make effective use of multiprocessing, you need to split your complete task into

Re: Return str to a callback raise a segfault if used in string formating

2017-10-13 Thread dieter
Thomas Jollans writes: > On 2017-10-13 11:07, Vincent Vande Vyvre wrote: >> Le 13/10/17 à 09:23, Chris Angelico a écrit : >>> On Fri, Oct 13, 2017 at 4:46 PM, Vincent Vande Vyvre > ... > If you have custom C code, it's likely that there is a memory management > problem there. It's not unusual for

Re: Return str to a callback raise a segfault if used in string formating

2017-10-15 Thread dieter
Vincent Vande Vyvre writes: > Le 14/10/17 à 15:59, Stefan Behnel a écrit : > ... > Thanks, I know Cython but the code is already in C. > > This is a lib released as a frontend.  Then usable only in command line. This does not prevent the use of "Cython". In fact, one of its use cases is the creat

Re: right list for SIGABRT python binary question ?

2017-10-18 Thread dieter
Karsten Hilbert writes: > ... > When run under "normal" py2.7 it runs all the way through but > upon shutdown (*after* sys.exit(0)) faulthandler shows a > problem (and returns 134 which made me think of SIGABRT): > > *** Error in `python': free(): invalid pointer: 0x00770b14 *** This indica

Re: right list for SIGABRT python binary question ?

2017-10-21 Thread dieter
Karsten Hilbert writes: > ... > So here's the final console output of that: > ... > Debug memory block at address p=0x717b7c: API '' > 0 bytes originally requested > The 3 pad bytes at p-3 are not all FORBIDDENBYTE (0xfb): > at p-3: 0x03 *** OUCH >

Re: choice of web-framework

2017-10-23 Thread dieter
Patrick Vrijlandt writes: > ... > The project is completely new, there are no histories to take into > account (current solutions are paper-based). The website involves > questionnaires that will be developed, filled out and stored. Users > are not programmers or developers. They should be > authe

Re: Modern website

2017-10-23 Thread dieter
Andrew Z writes: > I realize the following has little todo with python per se. But i hope to > get a guidance on how these types of tasks are done nowadays. > > The task: > Ive been asked to create an integration process. That is a few webpages > with questioneer with the submission to a "mother"

Re: right list for SIGABRT python binary question ?

2017-11-01 Thread dieter
Karsten Hilbert writes: > On Sat, Oct 21, 2017 at 09:31:54AM +0200, dieter wrote: >> It points to a memory corruption. > While running valgrind and friends is beyond my capabilitis I > have run the problem through gdb to at least obtain a stack > trace to see what gi

Re: Objects with __name__ attribute

2017-11-01 Thread dieter
"ast" writes: > I know two Python's objects which have an intrinsic name, classes and > functions. > ... > Are there others objects with a __name__ attribute > and what is it used for ? Some Python objects naturally have a name: functions, classes, modules, ...; others don't: tuples, lists, integ

Re: Let's talk about debuggers!

2017-11-01 Thread dieter
Thomas Jollans writes: > I just wanted to know what tools everyone used for debugging Python > applications - scripts / backend / desktop apps / notebooks / whatever. > Apart from the usual dance with log files and strategically inserted > print() calls, that is. > > Of course we all know and mild

Re: right list for SIGABRT python binary question ?

2017-11-02 Thread dieter
Karsten Hilbert writes: >> >> It points to a memory corruption. >> >> The i386/x64 architecture supports memory access breakpoints >> and GDB, too, has support for this. You know the address which >> gets corrupted. Thus, the following apporach could have a chance >> to succeed: >> >>Put a "

Re: right list for SIGABRT python binary question ?

2017-11-02 Thread dieter
Karsten Hilbert writes: > ... > I have posted backtraces taken from the address being > watched. Does that help any at all ? Only in the case that the error is "local", i.e. detected (quite) immediately. You might be in this case as you have observed that the address is stable after library prel

Re: Share unpickleable object across processes

2017-11-03 Thread dieter
Israel Brewster writes: > I have a Flask/UWSGI web app that serves up web socket connections. When a > web socket connection is created, I want to store a reference to said web > socket so I can do things like write messages to every connected > socket/disconnect various sockets/etc. UWSGI, ho

Re: How to maintain same permissions on python dist-package after upgrade?

2017-11-16 Thread dieter
Debraj Manna writes: > I am using a python package patroni version 1.0 on Ubuntu 14. On doing ls > -lrt /usr/local/lib/python2.7/dist-packages/ I am seeing the permission > like below > > drwxr-sr-x4 root staff 4096 Nov 6 14:29 patroni > drwxr-sr-x2 root staff 4096 Nov 6 14:29 pat

Re: reading text in pdf, some working sample code

2017-11-21 Thread dieter
Daniel Gross writes: > I am new to python and jumped right into trying to read out (english) text > from PDF files. > > I tried various libraries (including slate) You could give "pdfminer" a try. Note, however, that it may not be possible to extract the text: PDF is a generic format which works

Re: Save and load initialized class

2017-12-09 Thread dieter
Bob van der Poel writes: > I'm trying to something simple (yeah, right). Mainly I want to have a bunch > of variables which my program needs and uses to be in a saveable/loadable > block. Currently I have then all as a bunch of globals which works, but > trying to keep track of them and the corre

Re: Can't install wrapt on Windows

2017-12-10 Thread dieter
Cutter writes: > ... > I have trouble installing pylint on Windows 10, Python 3.6. There's a > problem during the installation of wrapt, which is a dependency of > pylint. > > Here are the contents of the commandline: > >> C:\WINDOWS\system32>python -m pip install pylint >> ... >> Collecting wrapt

Re: request fails on wikipedia (https) - certificate verify failed (_ssl.c:748)

2017-12-11 Thread dieter
F Massion writes: > ... > I would like to get information from Wikipedia articles and I am testing the > connection to Wikipedia. > > I am running Python 3.6.2 on Windows 10. > > I get certificate errors for all pages with https. > Any suggestions are welcome! > ... > self._sslobj.do_handsh

Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-16 Thread dieter
Piyush Verma <114piy...@gmail.com> writes: > Getting SSL error while connecting from httplib.HTTPSConnection. > > Any help would be appreciated. > ... > line 579, in __init__ > self.do_handshake() > File > "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", > lin

Re: ssl.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol

2017-12-17 Thread dieter
Piyush Verma <114piy...@gmail.com> writes: > Yes Dieter, I see that it is connecting with 443 port number and service is > running. Is this related to python version or mac? It might be. Python does not perform the SSL handling itself but delegates it to an external SSL library (&q

Re: Problems with imports on multiple threads, with embedded Python

2018-01-04 Thread dieter
geoff.ba...@gmail.com writes: > I have a multithreaded application using an embedded Python 3.6.4 (upgraded > from 3.6.2 today in the hope that the problem was now solved: it doesn't seem > to be). The standard library is in a zip file. So long as only one thread is > running Python at a time i

Re: Regarding the error: TypeError: can�t pickle _thread.lock objects

2018-01-04 Thread dieter
Winston Manuel Vijay writes: > It would be of immense help, if someone could provide a suitable solution or > related information that helps to sort out the below stated issue- > > > Ø I had installed the Python version 3.6.4 > > Ø Then I installed the package: Tensorflow > > Ø Installed g

Re: python server socket file transfer

2018-01-09 Thread dieter
bingbong3...@gmail.com writes: > how much client can i handel whit this code what the amount of client that i > can handel > the size of the file is 716 kb > ... > self.sock.send(l) Please read the documentation for *send* in the "socket" module: it tells you that "send" (in contrast to "sendall"

Re: python server socket file transfer

2018-01-10 Thread dieter
bingbong3...@gmail.com writes: > On Wednesday, January 10, 2018 at 9:07:33 AM UTC+2, dieter wrote: >> bingbong3...@gmail.com writes: >> > how much client can i handel whit this code what the amount of client that >> > i can handel >> > the size of the file is

Re: exec and traceback

2018-01-23 Thread dieter
ken...@gameofy.com writes: > I'm using exec() to run a (multi-line) string of python code. If an > exception occurs, I get a traceback containing a stack frame for the > string. I've labeled the code object with a "file name" so I can > identify it easily, and when I debug, I find that I can inter

Re: xpath prob, was Re: Why is there no functional xml?

2018-01-24 Thread dieter
> Rustom Mody wrote: > >> With >> # Read above xml > with open('soap_response.xml') as f: inp = etree.parse(f) >> # namespace dict > nsd = {'soap': "http://schemas.xmlsoap.org/soap/envelope/";, 'locns': > "http://example.com/"} >> >> The following behavior is observed $(G!7(B actual

Re: Package containing C sources

2018-01-30 Thread dieter
Victor Porton writes: > I am going to create a Python wrapper around a generally useful C library. > So the wrapper needs to contain some C code to glue them together. > > Can I upload a package containing C sources to PyPi? You can. This is documented in "https://docs.python.org/2/extending/b

Re: Dependency injection: overriding defaults

2018-01-31 Thread dieter
Victor Porton writes: > I am writing a library, a command line utility which uses the library, and a > I am going to use dependency_injector package. > > Consider loggers: > > For the core library the logger should default to stderr. > > For the command line utility, we use the default logger of

Re: Dependency injection: overriding defaults

2018-02-01 Thread dieter
Kushal Kumaran writes: > Victor Porton writes: >> dieter wrote: > ... >>> I would distinguish between the common library and distinct >>> applications (command line utility, daemon). The applications >>> configure the logging system (differently) while the

Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-01 Thread dieter
nav...@emagevisionpl.com writes: > I have to make an application in which, > > The user asks a question, Google's API is used to convert the speech to text. > But the problem is due to different accent the translator misunderstands the > words. > I want my application to guess the word to the

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

2018-02-01 Thread dieter
jlada...@itu.edu writes: > ... > Let me ask those of you who are not using Google Groups: how do you search? > In my experience, searching through mailing list archives has been poor. I am using "gmane.org" which has quite a good search (in my view). Not sure, whether "gmane.org" hosts "your" ne

Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-03 Thread dieter
Steven D'Aprano writes: > On Fri, 02 Feb 2018 08:14:03 +0100, dieter wrote: > >>> The user speaks "Light". The system translates it as "Bright" The user >>> speaks "White" The system translates it as "Bright" >> >&g

Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-04 Thread dieter
"Peter J. Holzer" writes: > On 2018-02-03 09:34:57 +0100, dieter wrote: > ... > The difficulty is to *recognise* it correctly. Was that tangle of sound > waves an "l" or an "r"? This not as unambiguous as you seem to think. > So a speech-to-text

Re: Help on PyImport_Import(pNAme)

2018-02-04 Thread dieter
Jason Qian via Python-list writes: > This only works when loading modules from the current directory. > Is there a way I can load from somewhere else ? Have a look at the module `importlib` and especially its function `import_module`. Python knows about two forms of "import": "absolute imp

Re: libxml2 installation/binding issue with Python 3.6.4

2018-02-05 Thread dieter
"Priest, Matt" writes: > ... > I've successfully (?) installed Python 3.6.4 and libxml2, with the ultimate > goal of installing GTK+ 3.22.0. You might also try "lxml" - which is an alternative for "libxml2". > However, I'm running into this error: > ... > import libxml2mod > ImportError: >

Re: How to work on a package

2018-02-06 Thread dieter
Roel Schroeven writes: > I'm fairly comfortable writing Python code, but I only have experience > writing scripts with perhaps a few supporting modules. Now I want to > start writing a package, and I'm feeling a bit helpless: I'm not sure > how to organize my work. You may have a look at "https:/

Re: How to set/update value in a xml file using requests in python

2018-02-06 Thread dieter
Sum J writes: > My xml file is located in local network : > http://192.168.43.109/DevMgmt/NetAppsDyn.xml > > Below is a part content of above xml I want to update : > > > > > off > > > I want to set value for 'ResourceUI' and 'Port' field in above xml. > I have used below

Re: How to work on a package

2018-02-07 Thread dieter
Roel Schroeven writes: > dieter schreef op 7/02/2018 8:21: > ... >> Likely, there are many ways to execute tests for your package. > >> I am using "setuptools" for packaging (an extension >> of Python's standard "disutils"). Its "setup.py&

Re: Extracting data from ython dictionary object

2018-02-08 Thread dieter
Stanley Denman writes: > I am new to Python. I am trying to extract text from the bookmarks in a PDF > file that would provide the data for a Word template merge. I have gotten > down to a string of text pulled out of the list object that I got from using > PyPDF2 module. I am stuck on now to

Re: atws

2018-02-22 Thread dieter
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), telling you that the "atws" package wants to log a message but there is not corresponding logging handler

Re: Questions about `locals` builtin

2018-02-26 Thread dieter
Kirill Balunov writes: > I am a little bit confused with `locals` builtin in these moments: > > 1. The documentation says that _free varaibles_ are returned, which seems > incorrect description. In my mind the term free variable refers to > variables used in a function that are not local variables

Re: Questions about `locals` builtin

2018-02-27 Thread dieter
Kirill Balunov writes: > 2018-02-27 2:57 GMT+03:00 Terry Reedy : > >> The point of point 3 is that terminology and details would likely be >> different if Python were freshly designed more or less as it is today, and >> some things only make more or less sense in historical context. Learn what >>

Re: Questions about `locals` builtin

2018-02-27 Thread dieter
Ned Batchelder writes: > On 2/27/18 3:52 AM, Kirill Balunov wrote: >> a. Is this restriction for locals desirable in the implementation of >> CPython in Python 3? >> b. Or is it the result of temporary fixes for Python 2? > > My understanding is that the behavior of locals() is determined mostly

Re: In Python2, does it need to wrap imp.find/load_module with imp_acquire/release_lock?

2018-02-27 Thread dieter
Xiang Zhang writes: > Just like the title. It seems to me it is needed from the source code but > codes in stdlib all doesn't do that. The "import" machinery uses locks of its own (to protect "sys.modules"). I assume that "load_module" will use those locks internally. "find" might be considere

Re: RFC: Proposal: Deterministic Object Destruction

2018-02-28 Thread dieter
Rick Johnson writes: > ... > Can you provide a real world example in which you need an > object which circularly references _itself_? Circular structures occur in real life. One example are tracebacks (which are very helpful for debugging reasons). Keeping a traceback in a variable can easily in

Re: Strange problem with pip2

2018-03-01 Thread dieter
Cecil Westerhof writes: > There are three pip2 packages that should be updated: > apsw (3.13.0.post1) - Latest: 3.9.2.post1 [sdist] > mysql-utilities (1.6.4) - Latest: 1.4.3 [sdist] > pygobject (3.22.0) - Latest: 3.27.4 [sdist] > > But the strange thing is that the installed version i

Re: Send Msg To Specific Tcp Client from Tcp Server Python

2016-08-10 Thread dieter
Anil reddy reddy M writes: > I was written a simple tcp server in python, which is nicely communicating > with multiple tcp clients. My Tcp Server can accept multiple clients at time, > each client as a new thread. I want send message to specific tcp client after > some time. > I can client Ad

Re: Knowing which thread had the GIL before

2016-08-25 Thread dieter
Julien Kauffmann writes: > ... > Is there a way to know which thread had the GIL right before my > profiling thread acquired it ? Perhaps through a C extension ? I've > seen such profilers for Linux that take advantage of an ITIMER signal > to do that. Sadly this is not an option on Windows. As y

Re: importing down in code rather than at top of file.

2016-08-30 Thread dieter
Tobiah writes: > Is it worth while to defer the import of a large module that seldom > gets used in the script? > > > import sys > import os > > if hardly_ever_happens(): > > import large_module > large_module.do_task() I have used de

Re: Variables visibility for methods

2016-08-31 Thread dieter
"ast" writes: > ... > So it seems that when an object's méthod is executed, variables > in the scope outside the object's class can be read (2nd example), > but not variables inside the class (1st example). > > For 1st example, I know that print(MyClass.a) or print(self.a) > would have work. > > A

Re: C Python extension to export an Function

2016-09-01 Thread dieter
Ganesh Pal writes: > Iam pretty new to C Python extension , I was able to export few simple > modules to python and it look like the cool thing to do ... Maybe, it is a good idea to have a look at "cython". "cython" is a compiler. It translates Python code enhanced with special annotations into

Re: C Python extension to export an Function

2016-09-01 Thread dieter
Ganesh Pal writes: > ... > Thanks stefan and Gollwitzer , good to know there are many ways to do this > i.e via cython or SWIG but the C/Python API > is probably the most widely used method > - not for it’s simplicity but for the fact that you can manipulate

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-07 Thread dieter
"Alexander N. Moibenko" writes: > when I build a binary with python 2.6 it builds without any problem. > When I build with python 2.7 the build fails after warnings like: > /opt/python/Python-2.7.12/Modules/posixmodule.o: In function > `posix_tempnam': > /opt/python/Python-2.7.12/./Modules/posixmo

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-08 Thread dieter
"Alexander N. Moibenko" writes: > In fact I tried issuing commands manually, but they did not give me > any hint more than I already had. When I remember right, then "gcc" has an option to show details about the calling of the phase commands ("gcc" is a coordinating programm delegating the real w

Re: How to diagnose CERTIFICATE_VERIFY_FAILED on Windows for websites working in browsers?

2016-09-08 Thread dieter
Chi Hsuan Yen writes: > ... > Apparently OpenSSL verifies the whole certificate chain and > report an error as soon as it finds an invalid certificate in the chain. As it must, if you require verification. When I remember right, you can disable the verification altogether (though you should not

Re: How to diagnose CERTIFICATE_VERIFY_FAILED on Windows for websites working in browsers?

2016-09-08 Thread dieter
Chi Hsuan Yen writes: > ... > Thanks a lot! I just lost my direction when trying to understand how > certificate verification works in Python. It sets things up for "OpenSSL" and then delegates all details to it. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to extend a tuple of tuples?

2016-09-09 Thread dieter
"Frank Millman" writes: > Hi all > > This should be easy, but I cannot figure it out. > > Assume you have a tuple of tuples - > > a = ((1, 2), (3, 4)) > > You want to add a new tuple to it, so that it becomes - > >((1, 2), (3, 4), (5, 6)) > > The obvious way does not work - > > a += (5, 6) >

Re: How to diagnose CERTIFICATE_VERIFY_FAILED on Windows for websites working in browsers?

2016-09-10 Thread dieter
Chi Hsuan Yen writes: > ... > I found that OpenSSL provides an X509 callback hook that allows clients to > know why the verification process fails. For a long time, Python 2 (unlike Python 3) did not perform certificate validation at all. As a consequence, some developpers provided the functional

Re: Mysterious Logging Handlers

2016-09-10 Thread dieter
Josh English writes: > I have a Python script that imports a utility script. Both scripts use > logging, but the logs don't work as advertised. I'm getting logging output > from the utility script but none from the main file. Worse, the format of the > utility script's logs don't match anything

Re: collect2: ld returned 1 exit status when building from source

2016-09-12 Thread dieter
Steve D'Aprano writes: > ... > but the build still fails, with the same errors: > > > Python/dtrace_stubs.o: In function `PyDTrace_LINE': > /home/steve/python/python-dev/cpython/Include/pydtrace.h:25: multiple > definition of `PyDTrace_LINE' > Python/ceval.o:/home/steve/python/python-dev/cpython/I

Re: Global variable is undefined at the module level

2016-09-13 Thread dieter
Daiyue Weng writes: > Hi, I defined a global variable in some function like this, > > def some_function(self): > > global global_var > > PyCharm inspection gave me, > > Global variable is undefined at the module level > > How to fix this? You define the global variable at the module level.

Re: ‘pip2 install cryptography’ does not work

2016-09-15 Thread dieter
Cecil Westerhof writes: > I try to do a: > pip2 install cryptography > > But this give: > gcc -pthread -shared > build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o > -L/usr/lib64 -lssl -lcrypto -lpython2.7 -o > build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/_op

Re: Functions Of Functions Returning Functions

2016-09-18 Thread dieter
Lawrence D’Oliveiro writes: > The less code you have to write, the better. Less code means less > maintenance, and fewer opportunities for bugs. While I agree with you in general, sometimes less code can be harder to maintain (when it is more difficult to understand). Some time ago, we had a (qu

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

2016-09-20 Thread 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 uses reference counting to determine when an object can be deleted (and then reclai

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

2016-09-21 Thread dieter
dl l writes: > I understood call PyGC_collect to release object cycles. But in my python > test code, seems there is NO reference cycle on the Simple object in the > python test code. Why needs to call PyGC_Collect() here? > > = > > class Sim

Re: PyThreadState_Get

2016-09-24 Thread dieter
Bharadwaj Srivatsa writes: > Which ever project I am trying to install using python setup.py install > command, i am getting the following error.. > > python -mtrace --trace setup.py install > Fatal Python error: PyThreadState_Get: no current thread > ABORT instruction (core dumped) > > How to g

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

2016-09-27 Thread dieter
dl l writes: > 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? "gc" is a module. You can import and access modules from the C API. Thus, you can use "gc.get_referers" from "C" cod

  1   2   3   4   5   6   7   8   9   10   >