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

2019-05-18 Thread Markus Elfring
> socketserver threading model is that the main server loops waiting for > connection requests, when it receives a request it creates a handler thread, This data processing style can be generally fine as long as you would like to work without a thread (or process) pool. > and then it completely

Re: Import module from a different subdirectory

2019-05-18 Thread Rich Shepard
On Sun, 19 May 2019, Peter J. Holzer wrote: This won't help much if your directory named "business-tracker" (see above). Peter, et al.: Yep. User error. The directory is actually 'business_tracker' and I used the application name, 'bustrac', instead when I set PYTHONPATH. Discovered this a bi

Re: Import module from a different subdirectory

2019-05-18 Thread Peter J. Holzer
On 2019-05-18 09:43:34 -0700, Rich Shepard wrote: > The project layout, briefly, is: > > ~/development/business-tracker/ > classes/ > gui/ > > All subdirectories contain a __init__.py file to identify them as packages. > 'classes/' contains model.py; '

Re: Import module from a different subdirectory

2019-05-18 Thread Piet van Oostrum
Rich Shepard writes: > > $ python3 > Python 3.7.3 (default, Mar 26 2019, 06:40:28) [GCC 5.5.0] on linux > Type "help", "copyright", "credits" or "license" for more information. import sys sys.path > ['', '/home/rshepard/development/bustrac', '/usr/lib/python37.zip', > '/usr/lib/python3.

Re: Import module from a different subdirectory

2019-05-18 Thread Rich Shepard
On Sat, 18 May 2019, Peter J. Holzer wrote: "" is in sys.path, so "classes" and classes.model are found. Now lets go to a different subdirectory: This doesn't work, since there is no classes/model.py in "", only in "..". But if I add a PYTHONPATH, it works again: Peter, The project layout,

Re: Import module from a different subdirectory

2019-05-18 Thread Peter J. Holzer
On 2019-05-18 05:45:23 -0700, Rich Shepard wrote: > On Sat, 18 May 2019, dieter wrote: > > > > sys.path > ['', '/home/rshepard/development/bustrac', '/usr/lib/python37.zip', > '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', > '/usr/lib/python3.7/site-packages'] > > All directories are pres

Re: Import module from a different subdirectory

2019-05-18 Thread Rich Shepard
On Sat, 18 May 2019, dieter wrote: Test this by looking at "sys.path" instead: import sys sys.path It is "sys.path" which actually controls the import machinery. Dieter, Thank you. I missed this when researching PYTHONPATH. Here's what I get: sys.path ['', '/home/rshepard/development/bus

Re: Instance vs Class variable oddity

2019-05-18 Thread jfong
Chris Angelico於 2019年5月18日星期六 UTC+8下午3時09分37秒寫道: > On Sat, May 18, 2019 at 1:51 PM wrote: > > > > Correct me if I am wrong, please. > > > > I always think that the LEGB rule (e.g. the namespace to look up for) was > > applied at compile-time, only the binding was resolved "dynamically" at > > ru

Re: Instance vs Class variable oddity

2019-05-18 Thread Chris Angelico
On Sat, May 18, 2019 at 1:51 PM wrote: > > Correct me if I am wrong, please. > > I always think that the LEGB rule (e.g. the namespace to look up for) was > applied at compile-time, only the binding was resolved "dynamically" at > run-time. For example: > > def foo(): > print(x) > > foo() wi