Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-29 Thread Barry Scott
On 22 Apr 2009, at 07:50, Martin v. Löwis wrote: If the locale's encoding is UTF-8, the file system encoding is set to a new encoding utf-8b. The UTF-8b codec decodes non-decodable bytes (which must be = 0x80) into half surrogate codes U+DC80..U+DCFF. Forgive me if this has been covered.

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Barry Scott
On 30 Apr 2009, at 05:52, Martin v. Löwis wrote: How do get a printable unicode version of these path strings if they contain none unicode data? Define printable. One way would be to use a regular expression, replacing all codes in a certain range with a question mark. What I mean by

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Barry Scott
On 30 Apr 2009, at 21:06, Martin v. Löwis wrote: How do get a printable unicode version of these path strings if they contain none unicode data? Define printable. One way would be to use a regular expression, replacing all codes in a certain range with a question mark. What I mean by

Re: Python does not take up available physical memory

2012-10-22 Thread Barry Scott
On 21 Oct 2012, at 15:14, Pradipto Banerjee pradipto.baner...@adainvestments.com wrote: I tried this on a different PC with 12 GB RAM. As expected, this time, reading the data was no issue. I noticed that for large files, Python takes up 2.5x size in memory compared to size on disk, for the

Re: How to call and execute C code in Python?

2012-05-16 Thread Barry Scott
There are many choices rather then raw python C API calls. Boost, PyCXX and ctypes are worth investigating. PyCXX requires you code in C++ but hides lots of the issues of using the Python API from you. It also supports python 2 and 3. Barry - PyCXX maintainer --

Re: How to import Webkit and object in Official Python (not MacPorts python) without X11.

2012-05-26 Thread Barry Scott
On 26 May 2012, at 14:31, Mr.T Beppu wrote: I think that I will make a browser in Official Python (not MacPorts Python). What should I do in order to install Webkit for Official Python (not MacPorts Python) ? from tokyo Japan. -- http://mail.python.org/mailman/listinfo/python-list The

Re: Linux shell to python

2012-07-30 Thread Barry Scott
lspci gets all its information from the files in /sys/bus/pci/devices. You can use os.listdir() to list all the files in the folder and then open the files you want to get the data you need. And of course you can write list comprehensions on as many lines as it take to make the code

Re: Linux shell to python

2012-07-31 Thread Barry Scott
On 30 Jul 2012, at 23:56, Dan Stromberg drsali...@gmail.com wrote: On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott ba...@barrys-emacs.org wrote: lspci gets all its information from the files in /sys/bus/pci/devices. You can use os.listdir() to list all the files in the folder and then open

Re: How to create an instance of a python class from C++

2014-03-11 Thread Barry Scott
On 5 Mar 2014, at 00:14, Bill galaxyblu...@gmail.com wrote: Hello: I can't figure out how to create an instance of a python class from 'C++': Why not use pycxx from http://sourceforge.net/projects/cxx/? This lib does all the heavy lifting for you for both python2 and python3. Has docs

Re: Missing something obvious with python-requests

2013-01-03 Thread Barry Scott
The shipped python library code does not work. See http://bugs.python.org/issue7291 for patches. Barry On 3 Jan 2013, at 18:53, Ray Cote rgac...@appropriatesolutions.com wrote: Hello List: I seem to be missing something obvious in terms of using proxies with the requests module. I'm

Re: Using mktime to convert date to seconds since epoch - omitting elements from the tuple?

2013-01-03 Thread Barry Scott
On 2 Jan 2013, at 08:01, Victor Hooi victorh...@gmail.com wrote: Hi, I'm using pysvn to checkout a specific revision based on date - pysvn will only accept a date in terms of seconds since the epoch. I'm attempting to use time.mktime() to convert a date (e.g. 2012-02-01) to seconds

Re: Forcing Python to detect DocumentRoot

2013-01-19 Thread Barry Scott
On 16 Jan 2013, at 13:51, Ferrous Cranus nikos.gr...@gmail.com wrote: When trying to open an html template within Python script i use a relative path to say go one folder back and open index.html f = open( '../' + page ) How to say the same thing in an absolute way by forcing Python to

Re: python: HTTP connections through a proxy server requiring authentication

2013-01-28 Thread Barry Scott
The shipped python library code does not work. See http://bugs.python.org/issue7291 for patches. Barry -- http://mail.python.org/mailman/listinfo/python-list

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott barry.sc...@onelan.co.uk added the comment: The attached patch builds on Mike's work. The core of the problem is that the Request object did not know what was going on. This means that it was not possible for get_authorization() to work for proxy-auth and www-auth. I change Request

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott barry.sc...@onelan.co.uk added the comment: Attached is the code I used to test these changes. See the README.txt file for details include the results of a test run. -- Added file: http://bugs.python.org/file20822/urllib2_tests.tar.gz

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott barry.sc...@onelan.co.uk added the comment: I left out some white space changes to match the style of the std lib code. Re posting with white space cleanup. -- Added file: http://bugs.python.org/file20824/http_proxy_https.patch ___ Python

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Changes by Barry Scott barry.sc...@onelan.co.uk: Removed file: http://bugs.python.org/file20821/http_proxy_https.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7291

[issue25148] Windows registry PythonCore key changed inconsistent with other releases

2015-09-17 Thread Barry Scott
New submission from Barry Scott: I am used to looking in HKLM:\SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d\InstallPath to find out where python is installed so that my installation kit can add itself to site-packages. I just found that the registry key used for 32 bit python 3.5

[issue25148] Windows registry PythonCore key changed inconsistent with other releases

2015-09-23 Thread Barry Scott
Barry Scott added the comment: To clarify: 3.5 means 3.5 64 bit 3.5-32 means 3.5 32 bit You do not add the -64 as it is the default. However: this change should have been in the "What's New" as it breaks Windows installation code for

[issue26364] pip uses colour in messages that does not work on white terminals

2016-02-15 Thread Barry Scott
New submission from Barry Scott: pip3 (3.5 on Mac OS X) is outputting a message in yellow that I can barely see on a white background terminal. "You are using pip version 7.1.2, however version 8.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command

Announcing SCM Workbench 0.8.5 GUI for Git, Mercurial (hg) and Subversion (svn)

2017-03-22 Thread Barry Scott
SCM Workbench features • Support Subversion (svn), Mercurial (hg) and Git projects. • Easy to learn and use • Built in User Guide describes the operation and features of the application. • Add project wizard can scan for all your existing projects. • All

Announcing SCM Workbench 0.8.6 for Git, Mercurial and Subversion

2017-04-17 Thread Barry Scott
SCM Workbench features • Support Subversion (svn), Mercurial (hg) and Git projects. • Easy to learn and use • Builtin User Guide describes the operation and features of the application. • Add project wizard can scan for all your existing projects. • All

Python3 C extension how to support dir()

2017-04-14 Thread Barry Scott
I have an python3 C++ extension that works. But dir(obj) does not return the list of member variables. How should I support dir() from the C API? I cannot use tp_members, not appropiate to the code I'm writing. If I provide __dir__ I then hit the problem I need the C API version

Re: Why exception from os.path.exists()?

2018-06-10 Thread Barry Scott
> On 10 Jun 2018, at 21:10, Chris Angelico wrote: > > On Mon, Jun 11, 2018 at 12:45 AM, Bev in TX wrote: >>> * One with an embedded / in the file name >> >> This is easily done in Finder, where I created a folder named "my/slash”. >> When I list it at the command line in Terminal, this shows

Re: Why exception from os.path.exists()?

2018-06-11 Thread Barry Scott
> On 11 Jun 2018, at 01:28, Steven D'Aprano > wrote: > > On Sun, 10 Jun 2018 22:09:39 +0100, Barry Scott wrote: > >> Singling out os.path.exists as a special case I do think is reasonable. >> All functions that take paths need to have a consistent response to da

Re: Why exception from os.path.exists()?

2018-06-11 Thread Barry Scott
> On 11 Jun 2018, at 01:03, Chris Angelico wrote: > > On Mon, Jun 11, 2018 at 9:52 AM, Steven D'Aprano > wrote: >> On Mon, 11 Jun 2018 06:10:26 +1000, Chris Angelico wrote: >> >>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal, >>> I'd like to see what their file

Re: Why exception from os.path.exists()?

2018-06-04 Thread Barry Scott
> On 1 Jun 2018, at 14:23, Paul Moore wrote: > > On 1 June 2018 at 13:15, Barry Scott wrote: >> I think the reason for the \0 check is that if the string is passed to the >> operating system with the \0 you can get surprising results. >> >> If \0 was not che

Re: Why exception from os.path.exists()?

2018-06-01 Thread Barry Scott
On Thursday, 31 May 2018 14:03:01 BST Marko Rauhamaa wrote: > Chris Angelico : > > On Thu, May 31, 2018 at 10:03 PM, Marko Rauhamaa wrote: > >> This surprising exception can even be a security issue: > >>>>> os.path.exists("\0") > >> > >>Traceback (most recent call last): > >>

Re: What's up with Activestate Python?

2019-02-18 Thread Barry Scott
> On 18 Feb 2019, at 08:49, Thomas Jollans wrote: > > Anaconda also has its moments, and has some packages that PyPI doesn't > (for my use case, this is primarily PyQt5). Odd I use PyQt5 from PyPI all the time and have for a few years now. Barry --

Re: where is math_sin defined?

2019-02-11 Thread Barry Scott
> On 10 Feb 2019, at 16:43, Chris Angelico wrote: > > On Mon, Feb 11, 2019 at 3:37 AM Barry Scott wrote: >> >> On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: >>> As an aside, how is 'math.sin' actually implemented? mathmodule.c >&g

C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
When I use the C API to get the str() of an execption I see this text: But python reports the following for the same exception: TypeError: unsupported operand type(s) for +: 'int' and 'str' What do I need to do in the C API to get the the same text for the exception? All the

Re: [solved] C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 11:59:16 GMT Barry Scott wrote: > When I use the C API to get the str() of an execption I see this text: > > > > But python reports the following for the same exception: > > TypeError: unsupported operand type(s) for +: 'int' and

Re: where is math_sin defined?

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: > As an aside, how is 'math.sin' actually implemented? mathmodule.c > refers to the function 'math_sin' but that name is not defined > anywhere in the Python source code. I'm a bit mystified as to how > CPython manages to compile! I used

Re: C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 13:58:57 GMT Stefan Behnel wrote: > Barry Scott schrieb am 10.02.19 um 13:08: > > After calling PyObject_GetAttrString() I expected to get a PyObject string > > back but I found that I had been given a instead. > > > > (gdb) p *args_o >

C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
After calling PyObject_GetAttrString() I expected to get a PyObject string back but I found that I had been given a instead. (gdb) p *args_o $4 = What is going on and how do I get from the to the object I want? Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: User failed to install PIP

2019-06-24 Thread Barry Scott
I guess you attached an image of the error message. I also going to guess that you are a windows user. All attachments are stripped on this list. You will need to explain in text what you did and what the error message was. Note that PIP is install when you install python. Have you installed

Re: Difficulties configuring LTO on macOS with clang

2019-07-10 Thread Barry Scott
bin from your PATH does that help configure find the tools it needs? Barry > > Thanks, > Scott > > On Tue, Jul 9, 2019, at 15:39, Barry Scott wrote: >> >> >> > On 9 Jul 2019, at 19:28, Scott Colby wrote: >> > >> > Hello all, >

Re: Using pycurl to obtain the download speed in real-time for a huge file.

2019-08-02 Thread Barry Scott
> On 2 Aug 2019, at 08:37, Hongyi Zhao wrote: > > Hi, > > I want to use pycurl to obtain the download speed in real-time for a huge > file. Is this possible or not? Yes > Any hints on this issue? Google for python pycurl progress Barry > > Regards > -- > .: Hongyi Zhao [

Re: Application Preferences

2019-08-19 Thread Barry Scott
named after your app. You should find the folder by doing a win32 API call to get the value. See getPreferencesDir() in https://github.com/barry-scott/scm-workbench/blob/master/Source/Common/wb_platform_win32_specific.py <https://github.com/barry-scott/scm-workbench/blob/master/Source/Common/wb

Re: Application Preferences

2019-08-20 Thread Barry Scott
> On 19 Aug 2019, at 20:37, Dennis Lee Bieber wrote: > > On Mon, 19 Aug 2019 18:01:17 +, dboland9 via Python-list > declaimed the following: > >> Wow, what happened here? I posted this to the Python discussion group as it >> is a Python question, not an SQL question. That said, I

Announcing Scm Workbench 0.9.3 for Git, Mercurial and Subversion

2019-09-03 Thread Barry Scott
SCM Workbench features • Support Subversion (svn), Mercurial (hg) and Git projects. • Experimental support for Perforce (P4) • Easy to learn and use • Builtin User Guide describes the operation and features of the application. • Add project wizard can scan

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Barry Scott
> On 5 Sep 2019, at 16:18, Random832 wrote: Thanks for taking the time to reply. > > On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: >> The conclusion I reached is that the CVE only applies to client code >> that allows a URL in unicode to be entered. >>

CVE-2019-9636 - Can this be exploit over the wire?

2019-09-04 Thread Barry Scott
I have been looking into CVE-2019-9636 and I'm not sure that python code that works in bytes is vulnerable to this. The "trick" that to make the CVE dangerous assumes that you have a unicode string with \uff03 (FULLWIDTH NUMBER SIGN') that under NFKC turns into '#'. The discussion in

Re: Email messages from grouped email using IMAPClient in Python.

2019-09-12 Thread Barry Scott
> On 12 Sep 2019, at 06:06, Srinivas Pullabhotla wrote: > > Hello, > > I am trying to fetch email messages from a gmail inbox. So, there will be > 1000s of messages sent to Inbox and since they are 1000s, the emails are > grouped 100 per each email item. > > When I tried this method, the

Re: WedWonder: Scripts and Modules

2019-09-12 Thread Barry Scott
> On 11 Sep 2019, at 21:24, DL Neil via Python-list > wrote: > > In this day-and-age do you have a script in live/production-use, which is > also a module? What is the justification/use case? > > (discounting distutils and similar installation tools, or unit testing > methodology) > > >

Re: fileinput module not yielding expected results

2019-09-07 Thread Barry Scott
> On 7 Sep 2019, at 16:33, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > >with fileinput ...: >for line in f: >if fileinput.isfirstline(): >headers = extract_headers(line) >else: >pass # process a non-header

Re: Proper shebang for python3

2019-07-21 Thread Barry Scott
> On 21 Jul 2019, at 08:29, Christian Gollwitzer wrote: > > Am 21.07.19 um 07:31 schrieb Tim Daneliuk: >> On 7/20/19 6:04 PM, Chris Angelico wrote: >>> Are you aware of every systemwide command that happens to be >>> implemented in Python, such that you won't execute any of them while >>> you

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

2019-07-23 Thread Barry Scott
I tried the twine check on Fedora and the test pass. This looks looks like a bug in twine on Windows which I have reported in https://github.com/pypa/twine/issues/476 Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python in C

2019-07-17 Thread Barry Scott
> On 17 Jul 2019, at 16:57, jesse.ibarra.1...@gmail.com wrote: > > I am using Python3.6: > > [jibarra@redsky ~]$ python3.6 > Python 3.6.8 (default, Apr 25 2019, 21:02:35) > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux > Type "help", "copyright", "credits" or "license" for more

Re: Counting Python threads vs C/C++ threads

2019-07-16 Thread Barry Scott
I'm going to assume you are on linux. On 16 Jul 2019, at 18:35, Dan Stromberg wrote: > > I'm looking at a performance problem in a large CPython 2.x/3.x codebase > with quite a few dependencies. > > I'm not sure what's causing the slowness yet. The CPU isn't getting hit > hard, and I/O on the

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

2019-07-16 Thread Barry Scott
> On 16 Jul 2019, at 05:43, dieter wrote: > > 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

Re: Class initialization with multiple inheritance

2019-07-16 Thread Barry Scott
> On 16 Jul 2019, at 01:13, Joseph L. Casale wrote: > > 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

Re: Embedding Python in C

2019-07-18 Thread Barry Scott
> On 17 Jul 2019, at 19:39, Jesse Ibarra wrote: > > On Wednesday, July 17, 2019 at 11:55:28 AM UTC-6, Barry Scott wrote: >>> On 17 Jul 2019, at 16:57, wrote: >>> >>> I am using Python3.6: >>> >>> [jibarra@redsky ~]$ python3.6 >&

Re: super or not super?

2019-07-15 Thread Barry Scott
> On 12 Jul 2019, at 15:12, Paulo da Silva > wrote: > > Hi all! > > Is there any difference between using the base class name or super to > call __init__ from base class? > > class C1: > def __init__(self): > ... > > class C2(C1): > def __init__(self): >

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

2019-07-15 Thread Barry Scott
on https://github.com/barry-scott/namedstruct where you can see the README.rst rendered in full. Where as at https://pypi.org/project/namedstruct/ only the first line is rendered. Checking distribution dist\namedstruct-1.2.1-py3-none-any.whl: warning: `long_description_content_type` missing

Re: Counting Python threads vs C/C++ threads

2019-07-17 Thread Barry Scott
> On 16 Jul 2019, at 20:48, Dan Stromberg wrote: > > > > On Tue, Jul 16, 2019 at 11:13 AM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > I'm going to assume you are on linux. > Yes, I am. Ubuntu 16.04.6 LTS sometimes, Mint 19.1 other times. >

Re: Proper shebang for python3

2019-07-24 Thread Barry Scott
> On 23 Jul 2019, at 00:13, Cameron Simpson wrote: > > Why _any_ modern system has anything other than /bin in the base install > escapes me. In the distant past /sbin and a distinct /usr with its own bin > had their values, but these days? Bah! On fedora its all in /usr these days with

Re: regular expressions help

2019-09-20 Thread Barry Scott
When I'm debugging a regex I make the regex shorter and shorter to figure out what the problem is. Try starting with re.compile(r'm') and then add the chars one by one seeing what happens as the string gets longer. Barry > On 19 Sep 2019, at 09:41, Pradeep Patra wrote: > > I am using python

Re: pathlib

2019-10-02 Thread Barry Scott
> On 2 Oct 2019, at 09:14, DL Neil via Python-list > wrote: > > On 2/10/19 12:52 AM, Rhodri James wrote: >> On 01/10/2019 06:03, DL Neil via Python-list wrote: >>> On 30/09/19 9:28 PM, Barry Scott wrote: >>>>> On 30 Sep 2019, at 05

Re: Synchronous and Asynchronous callbacks

2019-09-29 Thread Barry Scott
> On 29 Sep 2019, at 14:14, Eko palypse wrote: > > Unfortunately, I can't make all callbacks synchronous or asynchronous because > this has negative effects on the application in one way or another. Surely you can make all callbacks async? You do not have to have them wait, they can

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 12:51, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > On 9/30/19 4:28 AM, Barry Scott wrote: >>> On 30 Sep 2019, at 05:40, DL Neil via Python-list >>> wrote: >>> Should pathlib reflect changes it has

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 14:20, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's the wording I read. I inferred that "path-handling operations > which don't actually access a filesystem" meant an object that didn't > necessarily represent an actual file, and that "provide

Re: Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 14:17, Paul Moore wrote: > > How does this compare to the existing appdirs module on PyPI? > I did not know about appdirs. It does not seem to have separate read vs. save paths. Required for XDG specification where a path of config folder is defined. On 1st run the

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 16:49, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> > wrote: > > That's an interesting question. If you phrase the question like > that, then you're right: expecting a string to track the content > of a file is a mistake. > > In the totality of a Path object

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 09:55, Peter Otten <__pete...@web.de> wrote: > > DL Neil via Python-list wrote: > >> Should pathlib reflect changes it has made to the file-system? >> >> >> Sample code, below, shows pathlib identifying a data-file and then >> renaming it. Yet, after the rename

Re: Synchronous and Asynchronous callbacks

2019-09-30 Thread Barry Scott
> On 29 Sep 2019, at 21:41, Eko palypse wrote: > > Am Sonntag, 29. September 2019 19:18:32 UTC+2 schrieb Barry Scott: >>> On 29 Sep 2019, at 14:14, Eko palypse wrote: >>> >>> Unfortunately, I can't make all callbacks synchronous or asynchronous &

Re: pathlib

2019-09-30 Thread Barry Scott
> On 30 Sep 2019, at 05:40, DL Neil via Python-list > wrote: > > Should pathlib reflect changes it has made to the file-system? I think it should not. A Path() is the name of a file it is not the file itself. Why should it track changes in the file system for the name? Here is code to

Announcing config-path an OS independent configuration file paths

2019-09-30 Thread Barry Scott
See https://pypi.org/project/config-path/ for documentation. Install using pip: python -m pip install config-path I write tools that run on macOS, Unix and Windows systems. Each operating system has its own conventions on where config files should be stored. Following the conventions is

Announcing colour-text and colour-print

2019-09-30 Thread Barry Scott
See https://pypi.org/project/colour-text/ for documentation with colourful examples. Install using pip: python -m pip install colour-text Many command line tools now colour there output to make it easier to pick out important details. I want to do the same for my commands that I tend

Re: Difficulties configuring LTO on macOS with clang

2019-07-09 Thread Barry Scott
> On 9 Jul 2019, at 19:28, Scott Colby wrote: > > Hello all, > > I am having difficulty building Python with `--with-lto` on macOS 10.14.5. > With a clean checkout of the CPython source at the tagged release for 3.7.4, > I ran: > > $ ./configure --prefix=/opt/python3.7.4

Re: unable to import pip installed packages and modules in python 3.7.3

2019-07-09 Thread Barry Scott
If you included an image of the screen it was striped from your email. Use the mouse to select the text in the cmd window and paste that into the email. Show the command you issued and all the messages it prints. There i no need for upper case text. Barry > On 9 Jul 2019, at 17:13, pro_ bro

Re: Friday finking: TDD and EAFP

2019-11-05 Thread Barry Scott
> On 1 Nov 2019, at 05:40, DL Neil via Python-list > wrote: > > Is the practice of TDD fundamentally, if not philosophically, somewhat > contrary to Python's EAFP approach? > > > TDD = Test-Driven Development > EAFP = it's easier to ask forgiveness than permission > * WebRefs as footnote

Re: How to delay until a next increment of time occurs ?

2019-11-17 Thread Barry Scott
> On 13 Nov 2019, at 22:36, Dietmar Schwertberger > wrote: > > On 13.11.2019 23:20, Dennis Lee Bieber wrote: >> For Windows it may require coding a busy-wait sleep function using the >> high-performance counter and computing a counter value (modulo?) on which >> to exit the loop. >

Re: Launching a Script on the Linux Platform

2019-11-17 Thread Barry Scott
> On 12 Nov 2019, at 20:24, Wildman via Python-list > wrote: > > Yes, I prefer to envoke env in the shebang line instead of > depending on the path. Paths can change especially in a > multi-user system but env will always know where to find > the executable. The path to python will not

Re: Using Makefiles in Python projects

2019-11-10 Thread Barry Scott
> On 10 Nov 2019, at 00:09, Skip Montanaro wrote: > > (Sorry, not 100% sure of the credit for this quote, Vitaly, perhaps?) > If your software runs on Windows, of you think it might run on Windows in the future, maybe consider writing simple Python scripts for

Re: strptime for different languages

2019-12-17 Thread Barry Scott
> On 17 Dec 2019, at 10:37, Ulrich Goebel wrote: > > Hi, > > I need to interpret a date string to get a datetime object. That should be > done with strptime from the module datetime. > > But I don't know enough about the locale settings from where the date sting > comes. Actually the

Re: Zipapp can't find sqlite db

2019-12-07 Thread Barry Scott
> On 7 Dec 2019, at 10:07, dieter wrote: > > Abdur-Rahmaan Janhangeer writes: >> I'm using zipapp to include a gui + db >> >> __main__.py >> dbs/ >>file.db >> >> When packaging, the db is there. When querying through sqlalchemy, it says >> can't open db file. Help appreciated! > > I

Re: Unicode filenames

2019-12-07 Thread Barry Scott
> On 6 Dec 2019, at 18:17, Bob van der Poel wrote: > > I have some files which came off the net with, I'm assuming, unicode > characters in the names. I have a very short program which takes the > filename and puts into an emacs buffer, and then lets me add information to > that new file

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-05 Thread Barry Scott
> On 3 Dec 2019, at 01:50, Richard Damon wrote: > > On 12/2/19 4:25 PM, Barry Scott wrote: >> >>> On 2 Dec 2019, at 17:55, Rob Gaddi >>> wrote: >>> >>> On 12/2/19 9:26 AM, Chris Clark wrote: >>>> Test case: >>

Re: Setting Pythonpath programmatic

2019-12-16 Thread Barry Scott
> On 14 Dec 2019, at 16:00, Prasad Rajassekaran > wrote: > > 0 > > > Aim:- > > I would want to set python path programmatic in my project. So that, all > other directories files can be imported without any issues. > > Problem statement:- > > I used to add all the folders & sub-folders

Re: Instantiating sub-class from super

2019-10-16 Thread Barry Scott
> On 14 Oct 2019, at 21:55, DL Neil via Python-list > wrote: > > Is there a technique or pattern for taking a (partially-) populated instance > of a class, and re-creating it as an instance of one of its sub-classes? The pattern I know is to use a factory function to choose between a

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Barry Scott
> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: > > On 12/2/19 9:26 AM, Chris Clark wrote: >> Test case: >>import array >>array.array('L', [0]) >> # x.itemsize == 8 rather than 4 >> This works fine (returns 4) under Windows Python 3.7.3 64-bit build. >> Under

Re: Get __name__ in C extension module

2019-10-07 Thread Barry Scott
> On 7 Oct 2019, at 00:44, Ian Pilcher wrote: > > On 10/6/19 12:55 PM, Barry Scott wrote: >> Then the answer to your question is simple. Do it in python and passt >> logger into the C++ module. > > Funny thing, that's exactly where I started this journey. I could

Re: Get __name__ in C extension module

2019-10-07 Thread Barry Scott
> On 7 Oct 2019, at 04:34, MRAB wrote: > > On 2019-10-07 00:38, Ian Pilcher wrote: >> On 10/6/19 11:55 AM, MRAB wrote: >> > Don't you already have the module's name? You have to specify it in the > >> > PyModuleDef struct that you pass to PyModule_Create. >> >> I do. Perhaps I'm trying to

Re: Get __name__ in C extension module

2019-10-08 Thread Barry Scott
> On 7 Oct 2019, at 00:44, Ian Pilcher wrote: > > On 10/6/19 12:55 PM, Barry Scott wrote: >> Then the answer to your question is simple. Do it in python and passt >> logger into the C++ module. > > Funny thing, that's exactly where I started this journey. I could

Re: Get __name__ in C extension module

2019-10-06 Thread Barry Scott
> On 5 Oct 2019, at 18:55, Ian Pilcher wrote: > > On 10/4/19 4:30 PM, Ian Pilcher wrote: >> Ideally, I would pass my existing Logging.logger object into my C >> function and use PyObject_CallMethod to call the appropriate method on >> it (info, debug, etc.). > > As I've researched this

Re: pathlib

2019-10-04 Thread Barry Scott
> On 3 Oct 2019, at 13:04, Richard Damon wrote: > > I am not sure that Concrete is really the right term here, but the > beginning of the documentation for Pathlib does sort of define what it > means here: There is a need to describe three ideas. The PurePath The OS Specific PurePath's,

Re: pathlib

2019-10-04 Thread Barry Scott
> On 2 Oct 2019, at 23:58, DL Neil via Python-list > wrote: > > In my mind, I'm wondering if it will come to that (having 'got past' the > original observation/issue, I'm concerned by .rename()'s silent errors, for > example). However, that 'outside' research, eg StackOverflow, shows that

Re: How to improve epoll speed when recv from kernel via netlink?

2019-12-20 Thread Barry Scott
> On 20 Dec 2019, at 04:33, lampahome wrote: > > I tried to receive msg from kernel via netlink of socket. > > And I use epoll to receive netlink events whenever it comes from kernel to > user space. > > But I found the performance is poor e.g. epoll costs 90% time of execution > time after

Re: Simple Python github library to push/pull files?

2020-01-28 Thread Barry Scott
> On 28 Jan 2020, at 16:40, Chris Angelico wrote: > > On Wed, Jan 29, 2020 at 3:38 AM Malcolm Greene wrote: >> >> Any recommendations on a library providing a simple interface to Github > for basic push/pull type of actions? I know there's a native GitHub RESTful > API but wondering if

Re: Pyqt5 help

2020-02-01 Thread Barry Scott
> On 1 Feb 2020, at 12:06, Souvik Dutta wrote: > > I was making a pyqt5 project and I ran into a problem. I want a button in > one window to add a label in another window when clicked upon. But that is > not happening. Now the no. Of labels depend upon something, so I decided to > use a for

Re: Change in behaviour Python 3.7 > 3.8

2020-02-07 Thread Barry Scott
> On 7 Feb 2020, at 05:27, Frank Millman wrote: > > @Barry > I agree that __del__() is rarely useful, but I have not come up with an > alternative to achieve what I want to do. My app is a long-running server, > and creates many objects on-the-fly depending on user input. They should be >

Re: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Barry Scott
> On 11 Feb 2020, at 20:01, Michael Torrie wrote: > > On 2/11/20 4:05 AM, Chris Angelico wrote: >> Or just the recognition that, eventually, technical debt has to be >> paid. > > Speaking about technical debt is certainly fashionable these days. As > if we've somehow discovered a brand new

Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-11 Thread Barry Scott
> On 10 Feb 2020, at 23:01, Python wrote: > > As best I can tell, Python has no means to make use of the system's > timezone info. In order to make datetime "timezone aware", you need > to manually create a subclass of datetime.tzinfo, whose methods return > the correct values for the

Re: [Python-ideas] Re: Enhancing Zipapp

2020-01-08 Thread Barry Scott
> On 8 Jan 2020, at 16:02, Christopher Barker wrote: > > On Wed, Jan 8, 2020 at 1:49 AM Abdur-Rahmaan Janhangeer > wrote: > Have a look at this write up about the horror that is zip file name handling. > >

Re: Python, Be Bold!

2020-01-02 Thread Barry Scott
> On 2 Jan 2020, at 21:17, Abdur-Rahmaan Janhangeer > wrote: > > On Fri, 3 Jan 2020, 01:05 Chris Angelico, wrote: > >> >> They are still FAR better than trying to create a single bloated >> executable that contains everything and magically knows how and when >> to update itself. >> > >

Re: Python, Be Bold!

2020-01-03 Thread Barry Scott
> On 3 Jan 2020, at 02:31, Abdur-Rahmaan Janhangeer > wrote: > > > > On Fri, 3 Jan 2020, 02:50 Barry Scott, <mailto:ba...@barrys-emacs.org>> wrote: > Expect for trivial programs you cannot distribute a single file python exe > for windows. > > You

Re: Friday Finking: Source code organisation

2019-12-30 Thread Barry Scott
> On 28 Dec 2019, at 22:49, Chris Angelico wrote: > > On Sun, Dec 29, 2019 at 9:37 AM DL Neil via Python-list > wrote: >> >> Is it helpful to, and thus, do you have a style/convention for ordering >> the methods within each class in your code? >> >> A major difference however, is that if

Re: Friday Finking: Source code organisation

2019-12-30 Thread Barry Scott
> On 30 Dec 2019, at 15:35, Chris Angelico wrote: > > On Tue, Dec 31, 2019 at 1:47 AM Barry Scott wrote: >> >> >> >>> On 28 Dec 2019, at 22:49, Chris Angelico wrote: >>> >>> On Sun, Dec 29, 2019 at 9:37 AM DL Neil via Python-list >

Re: [Python-ideas] Enhancing Zipapp

2020-01-06 Thread Barry Scott
> On 6 Jan 2020, at 19:34, Abdur-Rahmaan Janhangeer > wrote: > > Note: draft simplified Please cover the pro's and con's of the alernatives that have been raised as comments on this idea, as is usually done for a PEP style document. Also beware that zip file format does not include the

  1   2   3   >