Re: Is it dangeous when using custom metaclass?

2018-10-16 Thread dieter
jf...@ms4.hinet.net writes: > Gregory Ewing at 2018/10/16 UTC+8 PM 2:01:01 wrote >> jf...@ms4.hinet.net wrote: >> > class Structure(metaclass=StructureMeta): ... >> > >> > class PolyHeader(Structure): ... >> > >> > As my understanding, the metaclass's __init__ was called when a class was >> > cre

Re: Is it dangeous when using custom metaclass?

2018-10-17 Thread dieter
jf...@ms4.hinet.net writes: > ... > Hard to find the document of type.__init__. I can only guess it does nothing, > at least no thing serious, to avoid trouble the metaclass's __init__ may > cause in a class hierarchy:-) You always have the possibility to look at the source. All classes have co

Re: recommends of redesign OO feature of python !!!

2018-10-24 Thread dieter
iamybj--- via Python-list writes: > I am an engineer of java and c#, I want to some personal projects in free > time, and I choose python. > > After try python, I hava some suggestion. > > The first thing is that python’s class is not well designed than other > programming languages. > Using di

Re: how can I solve this problem simply and clearly

2018-11-08 Thread dieter
lampahome writes: > I have two categories A,B, and A has 2 items A1,A2, and B have 2 items B1, > B2. > > I have two class A and B, and A will handle A1,A2, B handle B1,B2. > > I want to parse one of A1,A2,B1,B2 to script and generate the corresponding > class(object). > > Ex: Both in class A and B

Re: Finding .so files without setting LD_LIBRARY_PATH

2016-05-12 Thread dieter
Paul Smith writes: > ... > That works fine, but here's the problem: because LD_LIBRARY_PATH is in > Python's environment it is also passed down to programs invoked by > Python. That means if I (for example) invoke subprocess.call(['ssh', > ...]) then it fails because the system ssh is looking for

Re: Design: Idiom for classes and methods that are customizable by the user?

2016-05-13 Thread dieter
Dirk Bächle writes: > ... > My questions > > > - Is this a good approach, that I could use for other parts of the > architecture as well, e.g. the Node class mentioned above? You might look at the "adpater" pattern. It is heavily used in Zope - and there looks something like: *

Re: Performance with and without the garbage collector

2016-05-17 Thread dieter
Steven D'Aprano writes: > ... > Is anyone able to demonstrate a replicable performance impact due to garbage > collection? I have had some experience with the performance impacts of garbage collection -- not completely replicable but rather frequently visible. Huge Zope instance (with around 2 G

Re: Python and GPSD

2016-05-23 Thread dieter
John McKenzie writes: > I need help using the Python bindings for GPSD. Specifically, I would > like to take a latitude reading, put it in a variable and use it later. > The problem is that every example I see involves constantly taking > changing readings. That part I have working for myself

Re: Setting Return-Path in email

2016-05-24 Thread dieter
ragav s writes: > How can i add different Return-path and fromid in python.i have pasted the > below code for preview Note that there are two different return paths associated with an email exchange: one on the protocol level (SMPT - RFC821); the other at the message level. The one on the proto

Re: [smtplib] how to assure login was succesful?

2016-05-25 Thread dieter
maurice writes: > Once my python script reaches the point where I login in my email account > with: server.login(username,password) (where server server = > smtplib.SMTP('smtp.office365.com:587')), it returns a tuple like this: > > (235, > '2.7.0 Authentication successful target host [address h

Re: Manipulate GIL to have Python thread work with pthread native ones

2016-06-01 Thread dieter
qshh...@alumni.sjtu.edu.cn writes: ... Python/C++ integration ... When I learn about a task to integrate Python with C or C++, I first think of "cython". "cython" facilitates those integrations. Especially, it has annotations to control the GIL. I have used "cython" for the implementation of a Py

Re: Spread a class over multiple files

2016-06-06 Thread dieter
Mark Summerfield writes: > Sometimes I want to spread a class over multiple files. When I run into such a use case, I use (multiple) inheritance -- with "mixin class"es. Each "mixin class" handles some important aspect and is only loosely coupled with maybe a common base class and the other asp

Re: Design an encrypted time-limited API on Client/Server side

2016-06-09 Thread dieter
iMath writes: > ?I am planning design an encrypted time-limited API on both Client and Server > sides, the server side is written in Django, the client side is a GUI program > which call the API by > import requests > c = requests.post("http://127.0.0.1:8000/VideoParser/";, data={'videoUrl': >

Re: loading trees...

2016-06-13 Thread dieter
Fillmore writes: > Hi, problem for today. I have a batch file that creates "trees of data". > I can save these trees in the form of python code or serialize them with > something > like pickle. > > I then need to run a program that loads the whole forest in the form of a > dict() > where each i

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread dieter
alanquei...@gmail.com writes: > I'm trying to override methods inherited from a superclass by methods defined > in a mixin class. > Here's an sscce: > https://bpaste.net/show/6c7d8d590658 (never expires) > > I've had problems finding the proper way to do that, since at first the base > class was

Re: Cassandra multiprocessing can't pickle _thread.lock objects

2016-06-21 Thread dieter
Daiyue Weng writes: > ... > I tried to use Cassandra and multiprocessing to insert rows (dummy data) > concurrently based on the examples in > ... > self.pool = Pool(processes=process_count, initializer=self._setup, > initargs=(session,)) > > I am wondering how to resolve the issue. "pickle" is u

Re: Which one is the best XML-parser?

2016-06-23 Thread dieter
David Shi via Python-list writes: > Which one is the best XML-parser? "best" is not an absolute term but depends on criteria/conditions. There are essentially two kinds of parsers: incremental parsers which parse the structure and report events for everything they see and non-incremental parse

Re: I seem to be creating a dict that I cannot access the keys of

2016-06-25 Thread dieter
Sayth Renshaw writes: > ... > Can I ask is there something obvious wrong, i have left the commented other > versions in they "work" in that they all produce the same output the print > whole file. > The code below is obviously wrong - it is surprising that you get anything other than an excepti

Re: program return killed after run a very long time

2016-06-25 Thread dieter
meInvent bbird writes: > i suspect it use so much memory, > > however i have already assign 30GB memory in openstack cloud > > is there any command to allow python to use more memory? > > currently > > program return killed after run a very long time Usually, there are memory limits at various l

Re: I seem to be creating a dict that I cannot access the keys of

2016-06-27 Thread dieter
Sayth Renshaw writes: >> The code below is obviously wrong - it is surprising that you get >> anything other than an exception. See comments below inserted into >> your code. >> >> > def parseXML(): >> > ... >> > result = etree.tostring(tree.getroot(), pretty_print=True) >> >> "resul

Re: Meta decorator with parameters, defined in explicit functions

2016-06-28 Thread dieter
Ben Finney writes: > I want an explicit replacement for a common decorator idiom. > > There is a clever one-line decorator that has been copy-pasted without > explanation in many code bases for many years:: > > decorator_with_args = lambda decorator: lambda *args, **kwargs: lambda > func: dec

Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions

2016-07-01 Thread dieter
Peter Otten <__pete...@web.de> writes: > Lawrence D’Oliveiro wrote: > >> On Tuesday, June 28, 2016 at 5:03:08 PM UTC+12, Ben Finney wrote: >> >>> I would like to see a more Pythonic, more explicit and expressive >>> replacement with its component parts easily understood. >> >> I don’t know why t

Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions

2016-07-02 Thread dieter
Ben Finney writes: > ... > Rather, the motivation was that a complex thing, with many moving parts, > has an unexplained implementation: a nested set of functions without > names to explain their part in the pattern. In a previous reply, I have tried to explain (apparently without success) that t

Re: super and mix-in class: how exactly is the search order altered?

2016-07-02 Thread dieter
"Veek. M" writes: > ... > I'm reading this article: > https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ > > He's trying to explain the purpose of a 'mix-in class' and he says > > We did not alter the source code for LoggingDict. Instead we built a > subclass whose only logi

Re: JAR files into python

2016-07-02 Thread dieter
Joaquin Alzola writes: > ... > The error that it throws is the following one (which is logical because I do > not load the jar files): > py4j.protocol.Py4JJavaError: An error occurred while calling o29.load. > : java.lang.ClassNotFoundException: Failed to find data source: > org.apache.spark.sql

Re: Making Classes Subclassable

2016-07-04 Thread dieter
Lawrence D’Oliveiro writes: > Some of the classes in Qahirah, my Cairo binding > I found handy to reuse elsewhere, for > example in my binding for Pixman . > Subclassing is easy, but then you need to ensure that operations

Re: Gzip module does not support Unix compressed .Z files [SEC=UNOFFICIAL]

2016-07-04 Thread dieter
"Owen Brandon" writes: > I have a query regarding the support of decompression for Unix compressed .Z > files in Python's gzip module. The gzip system utility supports this using > the '-d' switch, but the python module does not. When I am right, then the "zipfile" module handles ".Z" compress

Re: Making Classes Subclassable

2016-07-05 Thread dieter
Lawrence D’Oliveiro writes: > On Monday, July 4, 2016 at 7:58:07 PM UTC+12, dieter wrote: >> --> "type(obj)" or "obj.__class__" (there are small differences) >> give you the type/class of "obj". > > When would it not be the same? Special pro

Re: Need help compiling Python-devel

2016-07-05 Thread dieter
TM writes: > I have successfully compiled Python-2.7.12 on AIX 6.1 TL09, using steps > below. However I need the python-devel library/headers. How do I compile > Python, so that I can use this? The distinction between "python" and "python-devel" is not a Python notion but one of package manageme

Re: TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-30 Thread dieter
Terry Reedy writes: > ... >> The problem seems to come from my expectation that a file >> is its own iterator and in python3 that is no longer true >> for a NamedTemporaryFile. > ... >> Should this be considered a bug? > > No. The doc for NamedTemporaryFile does not even claim that the > return i

Re: SOAP and Zeep

2016-07-30 Thread dieter
Ethan Furman writes: > I may have a need in the immediate future to work with SOAP and WSDL > services, and a quick search > turned up Zeep (http://docs.python-zeep.org/en/latest/) -- does anyone have > any experience with it? > Or any other libraries that can be recommended? I am using "suds"

Re: make an object read only

2016-08-03 Thread dieter
Robin Becker writes: > A reportlab user found he was doing the wrong thing by calling canvas.save > repeatedly, our documentation says you should not use Canvas objects after > the > save method has been used. The user had mixed results :( > > It would be better to make the canvas object compl

Re: Python Error message

2016-08-05 Thread dieter
GBANE FETIGUE writes: > ... > I am running a python script to run some CURL commands, and return the > response which is the applicationId and the versionId. I was able to do it. > Now the versionId value supposed to be used on the second CURL as a value of > the applications key which is an ar

Re: passing value from Python3 script back to RewriteMap MapType prg in Apache24

2018-11-12 Thread dieter
Benedikt Kroll writes: > Hi, > > using a Python script as a Rewrite Map with MapType prg in Apache 2.4, I'm > having trouble > passing the value back to Apache. > > The log says "map lookup OK", but the value is empty. > > According to the Apache documentation > (https://httpd.apache.org/docs/

Re: Cannot find reference 'bluetoothctl' in 'sh.py' less... (Ctrl+F1)

2018-11-14 Thread dieter
srinivasan writes: > As am newbie to python, I am planning to automate BT functionality test > using Bluez "bluetoothctl" utility by writing python wrapper and robot > framework integrated with Jenkins > ... > *$ pip3 install bluetoothctl* > *Collecting bluetoothctl* > * Could not find a version

Re: Unable to install Python on my windows 8 PC

2018-11-14 Thread dieter
Prospero Akai writes: > I forgot to check the 'Add To Path' box while installing python from > www.python.org. I uninstalled then try to install again but I have been > getting this error message since then: > > one or more issues caused the setup to fail. please fix the issues and then > retry se

Re: Basic pynomo instructions not working

2018-11-21 Thread dieter
Adam Funk writes: > I'm trying to use the basic stuff in pynomo > > > > which I've installed with pip3, but I run into this problem trying to > the basic stuff in the documentation: > > #v+ > $ python3 > Python 3.6.7 (default, Oct 22 2018, 11:32:17) > [GCC 8.2.

Re: Question about implementing immutability

2018-11-21 Thread dieter
Iwo Herka writes: > Let's say I want to implement immutability for user-defined class. > More precisely, a class that can be modified only in its (or its > super-class') __init__ method. My initial idea was to do it the > following fashion: > > def __setattr__(self, *args, **kwargs): >

Re: Python-remove duplicate output

2018-11-21 Thread dieter
drvucano...@gmail.com writes: > How to remove duplicate lines and store output into one ine I do not understand "into one ine". > ... > Current Output: > aws-opsworks > aws-opsworks Ansible > > Desired output: > aws-opsworks Ansible Looks for me as if you do not want to remove duplicate lines:

Re: Unrecognised Arguments

2018-12-02 Thread dieter
fergalbell Bell writes: > I have been running twitterscraper yesterday with no real problems > encountered. I came home and tried to run a twitterscraper command in cmd > $(G!9(B without success. > > It said the following for these arguments: -bd 2015-01-01 -ed 2016-01-01 > $(G!9(Blang en u

Re: Creating type evaluation annotation

2018-12-06 Thread dieter
Marek Mosiewicz writes: > ... > I know that Python 3 has possibility to have indicate > type for varibale or param > What could be great to have possibility to annotate any > class with what I call "type evaluator" function. > That could check method signature with rules specific  > for given typ

Re: Help - Python REST API

2018-12-13 Thread dieter
Afriyie Abraham Kwabena writes: > Am trying to create a basic authorization server using client credentials > flow and client so that the > client can send it credentials using REST methods (POST) to the authorization > server. Authrization server then > respond with access token. After the acc

Re: Help - Python REST API (war: Python-list Digest, Vol 183, Issue 13)

2018-12-13 Thread dieter
Afriyie Abraham Kwabena writes: > ... > Thanks for the reply maybe I did not explain myself very well but is it > possible to apply this scenario to a database server like MySQL where I can > write some python code to post, get, delete, etc to the database? However the > client (python code I h

Re: pickle and module versioning

2018-12-18 Thread dieter
Neal Becker writes: > ... > Has anyone else run into this issue People who use the "ZODB" (= "Zope Object DataBase") are familiar with it. > and have any ideas? There are things, you must not do. In the "ZODB" case, for example, you must not change whether the class inherits from "persistent.Pe

Re: Variable number of arguments

2018-12-18 Thread dieter
F Massion writes: > My script is used by a web interface which gets some parameters from a form. > The parameters are passed on as arguments like this: > > (...) > def start(self, _Inputfile ,_Outputfile ,_Stopwordsfile) > > As long as the number of arguments is set (i.e. 3), there are no problems

Re: Why do data descriptors (e.g. properties) take priority over instance attributes?

2018-12-18 Thread dieter
Paul Baker writes: > When Python looks up an attribute on an object (i.e. when it executes > `o.a`), it uses an interesting priority order [1]. It looks for: > > 1. A class attribute that is a data-descriptor (most commonly a property) > 2. An instance attribute > 3. Any other class attribute >

Re: setup.py, how to find main program/module?

2018-12-18 Thread dieter
ant writes: > ... > yet not quite all the way yet. i run the > commands to make the sdist and wheels and upload > it using twine to my test account, but when > i install it and try to run it the ngfp.py is > not found (i've also tried nfgp and main). > ... > i suspect i've not really underst

Re: ah, progress...

2018-12-19 Thread dieter
ant writes: > ant wrote: > ... >> (env) me@ant(26)~/src/test$ ngfp >> Traceback (most recent call last): >> File "/home/me/src/env/bin/ngfp", line 7, in >> from ngfp import main >> ImportError: cannot import name 'main' from 'ngfp' >> (/home/me/src/salsa/env/lib/python3.7/site-packages/ngf

Re: ah, progress...

2018-12-20 Thread dieter
ant writes: > ... > in order to get this far below i had to edit each > file and put a try: except: around each import > statment checking if the module could be found > like (as an example): > > try: > import config as cfg > except: > import frog.config as cfg Is "frog" the package, yo

Re: python package management confusion

2019-01-14 Thread dieter
dcs3spp via Python-list writes: > I am a newbie completely confused with python package management. > > I have a setup.py file (listed below) and have setup pip and setup.cfg to > install my own dependencies from a local devpi repository. > > Can setup.py reference a git repository so that I can

Re: Tracemalloc overhead when profiling

2019-01-14 Thread dieter
Juris __ writes: > I was looking for a way to profile memory usage for some script which > deals with log message parsing. Looking through Python's stdlib I > stumbled upon tracemalloc module. So I tried my hand on profiling my > script. A few things I noticed that I am not 100% sure I can expl

Re: AssertionError without traceback?

2019-01-14 Thread dieter
Israel Brewster writes: > I have a flask application deployed on CentOS 7 using Python 3.6.7 and uwsgi > 2.0.17.1, proxied behind nginx. uwsgi is configured to listed on a socket in > /tmp. The app uses gevent and the flask_uwsgi_websockets plugin as well as > various other third-party modules,

Re: python package management confusion

2019-01-15 Thread dieter
dcs3spp via Python-list writes: > ... > So to manage the development of private packages, e.g. wheels, I would have > to use my own private repository (something like devpi or a an alternative > cloud pypi subscription service) to store each private dependency that I have > written. No, you do

Re: python package management confusion

2019-01-16 Thread dieter
dcs3spp via Python-list writes: > ... > How do I configure python setup.py develop to pull the pyramid_core dependent > packages using virtualenv? Your "setup.py" below should work (once, you have removed the ""). If the "pyramid" package correctly declares its dependencies, then the "pyrami

Re: python package management confusion

2019-01-17 Thread dieter
dcs3spp via Python-list writes: > ... > How do I configure setuptools to pull my own private dependency package using > virtualenv + python setup.py develop You call "python setup.py develop" for your own package (which the "python" from the virtualenv). This makes your package (more precisely

Re: python package management confusion

2019-01-18 Thread dieter
dcs3spp via Python-list writes: > On Friday, 18 January 2019 07:39:00 UTC, dieter wrote: > ... > My situation is similar to the following > > Assume the following two privately developed projects that I have written, > each with their own setup.py: > 1. parent exists in

Re: How to access a folder in a zip file?

2019-01-20 Thread dieter
mignoncharly via Python-list writes: > I'm a newbie in python and I was trying to access a folder inside a zip file > and I also have issues with relative and absolute path. Thks in advance. > > In projects there a lot of urls (i'll read them later one by one and store > them in a list/array so

Re: Error while using suds: suds.TypeNotFound: Type not found

2019-01-20 Thread dieter
prakashsharmac...@gmail.com writes: > ... > I want to consume the web services described in the following: > > https://login.keyinvoice.com/API3_ws.php?wsdl > > I am using python 3.5.x and suds version 0.6. What I tried 1 > > from suds.client import Client > url = 'https://login.keyinvoice.com/API3

Re: How to force the path of a lib ?

2019-01-22 Thread dieter
Vincent Vande Vyvre writes: > I am working on a python3 binding of a C++ lib. This lib is installed > in my system but the latest version of this lib introduce several > incompatibilities. So I need to update my python binding. > > I'm working into a virtual environment (py370_venv) python-3.7.0 i

Re: What is your experience porting Python 2.7.x scripts to Python 3.x?

2019-01-22 Thread dieter
"Schachner, Joseph" writes: > ... > For anyone who has moved a substantial bunch of Python 2 to Python 3, can > you please reply with your experience? It can be simple and it can be difficult. I have found "http://python-future.org/compatible_idioms.html"; especially useful. > Did you run in

Re: Problem : Generator

2019-02-14 Thread dieter
Prahallad Achar writes: > How to implement reverse generator A generator generates a sequence of values. The notion "reverse generator" suggests that you have a sequence of values and want to produce it in reverse order. This is not always possible. Consider: def natural(): i = 0 while True

Re: Problem : Generator

2019-02-15 Thread dieter
Prahallad Achar writes: > I get list object instead gen obj If you have a list "l" and want a generator, you can use ( x for x in l) or simpler "iter(l)" - which gives you an interator over "l". An "iterator" is slightly more general than a generator (every generator is also an iterator).

Re: "How to package additional files under site-packages "

2019-03-04 Thread dieter
Saba Kauser writes: > ... > I want data_files to be copied under my package install path. > How do I achieve this? You could look at one of my packages (i.e. "dm.*", e.g. "dm.pdb"). Essentially, I have the data files besides the Python sources and let "setuptools" determine the relevant files (s

Re: "How to package additional files under site-packages "

2019-03-05 Thread dieter
Saba Kauser writes: > ... > My package (ibm_db) has LICENSE, README.md and CHANGES files that I want to > be available in the same location as my package is installed I.e under > site-packages. However, with current setup.py > https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setu

Re: subprocess svn checkout password issue

2019-03-15 Thread dieter
Martin De Kauwe writes: > I'm trying to write a script that will make a checkout from a svn repo and > build the result for the user. However, when I attempt to interface with the > shell it asks the user for their filename and I don't know how to capture > this with my implementation. > > us

Re: Library for parsing binary structures

2019-03-28 Thread dieter
Paul Moore writes: > I'm looking for a library that lets me parse binary data structures. > The stdlib struct module is fine for simple structures, but when it > gets to more complicated cases, you end up doing a lot of the work by > hand (which isn't that hard, and is generally perfectly viable,

Re: Library for parsing binary structures

2019-03-28 Thread dieter
Paul Moore writes: > On Thu, 28 Mar 2019 at 08:15, dieter wrote: > ... > My real interest is in whether any > libraries exist to do this sort of thing (there are plenty of parser > libraries for text, pyparsing being the obvious one, but far fewer for > binary structures)

Re: Prepare accented characters for HTML

2019-03-28 Thread dieter
Tony van der Hoff writes: > I have a MariaDB database, which contains accented (mostly French) > characters. I need to display these on an HTML page. I'm using the Jinja > templating engine. Why do you (still) need this? HTML is prepared to work all over the world - even in Asia where few charact

Re: Understanding the MRO with multiple inheritance

2019-03-29 Thread dieter
Arup Rakshit writes: > I basically had defined 4 classes. SimpleList be the base class for all the > other 3 classes. SortedList and IntList both being the child of the base > class SimpleList. They have a single inheritance relationship. Now I have the > last class called SortedIntList which h

Re: Why inspect.isclass says iter() a class?

2019-04-10 Thread dieter
Arup Rakshit writes: > From docs https://docs.python.org/3/library/itertools.html#itertools.chain I > see that itertools.chain is defined as a function. Maybe, it would have been better to state that "chain" is a "callable": something which can be called on arguments. For many people, "callable

Re: pip unable to find an extension of a lib.

2019-04-11 Thread dieter
Vincent Vande Vyvre writes: > ... > Using Python-3.7.2 (compiled with --with-pydebug) in a venv, I've > encountered this problem: > > $ pip install --upgrade pip setuptools wheel > > Successfully installed setuptools-41.0.0 wheel-0.33.1 > --- > ... > $ pip install

Re: Importing module from another subdirectory

2019-04-17 Thread dieter
Rich Shepard writes: > What is the proper syntax to import the model class in the model/ > subdirectory into a tkinter view module, e.g., activities.py? The syntax, > 'import model as m' fails because it is not in the same subdirectory as the > importing module. > > The program directory tree is:

Re: Questions on Instance methods

2019-04-19 Thread dieter
Arup Rakshit writes: >>When an instance method object is created by retrieving a class method >> object from a class or instance, its __self__ attribute is the class itself, >> and its __func__ attribute is the function object underlying the class >> method. > > Here I have 2 questions: >

Re: Python running issues

2019-04-19 Thread dieter
Kiranpreet Kaur writes: > I am trying to run python from command prompt. However, cannot get past the > error: “ImportError: no module named site” Your Python installation is severely broken. I cannot tell you why. I would try a reinstallation (and see whether the problem disappears). If the pr

Re: Questions on Instance methods

2019-04-22 Thread dieter
Arup Rakshit writes: > ... > As you saw from documentation link, those are just words kind of spec. > Which source you recommend to read which explains these concepts more with > example codes. I cannot help you much with this -- I am much turned towards spec[ification] like documentation and ha

Re: Importing module from another subdirectory

2019-04-22 Thread dieter
Rich Shepard writes: > On Thu, 18 Apr 2019, dieter wrote: > ... >> 2. extend "sys.path" in your scripts to contain the "bustrac" folder >> (before you try to import infrastructure modules/packages) > > I read the docs for sys and site and have insuffic

Re: Importing module from another subdirectory

2019-04-23 Thread dieter
Rich Shepard writes: > On Tue, 23 Apr 2019, dieter wrote: > ... > One project is for my own use and I understand now that a virtualenv with > its own sys.path appendices would work. Those are two separate approaches: With a "virtualenv", there is usually no need to t

Re: Importing module from another subdirectory

2019-04-24 Thread dieter
Rich Shepard writes: >> bustrac/ >>README.rst >>bustrac.py* >>controller/ >>classes/ > model.py >>scripts/ >>gui/ > test_act_de.py > > test_act_de.py tries to import model.py from the classes package: > from classes import model as m > > Running in bustrac

Re: Running virtualenv to set the ENV

2019-04-24 Thread dieter
Rich Shepard writes: > Which is the CWD for running virtualenv and spcifying the path to the > project's directoy? I mentioned "virtualenv" together with "setuptools". "virtualenv" gives you a (light weight) isolated Python installation (sharing things with the base Python installation). You typ

Re: Why not being able to call modules from lib folder into test folder although I have __init__.py file both?

2019-04-25 Thread dieter
Arup Rakshit writes: > I am not able to call modules from lib folder in my test folder, but outside > of tests folder I can access them. How should I fix this? > > Mocks$ tree . > . > ├── lib > │ ├── __init__.py > │ ├── __pycache__ > │ │ ├── __init__.cpython-37.pyc > │ │ └── product.c

Re: Checking network input processing by Python for a multi-threaded server

2019-04-29 Thread dieter
Markus Elfring writes: > ... > I constructed another multi-threaded TCP server for my needs > (based on the available software documentation). > https://docs.python.org/3/library/socketserver.html#asynchronous-mixins > ... > elfring@Sonne:~/Projekte/Coccinelle/janitor> time /usr/bin/python3 > lis

Re: Get the source of a class reliably?!?

2019-04-29 Thread dieter
"computermaster360 ." writes: > Does anyone have an idea why classes don't contain their definition > line number as functions or methods do? > some_fun.__code__.co_firstlineno > 123 Because classes do not have associated "code" objects. As you see above, it is not the function itself ("so

Re: Checking network input processing by Python for a multi-threaded server

2019-04-30 Thread dieter
Markus Elfring writes: > ... >> As you say to have created a "multi-threaded TCP server", I assume >> that your server spawns a thread for each TCP connection. > > Is this the software behaviour we usually get from > the class “socketserver.ThreadingMixIn”? Look at the source -- and there look es

Re: Checking network input processing by Python for a multi-threaded server

2019-05-01 Thread dieter
Markus Elfring writes: >> https://docs.python.org/3/library/socketserver.html#asynchronous-mixins > An example is provided also in this software documentation. > May I expect that data were completely received from clients and accordingly > processed by the request handler in the started threads

Re: Dynamic selection for network service ports?

2019-05-01 Thread dieter
Markus Elfring writes: > ... >> You can avoid this with the SO_REUSEADDR flag. > > Can such a configuration parameter be used also together with > programming interfaces from the module “socketserver”? The "SO" prefix stands for "SOcket" -- "SO_REUSEADDR" is one of many so called "socket option"s

Re: Python 3.73 cannot install py3exiv2

2019-05-01 Thread dieter
Ken Martell writes: > ... > D:\>pip3 install py3exiv2 > Collecting py3exiv2 > ... >     C:\Program Files (x86)\Microsoft Visual Studio > 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD > -Id:\apps\python37\include -Id:\apps\python37\include "-IC:\Program Files > (x86)\Microsoft

Re: Checking network input processing by Python for a multi-threaded server

2019-05-03 Thread dieter
Markus Elfring writes: > ... > But I am more interested in the detail that a specific Python list variable > should reflect the received record sets from a single test command > in a consistent way. If you have a multi-threaded application and you want to be on the "safe side", you always use you

Re: Checking network input processing by Python for a multi-threaded server

2019-05-05 Thread dieter
Dennis Lee Bieber writes: > On Sat, 4 May 2019 14:17:52 +0200, Markus Elfring > declaimed the following: > ... > If the socketserver module doesn't provide what you need, you are free > to copy socketserver.py to some other file (myserver.py?), and modify it to > fit your needs. And in add

Re: Django Potential Fork Bomb

2019-05-08 Thread dieter
Shakti Kumar writes: > ... > I suspect django spawned too many child processes, and consecutively I ran > out of resources on my dev server. How can I prevent this from happening? > And I am not able to understand why django should spawn (if it indeed is > spawning) incrementing processes with eac

Re: Checking network input processing by Python for a multi-threaded server

2019-05-13 Thread dieter
Markus Elfring writes: > ... > I imagine that it can be easier to depend on a higher level > system infrastructure. > How do you think about to reuse software extensions around > the standard “CORBA” like “omniORB”? I have used "CORBA" in the past. It is nice when you control all cooperating comp

Re: Question :)

2019-05-13 Thread dieter
Milos Vujcic writes: > I am new into Python and Django thing and I am having big problem with cmd > and virtualenv command. For many users, "virtualenv" solves an important problem: it gives them a (virtual) Python installation under their control. There, they can install their own (Python) pac

Re: Import module from a different subdirectory

2019-05-16 Thread dieter
Rich Shepard writes: > I'm developing a Python3 application using Python3-3.7.3 and > virtualenv-16.5.0 on a Slackware-14.2 host. > > The project directory contains subdirectories, including gui/ (with the > tkinter views) and classes/ with the SQLAlchemy model.py. > > Within the gui/ directory as

Re: Import module from a different subdirectory

2019-05-17 Thread dieter
Rich Shepard writes: >> The project directory contains subdirectories, including gui/ (with the >> tkinter views) and classes/ with the SQLAlchemy model.py. > ... > Second, in ~/.bash_profile I added two lines, the first is the project's > root directory: > > PYTHONPATH=$HOME/development/bustrac >

Re: Instance vs Class variable oddity

2019-05-17 Thread dieter
Irv Kalb writes: > ... > The only thing that threw me was that in a line like: > > self.x = self.x + 1 > > in a method, these two uses of self.x can refer to different variables. I > actually teach Python, and this would be a very difficult thing to explain to > students. > > I have never run

Re: PEP 594 cgi & cgitb removal

2019-05-22 Thread dieter
Robin Becker writes: > In PEP 594 t has been proposed that cgi & cgitb should be removed. I > suspect I am not the only person in the world that likes using cgi and > cgitb. Currently, "Zope" is using "cgi"; it uses "zExceptions" (--> PyPI) for tracebacks. Should "cgi" disappear from the standar

Re: pysftp / paramiko problem

2019-06-11 Thread dieter
Robin Becker writes: > I am trying to convert older code that uses ftplib as the endpoint has > switched to sftp only. > > I am using the pysftp wrapper around paramiko. > > The following script fails > > def main(): > import pysftp > with pysftp.Connection('ftp.remote.com', username='me'

Re: pysftp / paramiko problem

2019-06-12 Thread dieter
Robin Becker writes: > On 12/06/2019 05:59, dieter wrote: >> Robin Becker writes: >>> I am trying to convert older code that uses ftplib as the endpoint has >>> switched to sftp only. > ... > Well with real sftp I can cd to that path so if it is a symlink it goe

Re: Random signal capture when using multiprocessing

2019-07-05 Thread dieter
José María Mateos writes: > This is a minimal proof of concept for something that has been bugging me for > a few days: > > So basically I have some subprocesses that don't do anything, just sleep for > a few milliseconds, and I capture SIGTERM signals. I don't expect > ... > Running round

Re: PyPi twine check does not like my README.rst files anymore

2019-07-15 Thread dieter
Barry Scott writes: > I am update some PyPI projects and found that twine was refusing the upload. > ... > Failed > The project's long_description has invalid markup which will not be rendered > on PyPI. The following syntax errors were detected: > line 1: Severe: Unexpected section title or tran

Re: Embedding Python in C

2019-07-17 Thread dieter
Jesse Ibarra writes: > ... > My options seem rather limited, I need to make a Pipeline from (Smalltalk -> > C -> Python) then go back (Smalltalk <- C <- Python). Since Smalltalk does > not support Python directly I have to settle with the C/Python API > (https://docs.python.org/3.6/extending/em

<    1   2   3   4   5   6   7   8   9   10   >