Re: Can't run easy_install even though setuptools is installed

2019-11-07 Thread Cameron Simpson
ng collected packages: docopt, netifaces, onkyo-eiscp Running setup.py install for docopt ... done Running setup.py install for netifaces ... done Running setup.py install for onkyo-eiscp ... done Successfully installed docopt-0.6.2 netifaces-0.10.9 onkyo-eiscp-1.2.7 Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Makefiles in Python projects

2019-11-07 Thread Cameron Simpson
v_reqs = requirements.txt venv_pip = $(venv_dir)/bin/pip py_static_bundle = $(py_app)/static/app.js fleet_dev = [ "$$HOST" = fleet -a "$$USER" = cameron ] _help: @echo '_build: make $(py_static_bundle)' @echo '_deploy_ti

Re: How execute at least two python files at once when imported?

2019-11-07 Thread Cameron Simpson
On 08Nov2019 00:52, Greg Ewing wrote: Cameron Simpson wrote: Spencer's modules run unconditional stuff in addition to defining classes. That may cause trouble. It will -- because of the import lock, they won't run simultaneously in the same process. I was unsure as to how seria

Re: Using Makefiles in Python projects

2019-11-07 Thread Cameron Simpson
On 08Nov2019 10:30, David wrote: On Fri, 8 Nov 2019 at 09:43, Cameron Simpson wrote: [...] _help: @echo '_build: make $(py_static_bundle)' @echo '_deploy_tip: formally deploy the current tip to the dev host dev tree:' @echo &

Re: Can't run easy_install even though setuptools is installed

2019-11-08 Thread Cameron Simpson
On 08Nov2019 09:14, Chris Green wrote: Cameron Simpson wrote: Have you tried this? pip install onkyo-eiscp I have now and it worked perfectly. So why do the install instructions for onkyo-eiscp say do "easy_install onkyo-eiscp"? It definitely means from the command line. I

Re: Can't run easy_install even though setuptools is installed

2019-11-08 Thread Cameron Simpson
On 09Nov2019 13:15, Cameron Simpson wrote: On 08Nov2019 09:14, Chris Green wrote: Cameron Simpson wrote: Have you tried this? pip install onkyo-eiscp I have now and it worked perfectly. So why do the install instructions for onkyo-eiscp say do "easy_install onkyo-eiscp"? It

Re: Help!

2019-11-11 Thread Cameron Simpson
nd I gather the command to run Python from a command line is "py" on Windows (I am not a Windows person, so my advice is vague). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Storing data in queue

2019-11-16 Thread Cameron Simpson
re to start, in which case: describe the problem in more detail). Remember that this is a text only list, so no attachments. Code should be pasted inline in the message. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: how to remove duplicates dict from the list of dictionary based on one of the elements is duplicate in list of dict

2019-11-16 Thread Cameron Simpson
;:"4.2",} ] I would be inclined to keep a mapping (eg another dict) keyed on the value of "component". When you process these lists, put the component/version dicts into the appropriate entry in the new dict. If an entry is already there, act appropriately (eg keep the existing entry, keep the new entry, compare the entries in some way and keep the "better" one, etc). Then at the end, walk the new dict and make a fresh list. Not providing example code because this feels a little homeworky, so we expect you to attempt the code first. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: "Don't install on the system Python"

2019-12-01 Thread Cameron Simpson
ault) "install in my home directory" mode, they should be fine. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to combine a group of lists together

2019-12-20 Thread Cameron Simpson
It would help to see your code. If I use spe[0], I can only get all the first element of each list. Indeed, since that designates the first element. How can I mix all of these elements into a single list like: ['$278.86as', 'of', 'Dec', '20,', '2019,', '06:47', 'PST', '-', 'Details','4.7', 'inches'..] Have a look at the chain() function from the itertools module. Or at the extend() method of the list class. Either will help you compose a longer list from a collection of individual lists. If you're still stuck, post your code in a followup message and ask sepecific questions about your attempts to build a bigger list from various smaller ones. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lists And Extra Commas at end

2019-12-24 Thread Cameron Simpson
it reduces diff noise if you're using revision control (no commas flickering on and off in the diff output). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lists And Extra Commas at end

2019-12-24 Thread Cameron Simpson
y the other week I spent _way_ too long debugging exactly that mistake because I'd cut/pasted a parameter into some inline code. Suddenly a int was a tuple. With luck I'll recognise that mistake faster next time. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Source code organisation

2019-12-28 Thread Cameron Simpson
n(sys.argv)) My reasoning here is that I want the main programme obvious up front. But then I loosely follow "define before use" after that. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Source code organisation

2019-12-28 Thread Cameron Simpson
er, rather than alphabetically. For example, if there's a few methods for transribing the object, they might land together. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Source code organisation

2020-01-01 Thread Cameron Simpson
On 02Jan2020 18:01, DL Neil wrote: On 29/12/19 5:49 PM, Cameron Simpson wrote: For main, i have the opposite habit. If a module has a main() function for command line use I usually want that right up the front:  #!/usr/bin/env python3    import...  def main(argv=None):    ... main

Re: How to get filesystem in python.

2020-01-17 Thread Cameron Simpson
st_dev field, which identifies the filesystem in principle. You still need to consult the system mount table to get a path to its root though. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Clarification on Immutability please

2020-01-21 Thread Cameron Simpson
"pointer" and "reference", particularly which CPython does a lotof this internally with C pointers (id() in CPython returns an address as it happens)? Because there are multiple implementations of Python, and they needn't use C-like pointers internally. Imagine the id() was an index into some table-of-objects and that the table itself held pointers, eg so that the object storage itself could be moved around. So Python variables are references. The variables themselves are not immutable. Cheers, Cameron Simpson (formerly [email protected]) Draw little boxes with arrows. It helps. - Michael J. Eager -- https://mail.python.org/mailman/listinfo/python-list

Re: Clarification on Immutability please

2020-01-21 Thread Cameron Simpson
On 22Jan2020 09:15, Cameron Simpson wrote: It doesn't say anything about the contents of the internal objects: >>> mytup = (1, [2, 3], (4, 5)) [...] >>> mytupl[1] = [7, 8] Traceback (most recent call last): File "", line 1, in NameError: name

Re: Threading

2020-01-24 Thread Cameron Simpson
tarts many threads, but only 10 at a time will do "work" because they stall until they can acquire the Semaphore. The first 10 acquire it immediately, then the later only stall until an earlier Thread releases the Semaphore. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Threading

2020-01-25 Thread Cameron Simpson
kes a long time, stalling the "main" programme). Of course one might dispatch a thread to run the queue... I'm aware this makes a lot of threads and they're not free, that's a very valid criticism. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: pyttsx3 installation error

2020-01-25 Thread Cameron Simpson
rror text straight into the message body. If pip is working but an import fails, make sure the "pip" command you're running installs for the python you're using. It is common for systems to have both a python2 and python3 installed presently, so there is some scope for pip inst

Re: Is there a character that never appears in the output of zlib.compress?

2020-01-29 Thread Cameron Simpson
On 28Jan2020 23:09, Peng Yu wrote: I'd like to tell what part is zlib.compress data in an input stream. One way is to use some characters that never appear in zlib.compress output to denote the boundary. Are there such characters? Thanks. If you mean: is there a byte which never appears, then

Re: on sorting things

2020-01-29 Thread Cameron Simpson
mple above isn't very amenable to sorts, because you never bother looking at checksums at all for files of different sizes. OTOH, I do sort the files by size before processing the checksum phases, letting one sync/reclaim the big files first for example - a policy choice. Cheers,

Re: How to make a cross platform python app with pyinstaller??

2020-02-04 Thread Cameron Simpson
hich lets you derive the library locations from the app location, etc. However, I've had plenty of pain with this myself. I'm contemplating not just including a virtualenv in the app but a whole python install. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing, join(), and crashed processes

2020-02-05 Thread Cameron Simpson
mean, precisely? If a subprocess exits, join() should terminate. If the subprocess _hangs_, then join will not see it exit, because it hasn't. And join will hang. You'll need to define what happens when your subprocesses crash. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: first time python learner

2020-02-13 Thread Cameron Simpson
. Thanks, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: 【Regarding Performance of a Python Script....】

2020-03-01 Thread Cameron Simpson
port check_output; check_output(['/bin/bash', '-c', 'echo 42'], close_fds=True)" See if your 2 Pythons are doing something difference at the system call level. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Lock acquisition by the same thread - deadlock protection

2020-03-14 Thread Cameron Simpson
uable. If the lock object has that piece of information (IIRC it does). Cheers, Cameron Simpson (formerly [email protected]) -- https://mail.python.org/mailman/listinfo/python-list

Re: queue versus list

2020-03-19 Thread Cameron Simpson
l issue you the lowest current element on each iteration. If you merely need to process all the elements you're good. If the order matters you need to consider that. A deque, being thread safe, will be using a lock. There will be a (quite small) overhead for that. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: queue versus list

2020-03-20 Thread Cameron Simpson
ect; brain fade on my part. I do not know why I conflated a deque with a heap. Apologies for the confusion. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How come logging.error writes to a file, but not logging.debug or logging.info?

2020-03-26 Thread Cameron Simpson
changing the verbosity. Obviously adjust if you've got a special purpose logger rather than the root logger. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How come logging.error writes to a file, but not logging.debug or logging.info?

2020-03-27 Thread Cameron Simpson
predefined warning() function logs at logging.WARNING level). I often find my info calls are too verbose, and the warnings are only for badness, so I have a kind of intermediate call for "high level" far less frequent logs. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: unable to write content in csv filw

2020-04-27 Thread Cameron Simpson
us other escapes. With a raw string like: r'D:\PHD\new_files' you do not run this risk. Cheers, Cameron Simpson On 27Apr2020 09:14, Rahul Gupta wrote: FOLLWOING IS MY CODE import pandas as pd import csv from sklearn.preprocessing import LabelEncoder from sklearn.feature_selection

Re: Is there anything in the script which could cause it to not run its full course please?

2020-05-05 Thread Cameron Simpson
t component to smallest component. For example: 2020-05-04 They have the convenient property of sorting lexically as they would sort numerically. But David's right on in saying that if you're comparing numbers, do it numerically. Comparing text when the underlying thing isn'

Re: Can a print overwrite a previous print ?

2020-05-08 Thread Cameron Simpson
x27;, end='\r'); print('ghi', end='') Aye, though that is the (hated by me) rewrite-the-whole-line brute force approach. I've got a module "cs.upd" on PyPI which does this with minimal overwrites if you want something eaier on the eyes. Doubtless th

Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-09 Thread Cameron Simpson
d NOT want these numbers to match? My release script writes the setup.py on the fly, so it gets the version number from the release tag I use. I also autopatch the module itself to set __version__ to match when I make that release tag. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-10 Thread Cameron Simpson
On 10May2020 13:00, John Ladasky wrote: On Saturday, May 9, 2020 at 8:17:19 PM UTC-7, Cameron Simpson wrote: I also autopatch the module itself to set __version__ to match when I make that release tag. Yes, that's exactly what the module I wrote for my company's internal use

Re: Decorators with arguments?

2020-05-14 Thread Cameron Simpson
(some-arguments...) def bah(...): ... What's going on there? The expression: foo2(some-arguments...) _itself_ returns a decorator. Which then decorates "bah". So, making an @adapt decorator for your purpose... [... hack hack ...] Well I can't write one of any

Re: Multithread and locking issue

2020-05-14 Thread Cameron Simpson
r less predictable. If you get rid of them then your code must complete or deadlock, there's no fuzzy timeouts-may-occur middle ground. Timeouts are also difficult to choose correctly (if "correct" is even a term which is meaningful), and it is often then better to not try to choose them at all. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Multithread and locking issue

2020-05-15 Thread Cameron Simpson
al layer of complexity to your programme (which you need to debug) or the pervasive fear of threaded programming, which has its pitfalls but is very rewarding and not hard to do safely and easily unless you do something agressive and complex. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Missing python curses functions?

2020-05-19 Thread Cameron Simpson
the curses module simply got tired. Or it predates the get_attr calls (not sure now old they are). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Strings: double versus single quotes

2020-05-19 Thread Cameron Simpson
ck (which is very opinionated and also untunable, and _does_ change my quotes). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: stderr writting before stdout

2020-05-23 Thread Cameron Simpson
messages should always show up as soon as possible. These different policies explain the behaviour you see. By inserting: sys.stdout.flush() calls at various points for can force OS-write calls and see data immediately, which will make this more clear to you. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Custom logging function

2020-05-26 Thread Cameron Simpson
On 26May2020 13:25, [email protected] wrote: Furthermore, I must disable logging to stdout. Normally logging does not happen to stdout. Do you have something which does? Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange use of Lambda arrow

2020-06-05 Thread Cameron Simpson
+y To reiterate what Chris said: in Python the -> is just a type annotation, indicating the expected return type(s) for a function. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange use of Lambda arrow

2020-06-05 Thread Cameron Simpson
On 06Jun2020 02:48, MRAB wrote: On 2020-06-06 01:01, Chris Angelico wrote: On Sat, Jun 6, 2020 at 8:24 AM Cameron Simpson wrote: The OP may be being confused by JavaScript, where they have "arrow functions", which are what Python calls lambda: anonymous functions. It uses an ar

Re: Data structures and Algorithms

2020-06-30 Thread Cameron Simpson
ing sizes, not to mention additional verbiage. In Python you are far freer to concentrate on the data structures and algorithms themselves. Maybe start here: https://duckduckgo.com/html?q=python%20data%20structures%20and%20algorithms%20tutorials Cheers, Cameron Simpson -- https://mail.python.or

Re: A rule for your twitlist/mailing list

2020-07-14 Thread Cameron Simpson
https://mail.python.org/mailman/listinfo/python-list It gateways with the newsgroup, but has much better spam qualities. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Spam, bacon, sausage and Spam (was: EuroPython 2020: Data Science Track)

2020-07-22 Thread Cameron Simpson
very convenient. As with all posters and topics, a truly annoying one can always be blocked at your personal discretion with a filter rule, eg to discard "europython". I know that advice verges on the spammers' claim that "you can always opt out" but for me this st

Re: Spam, bacon, sausage and Spam (was: EuroPython 2020: Data Science Track)

2020-07-23 Thread Cameron Simpson
On 23Jul2020 10:39, Christian Heimes wrote: >On 23/07/2020 02.12, Cameron Simpson wrote: >> I have never attended EuroPython and probably never will (I'm on the >> other side of the planet) but I'm still interested. Rather than >> subscribe to every conference t

replying to the mailing list (was: Winreg)

2020-07-30 Thread Cameron Simpson
quot; header, which is automatically set by your mailer's "reply" function (regardless of the flavour mentioned above). So please just reply to the relevant list message, and make sure the list address ([email protected]) is in the resulting to/cc. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Non IDE development strategy - what do others do that's fairly simple?

2020-08-01 Thread Cameron Simpson
s - they all get merged back into "default" frequently as things stabilise. So for your scenario I'd add a named branch for the development, particularly if it has a theme. But also as Marco suggests, clone your tree into another directory for the development. Look: [~]fleet2*&g

Re: Non IDE development strategy - what do others do that's fairly simple?

2020-08-01 Thread Cameron Simpson
nyone else have this command line >based sort of approach and, if so, what do they do to provide a >'development version' of a program in parallel with a working version? To that last part, I have a personal script "env-dev" (aliased as just "dev"), here:

Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Cameron Simpson
file you were trying to import. BTW, it looks to me like your Python programmes (graphics.py and whatever other file you might be making) are inside the Python install. Normally you'd keep these elsewhere, for example in a folder such as: C:\Users\sarvesh\my-programmes Cheers, Cameron

Re: Pygobject style question

2020-08-02 Thread Cameron Simpson
s the buffer before it makes the view, which I prefer. If they are all legal and all correct and equivalent, go with the one which is easiest to read. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Explicit is better than Implicit

2020-08-06 Thread Cameron Simpson
Heuer's Razor: If it can't be turned off, it's not a feature. - Karl Heuer Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to remove "" from starting of a string if provided by the user

2020-08-10 Thread Cameron Simpson
a newline character and so forth, so _only_ stripping the quotes is not al that would be required. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: I discovered a bug in the no-ip dynamic dns free hostname auto renewal/confirmation script written by loblab

2020-08-16 Thread Cameron Simpson
issues Posting to the generic python-list won't help anyone, because the script authors likely will not see it and the python-list members haven't anything they can do with your bug report. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Finding it very difficult to move pyexiv2 code from Python 2 to Python 3

2020-08-19 Thread Cameron Simpson
ult Python >and see what falls over as a consequence. Don't change the system default Python - many system scripts rely on that and may break. If an OS update changes it, it should also update all the dependent scripts and so be ok, but an ad hoc change of only part of the system i

Re: Finding it very difficult to move pyexiv2 code from Python 2 to Python 3

2020-08-20 Thread Cameron Simpson
On 20Aug2020 18:13, Chris Green wrote: >Cameron Simpson wrote: >> On 19Aug2020 08:53, Chris Green wrote: >> >Maybe I should bite the bullet and make Python 3 the default Python >> >and see what falls over as a consequence. >> >> Don't change the syst

Re: Finding it very difficult to move pyexiv2 code from Python 2 to Python 3

2020-08-20 Thread Cameron Simpson
rces to regression test the shift in time for 20.04. Moving to Python 3, _particularly_ with something like Mercurial which has a bunch of internal things which are in fact byte strings, risks subtle breakage. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How to install your personal module/package on site.

2020-08-20 Thread Cameron Simpson
le pulls a particular tagged release via the "@5.0.3" suffix. Cheers, Cameron Simpson (formerly [email protected]) -- https://mail.python.org/mailman/listinfo/python-list

Re: "dictionary changed size during iteration" error in Python 3 but not in Python 2

2020-08-23 Thread Cameron Simpson
the internal structure, which is a hash table. A typical dynamic hash table will resize every so often if items are inserted or removed, which doesn't just rearrange things, it can reorder the keys because the distribution of the keys into buckets can change as the number of buckets changes

Re: Why __hash__() does not return an UUID4?

2020-08-26 Thread Cameron Simpson
;equal" land in the _same_ bucket. That requires coordination of the hash values. Where that matters, you compute the hash from the value. UUID4s are not like that. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I do this in Python 3 (string.join())?

2020-08-26 Thread Cameron Simpson
ols are "bytes-as-text, but that is accomplished by implying an encoding of the text, eg as ASCII, where characters all fit in single bytes/octets. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Another 2 to 3 mail encoding problem

2020-08-27 Thread Cameron Simpson
ing() seems to write happily into a text file for me. I run _all_ my messages through this stuff. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I do this in Python 3 (string.join())?

2020-08-27 Thread Cameron Simpson
On 27Aug2020 09:16, Chris Green wrote: >Cameron Simpson wrote: >> But note: joining bytes like strings is uncommon, and may indicate >> that >> you should be working in strings to start with. Eg you may want to >> convert popmsg from bytes to str and do a str

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-27 Thread Cameron Simpson
ssumes_ UTF-8 because that is the default for bytes.decode, and if that is _not_ what is in the bytes objects you will get mojibake. Because a lot of stuff is "mostly ASCII", this is the kind of bug which can lurk until much later when you have less usual data. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I do this in Python 3 (string.join())?

2020-08-27 Thread Cameron Simpson
On 27Aug2020 14:36, Chris Green wrote: >Cameron Simpson wrote: >> I do ok, though most of my message processing happens to messages >> already landed in my "spool" Maildir by getmail. My setup uses getmail >> to get messages with POP into a single Maildir, and then

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
27;t handle it, stash the raw bytes _elsewhere_ in a distinct file in some directory. with open('evil_msg_bytes', 'wb') as f: for bs in bbb: f.write(bs) No interpreation requires, since parsing failed. Then you can start dealing with these exceptions. _Do not_ write unparsable messages into an mbox! Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 12:26, Chris Green wrote: >Cameron Simpson wrote: >> POP3 is presumably handing you bytes containing a message. If the >> Python >> email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in >> a distinct file in some directory. >

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Cameron Simpson
tput. The process here is: - transcribe the message to a Python 3 str (so Unicode code points) - replace embedded "From " to protect the mbox format - open the mbox for append - the _default_ encoding is utf-8 - write the message in utf-8 because of the open mode This sidesteps the librar

Re: Silly question, where is read() documented?

2020-08-29 Thread Cameron Simpson
on my machine. Really snappy, because my browser's pulling from the local filesystem. Cheers, Cameron Simpson On 29Aug2020 17:33, Ian Hobson wrote: >https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects > >(It is in the top result returned by Google, searching

Re: Symlinks already present

2020-08-30 Thread Cameron Simpson
directories on HFS volumes: instead of making a new directory tree full of hardlinks you just hardlink the top directory itself if nothing inside it has been changed. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Symlinks already present

2020-08-30 Thread Cameron Simpson
plicate is seen-this-(dev,ino)-before. You only need the stat, not to (for example) resolve the path the symlink becomes. You've probably thought of this already of cource. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Symlinks already present

2020-08-31 Thread Cameron Simpson
On 31Aug2020 14:20, Chris Angelico wrote: >On Mon, Aug 31, 2020 at 1:17 PM Cameron Simpson wrote: >> Each "source" symlink has its own inode. But if you os.stat() the >> symlink it follows the symlink and you get the inode for the "target" >> directo

Re: Symlinks already present

2020-09-01 Thread Cameron Simpson
setuid root at that time, which does _not_ ring any bells. So I may be misremembering the details. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

compile error building building Python-3.8.5 on Debian 8.11 (yes, old!)

2020-09-03 Thread Cameron Simpson
^ Any thoughts? I'll try a few other minor versions meanwhile... Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: compile error building building Python-3.8.5 on Debian 8.11 (yes, old!)

2020-09-04 Thread Cameron Simpson
On 04Sep2020 15:54, Chris Angelico wrote: >On Fri, Sep 4, 2020 at 3:01 PM Cameron Simpson wrote: >> I've built 3.8.5 on a few other machines happily recently. >Those are warnings; if there are errors that block compilation, they >aren't in what you quoted above. Yes, t

Re: Opening python

2020-09-08 Thread Cameron Simpson
ting system are you using? - what have you done with the download so far? Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie

2020-09-08 Thread Cameron Simpson
r your playing field diagrams/visualisations. Someone else will have to speak to a nice geometry package for simple 3d renders and lines/angles etc. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: newbie

2020-09-08 Thread Cameron Simpson
.org/project/pygame-geometry/ Don, there's a "Getting Started" page for Pygame here: https://www.pygame.org/wiki/GettingStarted including some platform specific notes. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

surprise: dict.get's default is a positional only parameter!

2020-09-11 Thread Cameron Simpson
Normally, if one writes a method like this: def get(self, k, default=None): one can call it as foo.get('x',2) or as foo('x',default=2). But not with dict.get. I'm amazed I've never tripped over this before. (Yes, I appreciate that dict is a builtin class w

Re: Puzzling difference between lists and tuples

2020-09-20 Thread Cameron Simpson
s for readability (a little redundant here, but some complex function calls, or those exceeding the deired line length, are often folded this way). Bu allowing a trailing comma we get consistent formatting and nicer diffs. If a trailing comma were forbidden, the dopping "fred=5" with produce a diff removing not just that line but also the comma on the preceeding line. Ugly and noisy. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: python show .

2020-09-23 Thread Cameron Simpson
and store the depth for each subdirectory: for subdir in dirs: subpath = os.path.join(root, subdir) depths[subpath] = depth + 1 so that they are ready for use when os.walk gives them to you on later iterations. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Use of a variable in parent loop

2020-09-27 Thread Cameron Simpson
n some languages undefined values are quietly promotes to eg 0 in a numeric context. No errors, no exceptions, just silent incorrect results. In Python the choice was made to raise an error for use of a variable not previously bound. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/

Re: Use of a variable in parent loop

2020-09-27 Thread Cameron Simpson
Stephane: I don't believe in "best practice" as _the_ best practice, but I certainly believe there's "bad practice". Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Regex Group case change

2020-10-01 Thread Cameron Simpson
ents of the regexp are available via the .group() method of the match result. So: m.group(1) == "7Section" m.group(2) == "Hello" and to print "Hello" lowercased you might write: m.group(2).lower() Since this looks much like homework we will leave it to you to apply this approach to your existing code. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Regex Group case change

2020-10-01 Thread Cameron Simpson
incorrect, just more complicated than required. >output = word.capitalize() > elif re.match(r"(\d+\w* )(Hello)( \w+)",word)) Typically people put the whitepsace outside the group, because they usually want the word and not the spaces around it. Of course, the cost of that s that you would need to put the spaces back in later. So in fact this works for your use case. >group(1)group(2).title()group(3) You need to join these together, and assign the result to output: output = group(1) + group(2).title() + group(3) > else: >output.title() You need to assign the result to output: output = output.title() Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: python show folder files and not subfolder files

2020-10-04 Thread Cameron Simpson
iter an array of values (strings, floats, whatever) and it takes care of using the correct syntax in the file. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: [python-committers] Thank you Larry Hastings!

2020-10-06 Thread Cameron Simpson
On 05Oct2020 22:14, Tal Einat wrote: >You have my thanks as well, Larry. And mine. - Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-10 Thread Cameron Simpson
e - they are a source of pitfalls. As far as storing timestamps in a file, they're ints or floats; just write them out. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-11 Thread Cameron Simpson
out for humans. But seconds is generally simpler and reliable, particularly as it tosses timezones straight out the window - it is all just arithmetic. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
ing the brackets yet!"). I can't offer mch specific advice on argparse, I use getopt myself. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
nd line parser to be able to compose that help text in some way. Usually the help text in argparse is supplied when you define the option. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
s time to transition to a more expressive language. Like Python :-) (Unless of course you're using a bunch of shell control constructs like pipes, which are succintly written in the shell.) Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I get datetime to stop showing seconds?

2020-10-16 Thread Cameron Simpson
ault for when $TZ is not set is usually in the /etc/timezone file, but you can set $TZ for yourself and have your own localtimes generally displayed. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Time Date Conversion?

2020-11-04 Thread Cameron Simpson
ime ordering. A less fragile way to parse your example line is to use split() to break it into whitepsace separated fields and then parse field[1]+" "+field[2]. That also gets you the first word as field[0], which might be useful - it likely helps classify the input lines in some way. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a conflict of libraries here?

2020-11-06 Thread Cameron Simpson
e.datetime' has no attribute >>'datetime' That is because "datetime" is currently the class, not the module. >1. Remove the line 'from datetime import datetime'. > >2. Change dt = datetime.fromisoformat(ItemDateTime) to > dt = datetime.d

<    5   6   7   8   9   10   11   12   13   14   >