[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith
Change by Malcolm Smith : -- versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue31196> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith
Malcolm Smith added the comment: I think it's unlikely that anyone is depending on the ability to enter blank lines in a "try" block in an InteractiveConsole, especially when blank lines terminate the input in almost every other context. Conversely, everyone who's ever entered a

[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2021-12-01 Thread Malcolm Smith
Malcolm Smith added the comment: I agree that both behaviors are reasonable. However, the InteractiveConsole documentation says it should "closely emulate the behavior of the interactive Python interpreter". Since people are familiar with the native interpreter, any difference i

Re: numpy problem (follow up)

2020-11-29 Thread Malcolm
Hi https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy also has a numpy wheel 1.19.4+vanilla‑cp39‑cp39‑win_amd64.whl "Vanilla is a minimal distribution, which does not include any optimized BLAS libray or C runtime DLLs." Have not tried this. cheers Malcolm On 30/11/2020 7:1

Re: numpy problem (follow up)

2020-11-28 Thread Malcolm
HI Just had the same problem. The solution that worked for me was ( pip uninstall numpy then pip install numpy==1.19.3 The latest update to windows has an error in the BLAS libray causing the error. its a known problem. hope this helps Malcolm On 29/11/2020 10:28 am, Larry Burford

[issue34931] os.path.splitext with more dots

2020-05-28 Thread Malcolm Smith
Malcolm Smith added the comment: > Try for example create/rename .somename.jpg file in Ubuntu. > It is normal image with .jpg extension. You could open it etc. > > You can't use standard python splitext() function to detect extension. Yes you can (Python 3.8.2): >>> sp

Is there a difference between python

2020-04-05 Thread Malcolm Greene
Is there a difference between the following 2 ways to launch a console-less script under Windows? python

[issue33689] Blank lines in .pth file cause a duplicate sys.path entry

2020-03-14 Thread Malcolm Smith
Malcolm Smith added the comment: It's definitely a bug and not a documentation lapse. There's no reason why blank lines should have that effect, and no indication in the code that this was intentional. -- ___ Python tracker <ht

[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE

2020-02-29 Thread Malcolm Smith
Malcolm Smith added the comment: It looks like this has now been done and released. Can the issue be closed? -- nosy: +Malcolm Smith ___ Python tracker <https://bugs.python.org/issue34

[issue34592] cdll.LoadLibrary allows None as an argument

2020-02-10 Thread Malcolm Smith
Malcolm Smith added the comment: This isn't documented, but CDLL(None) is translated to dlopen(NULL), which "causes a search for a symbol in the main program, followed by all shared libraries loaded at program startup, and then all shared libraries loaded by dlopen() with the

Simple Python github library to push/pull files?

2020-01-28 Thread Malcolm Greene
appear to provide support to push/pull files to/from a repo. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Recommendation on best cross-platform encryption package

2020-01-22 Thread Malcolm Greene
crypt data in memory before saving to disk and to read files into memory and decrypt from there using io.BytesIO streams. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-09 Thread Malcolm Greene
Thanks Paul and Dan. @Paul: Yes, it *IS* a bit confusing . Your pip explanation hit the spot. @Dan: Yes, symlinks would be a good work around. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Python 3.6 on Windows - does a python3 alias get created by installation?

2019-10-09 Thread Malcolm Greene
! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Application Preferences

2019-08-19 Thread Malcolm Greene
Folder | +-App INI file Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Application Preferences

2019-08-19 Thread Malcolm Greene
behavior by setting a script specific environment variable or by using a command line switch to point to a different location or config file. We store our preferences in an INI style config file which we've found easier to support when there's problems. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Books for Python 3.7

2019-07-15 Thread Malcolm Greene
Python Cookbook; highly recommended. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: pyodbc -> MS-SQL Server Named Instance ?

2019-07-02 Thread Malcolm Greene
You may need to update your ODBC driver from version 13 to 17.x. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature

2019-07-01 Thread Malcolm Greene
> I am exactly in the "pretty advanced usage": I want to create a zip that > embed numpy. In this case, I have to bundle the C extension. How can I do > that? 1. PyInstaller 2. PyOxide (new technology, may or may not support Numpy) Let us know how you make out.

Re: change spacing to two instead of four with pep8 or flake8?

2019-06-29 Thread Malcolm Greene
> I've also taken to having my files auto-formatted with yapf on save ... @Cameron: Have you considered black at all and if so, what are your thoughts? Thanks, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: pip vs python -m pip?

2019-06-21 Thread Malcolm Greene
quot;pip" to mean the right > thing just as "python" does, but maybe something's cached? I think you're on to something. Running pip as a package (python -m pip) will force the use of the virtual env copy of pip. Running pip as an application vs package may use the system

[issue37362] test_gdb must not fail on "unexpected" messages written into stderr

2019-06-21 Thread Dave Malcolm
Dave Malcolm added the comment: I think when I wrote this I was over-optimistically thinking that we could just add more patterns, but if it's becoming a pain, then your approach looks good to me. -- nosy: +dmalcolm ___ Python tracker <ht

Re: How to force "python -m site" ENABLE_USER_SITE to false?

2019-06-21 Thread Malcolm Greene
> From: Ed Leafe > StackOverflow: > https://stackoverflow.com/questions/25584276/how-to-disable-site-enable-user-site-for-an-environment Thanks Ed! My takeaway from the above article and our path going forward is to explictly force ENABLE_USER_SITE to false via Python's "-s&quo

Re: pip vs python -m pip?

2019-06-21 Thread Malcolm Greene
f python*.exe found via Explorer. This behavior observed across multiple Windows 2016 Enterprise servers and Windows 10 Professional desktops. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

How to force "python -m site" ENABLE_USER_SITE to false?

2019-06-21 Thread Malcolm Greene
tion: When ENABLE_USER_SITE is true, packages can get accidentally installed in user specific Python\Python3XX\site-packages folder, overriding system packages and ... apparently (at least under Windows) ... virtual environment packages as well. Thank you, Malcolm -- https://mail.python.org/mailma

pip vs python -m pip?

2019-06-21 Thread Malcolm Greene
64-bit Python 3.6.8 running on Windows with a virtual environment activated. "pip -v" reports 19.0.3 "python -m pip" reports 19.1.1 Is this behavior by design or a bug? My takeaway is that its better to run "python -m pip ..." vs "pip ..." when runnin

What's the latest best practice on Python project directory layouts?

2019-06-14 Thread Malcolm Greene
sts folder or under each package? 4. Use a src folder or not? If so, where to put above files relative to the src folder? Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Block Ctrl+S while running Python script at Windows console?

2019-03-19 Thread Malcolm Greene
lecting text pausing the running process. Unchecking the Windows console's Quick Edit mode stops this behavior. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Block Ctrl+S while running Python script at Windows console? (solved)

2019-03-18 Thread Malcolm Greene
sure I'm not typing random Ctrl+S keystrokes while working. Thanks again Eryk! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Block Ctrl+S while running Python script at Windows console?

2019-03-18 Thread Malcolm Greene
of my Python script's control. If there's a way to disable this behavior under Windows 10/Windows Server 2016, I'm open to that as well. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Multiprocessing vs subprocess to run Python scripts in parallel

2019-03-12 Thread Malcolm Greene
are launched independent of the parent (manager) process? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Convert Windows paths to Linux style paths

2019-03-12 Thread Malcolm Greene
, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to remove unused pip installed modules/module dependencies from a virtual env?

2019-02-13 Thread Malcolm Greene
env and recreate it again to start with a fresh env 6. reinstall each directly imported module (from list in used-modules.txt); this will pull in dependencies again 7. pip freeze > requirements.txt <--- this should be the exact modules used by our code Thank you, Malcolm -- https://mail.p

Best way to remove unused pip installed modules/module dependencies from a virtual env?

2019-02-13 Thread Malcolm Greene
nv6. reinstall each directly imported module (from list in used- modules.txt); this will pull in dependencies again7. pip freeze > requirements.txt <--- this should be the exact modules used by our code Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

ANN: gcc-python-plugin 0.17

2019-01-25 Thread David Malcolm
Software, licensed under the GPLv3 or later. Enjoy! Dave Malcolm -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

Normalizing path strings and separators in cross-platform unit test scripts

2019-01-07 Thread Malcolm Greene
Any recommendations on normalizing path strings in cross platform (Windows, Linux, macOS) for unit tests? Our goal is to normalize path strings to use forward slash separators so that we can consistently reference path strings in our unit tests in a cross platform way. Example: Under Windows we

Best practice for upgrading SQLite C library (DLL, SO, etc) that ships with Python

2019-01-05 Thread Malcolm Greene
specific issues to be concerned with or is there a general pattern here? I work across Windows, Linux, and macOS. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

[issue10948] Trouble with dir_util created dir cache

2019-01-04 Thread Malcolm Smith
Malcolm Smith added the comment: Please reopen this issue. The distutils2 project has now been abandoned, so that's no longer a justification for taking no action. At the very least, the documentation should be fixed to either warn about this surprising behavior, or make it clear

Logging - have logger use caller's function name and line number

2018-12-29 Thread Malcolm Greene
I have a class method that adds additional context to many of the class's log messages. Rather than calling, for example, logger.info( 'message ...' ) I would like to call my_object.log( 'message ...' ) so that this additional context is managed in a single place. I'm actually doing that and its

What Python related git pre-commit hooks are you using?

2018-11-18 Thread Malcolm Greene
Curious to learn what Python related git pre-commit hooks people are using? What hooks have you found useful and which hooks have you tried and abandoned? Appreciate any suggestions for those new to this process. Background: Window, macOS, and Linux dev environments, PyCharm professional edition

Anyone running Python on MS Azure?

2018-11-09 Thread Malcolm Greene
Curious to hear if any of you are running Python scripts/apps on MS Azure cloud services? What services are you using and what has your experience been? Advice? Background: Customer migrating to Azure. I'm trying to get ahead of the curve regarding how Python-friendly the Azure platform is.

[issue9263] Try to print repr() when an C-level assert fails (in the garbage collector, beyond?)

2018-10-26 Thread Dave Malcolm
Dave Malcolm added the comment: Thanks! -- ___ Python tracker <https://bugs.python.org/issue9263> ___ ___ Python-bugs-list mailing list Unsubscribe:

Verify pip's requirements.txt file at runtime?

2018-09-11 Thread Malcolm Greene
Is there a technique that would allow a script to verify its requirements.txt file before it runs? Use case: To detect unexpected changes to a script's runtime environment. Does the pip module expose any methods for this type of task? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo

logging module - how to include method's class name when using %(funcName)

2018-09-10 Thread Malcolm Greene
outputting module name and line number so I can always go back and double check a caller's location in source, but that seems like an archaic way to find this type of information. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread Malcolm Greene
temporary files, named sockets/pipes, etc. Is there any consensus on best practice here? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Cross platform mutex to prevent script running more than instance?

2018-09-03 Thread Malcolm Greene
temporary files, named sockets/pipes, etc. Is there any consensus on best practice here? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Verifying the integrity/lineage of a file

2018-08-31 Thread Malcolm Greene
Thanks for the replies! I'm going to investigate the use of python-gnupg [1] which is a Python wrapper for the GPG command line utility. This library is based on gpg.py written by Andrew Kuchling. I'm all ears if f anyone has any alternative recommendations or python-gnupg tips to share. BTW:

bytes() or .encode() for encoding str's as bytes?

2018-08-31 Thread Malcolm Greene
Is there a benefit to using one of these techniques over the other? Is one approach more Pythonic and preferred over the other for style reasons? message = message.encode('UTF-8') message = bytes(message, 'UTF-8') Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Verifying the integrity/lineage of a file

2018-08-31 Thread Malcolm Greene
e SSH keys for verification Any suggestions on techniques and/or libraries appreciated. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
On 28/08/2018 7:09 AM, John Pote wrote: On 26/08/2018 00:55, Malcolm wrote: I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy

regex pattern to extract repeating groups

2018-08-27 Thread Malcolm
I am trying to understand why regex is not extracting all of the characters between two delimiters. The complete string is the xmp IFD data extracted from a .CR2 image file. I do have a work around, but it's messy and possibly not future proof. Any insight greatly appreciated. Malcolm My

Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-15 Thread Malcolm Greene
Thanks to everyone who contributed to this thread. Great feedback and suggestions! - Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
> You might try: > from getopt import getopt > or the (apparently newer): > from optparse import OptionParser Thanks Mike. My question was trying to make a distinction between Python options (flags that precede the script or module name) and arguments (the script specific values passed on the

Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
values via a single environment variable (something like PYTHONOPTIONS) vs individual environment variables. Thank you Malcolm -- https://mail.python.org/mailman/listinfo/python-list

How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
having these options confused with command line arguments? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Anyone using cloud based monitoring/logging services with Python logging module?

2018-07-26 Thread Malcolm Greene
, recommendations, etc. Thanks! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

[issue29326] Blank lines in ._pth file are not ignored

2018-05-30 Thread Malcolm Smith
Malcolm Smith added the comment: FYI: I have created issue 33689 for the non-Windows-specific issue. -- ___ Python tracker <https://bugs.python.org/issue29

[issue33689] Blank lines in .pth file cause a duplicate sys.path entry

2018-05-29 Thread Malcolm Smith
New submission from Malcolm Smith : The `site` module documentation says that in .pth files, "Blank lines and lines beginning with # are skipped.". However, the implementation does not actually skip blank lines. It then joins the empty string to the site-packages directory,

[issue29326] Blank lines in ._pth file are not ignored

2018-05-29 Thread Malcolm Smith
Malcolm Smith added the comment: > I'm not aware of any such issue with .pth files - the underscore in ._pth is > deliberate. An identical issue *does* exist for .pth files. As you can see from examining site.addpackage, it does not ignore blank lines as the documentation says. A

ANN: gcc-python-plugin 0.16

2018-05-08 Thread David Malcolm
, licensed under the GPLv3 or later. Enjoy! Dave Malcolm -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

Distributing Python virtual environments

2018-03-29 Thread Malcolm Greene
We're using virtual environments with Python 3.6. Since all our pip installed modules are in our environment's local site-packages folder, is the distribution of a virtual environment as simple as recursively zipping the environment's root folder and distributing that archive to another machine

Re: Python 3.6: How to expand f-string literals read from a file vs inline statement

2018-03-23 Thread Malcolm Greene
> Perhaps it doesn't need to be said, but just to be sure: don't use eval if > you don't trust the people writing the configuration file. They can do nearly > unlimited damage to your environment.  They are writing code that you are > running. Of course! Script and config file are running in

Best practice for managing secrets (passwords, private keys) used by Python scripts running as daemons

2018-03-23 Thread Malcolm Greene
Looking for your suggestions on best practice techniques for managing secrets used by Python daemon scripts. Use case is Windows scripts running as NT Services, but interested in Linux options as well. Here's what we're considering 1. Storing secrets in environment vars 2. Storing secrets in

Re: Python 3.6: How to expand f-string literals read from a file vs inline statement

2018-03-23 Thread Malcolm Greene
My original post reformatted for text mode: Looking for advice on how to expand f-string literal strings whose values I'm reading from a configuration file vs hard coding into my script as statements. I'm using f-strings as a very simple template language. I'm currently using the following

Python 3.6: How to expand f-string literals read from a file vs inline statement

2018-03-23 Thread Malcolm Greene
Looking for advice on how to expand f-string literal strings whose values I'm reading from a configuration file vs hard coding into my script as statements. I'm using f-strings as a very simple template language. I'm currently using the following technique to expand these f-strings. Is there a

[issue9635] Add Py_BREAKPOINT and sys._breakpoint hooks

2018-02-27 Thread Dave Malcolm
Dave Malcolm <dmalc...@redhat.com> added the comment: On Fri, 2018-02-23 at 00:16 +, Cheryl Sabella wrote: > Cheryl Sabella <chek...@gmail.com> added the comment: > > Did PEP553 make this issue obsolete? I *think* they have slightly different scope: if I'm reading it r

[issue32640] Python 2.7 str.join documentation is incorrect

2018-01-23 Thread Malcolm Smith
New submission from Malcolm Smith <malcolm.sm...@gmail.com>: At some point the Python 3 documentation of str.join has been copied to Python 2. This includes the sentence "A TypeError will be raised if there are any non-string values in iterable, including bytes objects."

[issue32170] Contrary to documentation, ZipFile.extract does not extract timestamps or other metadata

2017-11-29 Thread Malcolm Smith
Malcolm Smith <malcolm.sm...@gmail.com> added the comment: Related: Issue15795 -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32170] Contrary to documentation, ZipFile.extract does not extract timestamps or other metadata

2017-11-29 Thread Malcolm Smith
New submission from Malcolm Smith <malcolm.sm...@gmail.com>: The documentation explicitly says "file information is extracted as accurately as possible". But the `zipfile` module doesn't actually extract any metadata at all. I assume this text was copied and pasted from the

[issue31237] test_gdb disables 25% of tests in optimized builds

2017-08-21 Thread Dave Malcolm
Dave Malcolm added the comment: The problem is that there are so many variables: * which version of which compiler * optimization flags * which version of gdb * which CPU architecture etc (and the compiler and/or gdb could be carrying patches from downstream distributors...) All of these can

[issue31196] Blank line inconsistency between InteractiveConsole and standard interpreter

2017-08-13 Thread Malcolm Smith
New submission from Malcolm Smith: The standard interpreter is more eager to give an error on incomplete input, while the InteractiveConsole will keep on prompting for more: Python 3.5.3 (default, Apr 10 2017, 07:53:16) [GCC 6.3.0 64 bit (AMD64)] on win32 Type "help", "copyr

[issue23674] super() documentation isn't very clear

2017-07-14 Thread Malcolm Smith
Malcolm Smith added the comment: I agree that the first two paragraphs are confusing. It's clearly not true to say "The search order is same as that used by getattr() except that the type itself is skipped", because as noted above, everything *earlier* than the type in the MRO is al

[issue15360] Behavior of assigning to __dict__ is not documented

2017-07-13 Thread Malcolm Smith
Changes by Malcolm Smith <malcolm.sm...@gmail.com>: -- nosy: +Malcolm Smith ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15360> ___

[issue30840] Contrary to documentation, relative imports cannot pass through the top level

2017-07-03 Thread Malcolm Smith
New submission from Malcolm Smith: https://docs.python.org/3/reference/simple_stmts.html#the-import-statement defers the full specification of relative imports to PEP 328. PEP 328 gives the example "from ...sys import path" in a second-level package, and notes "while that las

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Malcolm Greene
Thank you Peter and Jussi - both your solutions were very helpful! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Malcolm Greene
in enumerate( some_iterable, max_count=10 ): Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

[issue30372] Status of __builtins__ is not totally clear

2017-05-15 Thread Malcolm Smith
New submission from Malcolm Smith: https://docs.python.org/3.6/reference/executionmodel.html#builtins-and-restricted-execution describes the various things you can do with __builtins__, but then says "Users should not touch __builtins__; it is strictly an implementation detail." If

Best practice tips for sizing thread/process pools and concurrent futures max_workers?

2017-05-04 Thread Malcolm Greene
? Are there any 3rd party libraries that monitor CPU/core and memory utilization to dynamically tune these values based on system capacity? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Elegant way to merge dicts without overwriting keys?

2017-05-04 Thread Malcolm Greene
keys to sets and compare these sets to determine which keys are unique and can be merged and which keys are dupes and should be tracked in that manner. At a high level, does this sound like a reasonable approach? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Who still supports recent Python on shared hosting

2017-03-06 Thread Malcolm Greene
Another endorsement for Webfaction. -- https://mail.python.org/mailman/listinfo/python-list

Quick way to calculate lines of code/comments in a collection of Python scripts?

2016-10-05 Thread Malcolm Greene
Looking for a quick way to calculate lines of code/comments in a collection of Python scripts. This isn't a LOC per day per developer type analysis - I'm looking for a metric to quickly judge the complexity of a set of scripts I'm inheriting. Thank you, Malcolm -- https://mail.python.org/mailman

Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature

2016-09-24 Thread Malcolm Greene
ous to me :) Packaging and distributing Python scripts as zipped archives is such a powerful feature I'm surprised that there hasn't been more written on this topic. Thank you for sharing these tips with me and the rest of the Python list community !! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-22 Thread Malcolm Greene
Oscar/MRAB, > You could put something between the file and the reader ... Thank you both for your suggestions ... brilliant! You guys helped me solve my problem and gave me an excellent strategy for future scenarios. Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Malcolm Greene
by this object. I would like to log the actual line read by the CSVDictReader, not the processed data returned in the dict. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature

2016-09-19 Thread Malcolm Greene
Hi Paul, WOW!:) I really appreciate the detailed response. You answered all my questions. I'm looking forward to testing out your pylaunch wrapper. Thank you very much! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Looking for tips and gotchas for working with Python 3.5 zipapp feature

2016-09-16 Thread Malcolm Greene
these embedded files (by opening up the zipapp as a zip archive and navigating from there?). Thank you, Malcolm [1] The zipapp feature of Python 3.5 is pretty cool: It allows you to package your Python scripts in a single executable zip file. This isn't a replacement for tools like

Re: Discover all non-standard library modules imported by a script

2016-09-16 Thread Malcolm Greene
also be run as a script, giving the filename of a Python script as its argument, after which a report of the imported modules will be printed. https://docs.python.org/3.5/library/modulefinder.html Note there's a similar module for Python 2.7. -- Malcolm -- https://mail.python.org/mailman

Discover all non-standard library modules imported by a script

2016-09-16 Thread Malcolm Greene
and "from import ...". I know I could write a script to do this, but certainly there must be such a capability in the standard library? Use case: Discovering list of modules to use for building a Python 3.5 zipapp distributable. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamically import specific names from a module vs importing full module

2016-08-23 Thread Malcolm Greene
Ned and Random832, Ned: Thank you - your example answered my question. Random832: Thank you for the reminder about "from import " still importing the module. Yes, I had forgotten that behavior. Best, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Dynamically import specific names from a module vs importing full module

2016-08-22 Thread Malcolm Greene
Python 3.5: Is there a way to dynamically import specific names from a module vs importing the full module? By dynamic I mean via some form of importlib machinery, eg. I'm looking for the dynamic "from import " equivalent of "import "'s importlib.import_module. Thank yo

Advice on optimizing a Python data driven rules engine

2016-08-11 Thread Malcolm Greene
= value.replace(match, '', 1).strip() while value.endswith(match): value = value[0:len(value) - len(match)].strip() # BOILERPLATE: update the value we just transformed self.data[self.rule.target_column] = value Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding

2016-08-04 Thread Malcolm Greene
error handler import codecs def custom_unicode_error_handler(e): bad_bytes = e.object[e.start:e.end] print( 'Bad bytes: ' + bad_bytes.hex()) return ('', e.end) codecs.register_error('custom_unicode_error_handler', custom_unicode_error_handler) Malcolm -- https://mail.python.org

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding

2016-08-04 Thread Malcolm Greene
is to count the total number of UnicodeExceptions within a file (as a data quality metric) and track the frequency of specific bad code's (via a collections.counter dict) to see if there's a pattern that can be traced to bad upstream process. Malcolm Remove them? Not sure what you mean, exactly

Capturing the bad codes that raise UnicodeError exceptions during decoding

2016-08-04 Thread Malcolm Greene
decoded so I can pass this line on to the CSV reader. At a high level it seems that I need to wrap the decoding of a line until it passes with out any errors. Any suggestions appreciated. Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
> You could use win_unicode_console enabled in sitecustomize or usercustomize. > https://pypi.python.org/pypi/win_unicode_console The pypi link you shared has an excellent summary of the issues associated when working Unicode from the Windows terminal. Thank you Eryk. Malcolm --

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
Chris, > Don't forget that the print function can simply be shadowed. I did forget! Another excellent option. Thank you! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
. Malcolm [1] PYTHONIOENCODING=ascii:backslashreplace -- https://mail.python.org/mailman/listinfo/python-list

print() function with encoding= and errors= parameters?

2016-08-03 Thread Malcolm Greene
a specific way? Thank you, Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: logging: getLogger() or getLogger(__name__)?

2016-07-28 Thread Malcolm Greene
Thank you Laurent! - Original message - From: Laurent Pointal With __name__ you will have one logger per source file (module), with corresponding filtering possibilities, and organized hierarchically as are packages (logging use . to built its loggers

Re: Behavior of tempfile temp files when scripts killed, interpreter crashes, server crashes?

2016-07-28 Thread Malcolm Greene
Hi Eryk, Awesome! Thank you very much for your detailed answer!! Malcolm Linux has the O_TMPFILE open() flag [1]. This creates an anonymous file that gets automatically deleted when the last open file descriptor is closed. If the file isn't opened O_EXCL, then you can make it permanent

  1   2   3   4   5   6   >