Re: Strategies for avoiding having to use --break-system-packages with pip

2025-01-20 Thread Chris Green via Python-list
Peter J. Holzer wrote: > [-- text/plain, encoding quoted-printable, charset: us-ascii, 32 lines --] > > On 2025-01-14 11:32:35 +0000, Chris Green via Python-list wrote: > > Use a virtual environment, what do I have to do then to make using > > my program (t

Strategies for avoiding having to use --break-system-packages with pip

2025-01-14 Thread Chris Green via Python-list
and use that. My PYTHONPATH will need to point to it but I can't see any further issues with doing this. Anything else? As far as I can see using pipx doesn't help me at all (see recent thread here). -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-14 Thread Chris Green via Python-list
se I might as well use a GUI. I have written a (fairly simple) Gtk based python program, I was just trying to avoid all the GUI overheads for a little new project. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-13 Thread Chris Green via Python-list
rustbuck...@nope.com wrote: > > This is what I was going to suggest. Rich is super easy to use. OK, thanks, Rich is on my shortlist then. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Using pipx for packages as opposed to applications

2025-01-13 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green wrote or quoted: > >E.g. I want to install and use pksheet but, as it's not available from > >the Debian repositories, I'll have to install it from PyPi. > > I can't dig up any "pksheet" on PyPI. So, you got to ta

Using pipx for packages as opposed to applications

2025-01-11 Thread Chris Green via Python-list
in its own environment. Can pipx help me with this? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Tools to help with text mode (i.e. non-GUI) input

2025-01-11 Thread Chris Green via Python-list
Are there any packages that offer this sort of thing? I'd prefer ones from the Debian repositories but that's not absolutely necessary. It might also be possible/useful to use the mouse for this. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to manage accented characters in mail header?

2025-01-06 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green wrote or quoted: > >From: =?utf-8?B?U8OpYmFzdGllbiBDcmlnbm9u?= > > In Python, when you roll with decode_header from the email.header > module, it spits out a list of parts, where each part is like > a tuple of (decoded string, cha

How to manage accented characters in mail header?

2025-01-06 Thread Chris Green via Python-list
wrapped bit altogether as I'm only interested in the 'real' address. How can I easily remove the UTF8 section in a way that will work whether or not it's there? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Python List is Not Dead

2024-12-29 Thread Chris Green via Python-list
quite nicely with a text mode E-Mail client such as mutt so you can keep threads separate, follow sub-threads, etc. Not quite as good as this list gatewayed to usenet though, there's really nothing so good as usenet for proper discourse (!). -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Best (simplest) way to share data

2024-07-11 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green wrote or quoted: > >That's exactly the sort of solution I was wondering about. Is there a > >ready made module/library for handling this sort of thing? Basically > >it will just be a string of a few tens of characters that would be

Re: Best (simplest) way to share data (Posting On Python-List Prohibited)

2024-07-08 Thread Chris Green via Python-list
Lawrence D'Oliveiro wrote: > On Sat, 6 Jul 2024 08:28:41 +0100, Chris Green wrote: > > > One fairly obvious way is to have single process/script which reads the > > A2D values continuously and writes them to a file. All other scripts > > then read from the file as n

Re: Best (simplest) way to share data between processes

2024-07-08 Thread Chris Green via Python-list
Piergiorgio Sartor wrote: > On 06/07/2024 09.28, Chris Green wrote: > > I have a Raspberry Pi in my boat that uses I2C to read a number of > > voltages and currents (using ADS1115 A2D) so I can monitor the battery > > condition etc. > > > > At present various

Best (simplest) way to share data between processes

2024-07-07 Thread Chris Green via Python-list
self has a mutex but I don't think this guarantees that (for example) an A2D reading is atomic because one reading takes more than one I2C bus access. Would a mutex of some sort around each I2C transaction (i.e. complete A2D reading) be a better way to go? -- Chris Green · -- https://mail.pyt

Re: Couldn't install numpy on Python 2.7

2024-06-13 Thread Chris Green via Python-list
s no sense! :-) How can one not say something that one isn't aware of saying? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-19 Thread Chris Green via Python-list
Grant Edwards wrote: > On 2024-02-16, Chris Green via Python-list wrote: > > > I'm looking for a simple way to make NaN values output as something > > like '-' or even just a space instead of the string 'nan'. > > It would probably help if yo

Re: Can one output something other than 'nan' for not a number values?

2024-02-19 Thread Chris Green via Python-list
dn wrote: > On 18/02/24 09:53, Grant Edwards via Python-list wrote: > > On 2024-02-17, Cameron Simpson via Python-list > > wrote: > >> On 16Feb2024 22:12, Chris Green wrote: > >>> I'm looking for a simple way to make NaN values output as something >

Can one output something other than 'nan' for not a number values?

2024-02-16 Thread Chris Green via Python-list
Amps Starter Battery - nan voltsnan Amps What I would like is for those 'nan' strings to be just a '-' or something similar. Obviously I can write conditional code to check for float('nan') values but is there a neater way with any sort of formattin

Re: How/where to store calibration values - written by program A, read by program B

2023-12-30 Thread Chris Green via Python-list
red in a file to provide what I need. The Python json package is very simple to use and with an 'indent=' setting the resulting json is reasonably human readable which is all I need. Thus programs simply read the values from the json file into a dictionary of dictionaries and the 'updater of values' program can write them back after changes. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
Jon Ribbens wrote: > On 2023-12-11, Chris Green wrote: > > Chris Green wrote: > >> Is there a way to abbreviate the following code somehow? > >> > >> lv = {'dev':'bbb', 'input':'1', 'name':'Leisure v

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
Chris Green wrote: > Is there a way to abbreviate the following code somehow? > > lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > sv = {'dev':'bbb', 'input':'0', 

How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
;:0, 'name':'BowProp Volts'} It's effectively a 'table' with columns named 'dev', 'input' and 'name' and I want to access the values of the table using the variable name. I could, obviously, store the data in a database (sqlite), I have some similar data in a database already but the above sort of format in Python source is more human readable and accessible. I'm just looking for a less laborious way of entering it really. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
Thank you everyone for all the suggestions, I now have several possibilities to follow up. :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
Thomas Passin wrote: > On 12/5/2023 11:50 AM, MRAB via Python-list wrote: > > On 2023-12-05 14:37, Chris Green via Python-list wrote: > >> Is there a neat, pythonic way to store values which are 'sometimes' > >> changed? > >> > >> My part

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
Paul Rubin wrote: > Chris Green writes: > > I could simply write the values to a file (or a database) and I > > suspect that this may be the best answer but it does make retrieving > > the values different from getting all other (nearly) constant values. > > I&#x

How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread Chris Green via Python-list
does make retrieving the values different from getting all other (nearly) constant values. Are there any Python modules aimed specifically at this sort of requirement? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Silly/crazy problem with sqlite

2023-11-26 Thread Chris Green via Python-list
Stefan Ram wrote: > Chris Green writes: > >I have to say this seems very non-pythonesque to me, the 'obvious' > >default simply doesn't work right, and I really can't think of a case > >where the missing comma would make any sense at all. > > |6.

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
Chris Green wrote: > This is driving me crazy, I'm running this code:- OK, I've found what's wrong:- > cr.execute(sql, ('%' + "2023-11" + '%')) should be:- cr.execute(sql, ('%' + x + '%',) ) I have to

Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
imo$ It's treating the "2023-11" plus % at each end as separate variables to the binding, this is crazy! I've done similar elsewhere and it works OK, what on earth am I doing wrong here? It has to be something very silly but I can't see it at the moment. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: pip/pip3 confusion and keeping up to date

2023-11-05 Thread Chris Green via Python-list
t you're doing > > ... screen fades to black, title card "3 years later", fade in to ... > > * publish your package > Surely it's not that bad, the vast bulk of Debian, Ubuntu and other distributions are installed via systems that sort out dependencies once given a particular package's requirements. Python is surely not unique in its dependency requirements. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: pip/pip3 confusion and keeping up to date

2023-11-03 Thread Chris Green via Python-list
Jon Ribbens wrote: > On 2023-11-02, Chris Green wrote: > > Jon Ribbens wrote: > >> On 2023-11-02, Chris Green wrote: > >> > I have a couple of systems which used to have python2 as well as > >> > python3 but as Ubuntu and Debian verions have moved

Re: pip/pip3 confusion and keeping up to date

2023-11-02 Thread Chris Green via Python-list
Jon Ribbens wrote: > On 2023-11-02, Chris Green wrote: > > I have a couple of systems which used to have python2 as well as > > python3 but as Ubuntu and Debian verions have moved on they have > > finally eliminated all dependencies on python2. > > > > So they n

Re: pip/pip3 confusion and keeping up to date

2023-11-02 Thread Chris Green via Python-list
Jon Ribbens wrote: > On 2023-11-02, Dieter Maurer wrote: > > Chris Green wrote at 2023-11-2 10:58 +: > >> ... > >>So, going on from this, how do I do the equivalent of "apt update; apt > >>upgrade" for my globally installed pip packages? > >

pip/pip3 confusion and keeping up to date

2023-11-02 Thread Chris Green via Python-list
r/bin/pip3 but they're identical so presuably I can now simply use pip and it will be a python3 pip. So, going on from this, how do I do the equivalent of "apt update; apt upgrade" for my globally installed pip packages? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to find any documentation for smbus?

2023-10-30 Thread Chris Green via Python-list
Dan Purgert wrote: > On 2023-10-28, Chris Green wrote: > > I am using the python3 smbus module, but it's hard work because of the > > lack of documentation. Web searches confirm that the documentation is > > somewhat thin! > > > > The SMBus spec is availa

Re: How to find any documentation for smbus?

2023-10-30 Thread Chris Green via Python-list
km wrote: > Il Sat, 28 Oct 2023 17:08:00 +0100, Chris Green ha scritto: > > > I am using the python3 smbus module, but it's hard work because of the > > lack of documentation. Web searches confirm that the documentation is > > somewhat thin! > > > > I

How to find any documentation for smbus?

2023-10-30 Thread Chris Green via Python-list
pened R/W, users of this module usually must have root permissions. FILE /usr/lib/python3/dist-packages/smbus.cpython-39-arm-linux-gnueabihf.so Even a list of available methods would be handy! :-) Presumably python3's smbus is just a wrapper so if I could find the underlying

Re: Is a Python event polled or interrupt driven?

2023-10-12 Thread Chris Green via Python-list
Chris Angelico wrote: > On Fri, 13 Oct 2023 at 01:48, Chris Green via Python-list > wrote: > > > > In the following code is the event polled by the Python process > > running the code or is there something cleverer going on such that > > Python sees an interrupt wh

Is a Python event polled or interrupt driven?

2023-10-12 Thread Chris Green via Python-list
GPIO25 as input (button) def my_callback(channel): if GPIO.input(Pin): print "Rising edge detected on 25" else: # if port 25 != 1 print "Falling edge detected on 25" GPIO.add_event_detect(Pin, GPIO.BOTH, my_

Finding good documentation for gpiod

2023-09-03 Thread Chris Green via Python-list
dard' way of finding out parameter information? It may well be that I'm simply banging up against the limit of what documentation is available, I have managed to get code working OK. It's just that I'd be happier if I really know what I was doing! :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do I always get an exception raised in this __init__()?

2023-09-03 Thread Chris Green via Python-list
Alan Gauld wrote: > On 31/08/2023 22:15, Chris Green via Python-list wrote: > > > class Gpiopin: > > > > def __init__(self, pin): > > # > > # > > # scan through the GPIO chips to find the line/pin we wa

Why do I always get an exception raised in this __init__()?

2023-08-31 Thread Chris Green via Python-list
recent call last): File "", line 1, in File "/home/chris/.cfg/hosts/bbb/bin/ngp.py", line 24, in __init__ return ValueError: Can't find pin 'P9_23' >>> Does a return in __init__() not do what I think it does? How else could/should I do this? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do I always get an exception raised in this __init__()?

2023-08-31 Thread Chris Green via Python-list
Chris Green wrote: [snip code and question] Sorry folks, it was a caching problem, I wasn't running the code I thought I was running! When I made sure I had cleared everything out and tried again it all worked as I expected. -- Chris Green · -- https://mail.python.org/mailman/lis

Re: What sort of exception when a class can't find something?

2023-08-31 Thread Chris Green via Python-list
Several helpful replies, thank you all. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

What sort of exception when a class can't find something?

2023-08-31 Thread Chris Green via Python-list
name. person.Person('Fred') ... ... If Fred doesn't exist in the database what sort of exception should there be? Is it maybe a ValueError? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-23 Thread Chris Green
Mike Dewhirst wrote: > [-- multipart/mixed, encoding 7bit, 22 lines --] > > [-- text/plain, encoding base64, charset: UTF-8, 16 lines --] > > On 21/05/2023 5:53 am, Chris Green wrote: > > I'm converting a bash script to python as it has become rather clumsy > &g

Is there a Python module to parse a date like the 'date' command in Linux?

2023-05-22 Thread Chris Green
interpreted as a date, in particular it accepts things like "tomorrow", "yesterday" and "next thursday". Is there anything similar in Python or would I be better off simply using os.system() to run date from the python program? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use instead of nntplib?

2023-05-16 Thread Chris Green
round > > there must be this list is mirrored on one, and AFAICS some pythoners use > that > way to post (over the list) Yes, me for one, a good newsreader is really a wonderful way to manage technical 'lists' like this one. Usenet news is still very much alive though a minority interest now I suspect. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread Chris Green
nt to do is throw the non-ASCII characters away as the string I'm trying to match in the subject is guaranteed to be ASCII. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread Chris Green
Keith Thompson wrote: > Chris Green writes: > > Chris Green wrote: > >> I'm having a real hard time trying to do anything to a string (?) > >> returned by mailbox.MaildirMessage.get(). > >> > > What a twit I am :-) > > > >

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
Chris Green wrote: > A bit more information, msg.get("subject", "unknown") does return a > string, as follows:- > > Subject: > =?utf-8?Q?aka_Marne_=C3=A0_la_Sa=C3=B4ne_(Waterways_Continental_Europe)?= > > So it's the 'searchTxt in msg.ge

Re: What do these '=?utf-8?' sequences mean in python?

2023-05-08 Thread Chris Green
Chris Green wrote: > I'm having a real hard time trying to do anything to a string (?) > returned by mailbox.MaildirMessage.get(). > What a twit I am :-) Strings are immutable, I have to do:- newstring = oldstring.replace("_", " ") Job done! -- Chris G

Re: Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
#x27;s failing. I.e. for some reason 'in' isn't working when the searched string has utf-8 characters. Surely there's a way to handle this. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Problem with accented characters in mailbox.Maildir()

2023-05-08 Thread Chris Green
msg.get() that isn't managing to handle the accented string correctly? Yes, I know that accented characters probably aren't allowed in Subject: but I'm not going to get that changed! :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
Kushal Kumaran wrote: > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > I'm sure I'm missing something obvious here but I can't see an elegant > > way to do this. I want to create a directory, but if it exists it's > > not an error and the

Re: How to 'ignore' an error in Python?

2023-04-29 Thread Chris Green
Chris Angelico wrote: > On Sat, 29 Apr 2023 at 14:27, Kushal Kumaran wrote: > > > > On Fri, Apr 28 2023 at 04:55:41 PM, Chris Green wrote: > > > I'm sure I'm missing something obvious here but I can't see an elegant > > > way to do this. I w

How to 'ignore' an error in Python?

2023-04-28 Thread Chris Green
k? It feels rather clumsy. I suppose I could test if the directory exists before the os.mkdir() but again that feels a bit clumsy somehow. I suppose also I could use os.mkdirs() with exist_ok=True but again that feels vaguely wrong somehow. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread Chris Green
jak wrote: > Chris Green ha scritto: > > jak wrote: > >> rbowman ha scritto: > >>> On Sun, 9 Apr 2023 09:40:51 +0100, Chris Green wrote: > >>> > >>>> I'm looking for a Python (3) library to access (read only at present) > >>&

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread Chris Green
rbowman wrote: > On Sun, 9 Apr 2023 09:40:51 +0100, Chris Green wrote: > > > I'm looking for a Python (3) library to access (read only at present) > > the metadata in MP4 video files, in particular I want to get at dates > > and times. > > > > What&#

Re: Looking for package/library to extract MP4 metadata

2023-04-10 Thread Chris Green
jak wrote: > rbowman ha scritto: > > On Sun, 9 Apr 2023 09:40:51 +0100, Chris Green wrote: > > > >> I'm looking for a Python (3) library to access (read only at present) > >> the metadata in MP4 video files, in particular I want to get at dates > >&

Looking for package/library to extract MP4 metadata

2023-04-10 Thread Chris Green
I'm looking for a Python (3) library to access (read only at present) the metadata in MP4 video files, in particular I want to get at dates and times. What's available to do this? Ideally something available in the Ubuntu repositories but I can install with PIP if necessary. -- C

Re: DeprecationWarning but replacement doesn't work

2023-02-05 Thread Chris Green
Roel Schroeven wrote: > Chris Green schreef op 4/02/2023 om 16:17: > > I am using Image from PIL and I'm getting a deprecation warning as > > follows:- > > > > /home/chris/bin/picShrink.py:80: DeprecationWarning: ANTIALIAS is > > deprecated > and will

DeprecationWarning but replacement doesn't work

2023-02-04 Thread Chris Green
ost recent call last): File "/home/chris/bin/picShrink.py", line 80, in im.thumbnail(size, Resampling.LANCZOS) NameError: name 'Resampling' is not defined So, presumably there's more I need to change. Where can I find out what I need to do? -- Chris Gre

Re: Usenet vs. Mailing-list

2023-01-28 Thread Chris Green
Chris Green wrote: > Jon Ribbens wrote: > > On 2023-01-28, Peter J. Holzer wrote: > > > On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: > > >> It looks like you posted this question via Usenet. comp.lang.python is > > >> essentially dead as a Usenet

Re: Usenet vs. Mailing-list

2023-01-28 Thread Chris Green
post via the newsgroup, > and I can see my postings reach the list because they appear > in the list archive on the web. > As far as I am aware the mirroring of the Python mailing list on comp.lan.python works perfectly. I love gmane! :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Mailing-Lists (pointer)

2023-01-11 Thread Chris Green
Cameron Simpson wrote: > On 10Jan2023 08:45, Chris Green wrote: > >dn wrote: > >> See also the wisdom of enabling comp.lang.python and python-list as > >> 'mirrors', enabling those who prefer one mechanism/client to another, > >> yet maintain

Re: Mailing-Lists (pointer)

2023-01-10 Thread Chris Green
it's decided to move to a forum format make that accessible by E-Mail. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Single line if statement with a continue

2022-12-15 Thread Chris Green
eturns" is often found in programming guidelines. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Does one have to use curses to read single characters from keyboard?

2022-12-12 Thread Chris Green
Barry Scott wrote: > > > > On 11 Dec 2022, at 18:50, Chris Green wrote: > > > > My solution in the end was copied from one I found that was much > > simpler and straightforward than most. I meant to post this earlier > > but it got lost somewhere:-

Re: Does one have to use curses to read single characters from keyboard?

2022-12-12 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >import sys, termios, tty > > There might be some versions of Python and the Microsoft® > Windows operating system where "termios" is not available. > Ah, I did originally say that this was a Unix/Linux only so

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Chris Green
;n': ch = getch().lower() return ch So getyn() reads a y or an n, ignores anything else and doesn't wait for a return key. Keyboard input operation is restored to normal after doing this. Using tty.setcbreak() rather than tty.setraw() means that CTRL/C etc. still work if things g

Re: Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >Is the only way to read single characters from the keyboard to use > >curses.cbreak() or curses.raw()? If so how do I then read characters, > > It seems that you want to detect keypresses and not read > characters from a li

Does one have to use curses to read single characters from keyboard?

2022-12-11 Thread Chris Green
'Y' or 'N' answers to questions on the command line. Searching for ways to do this produces what seem to me rather clumsy ways of doing it. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Chris Green
Barry Scott wrote: > > > > On 7 Nov 2022, at 09:28, Chris Green wrote: > > > > Chris Green wrote: > >>> 3: with your pseudo "python3" script in place, make all the scripts use > >>> the "#!/usr/bin/env python3" shebang sug

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Chris Green
m. The system is my hosting provider's cPanel platform which is running a very old Linux and, as I've said has only python 2. I can ask for python 3 on their system but I suspect that my voice is a very tiny one and there are higher priority things to get done. -- Chris Green · -- ht

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Chris Green
Chris Green wrote: > > 3: with your pseudo "python3" script in place, make all the scripts use > > the "#!/usr/bin/env python3" shebang suggested above. > > > Yes, that sounds a good plan to me, thanks Cameron. > Doesn't '#!/usr/bin/en

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Chris Green
Cameron Simpson wrote: > On 06Nov2022 20:51, jak wrote: > >Il 06/11/2022 11:03, Chris Green ha scritto: > >>I have a number of python scripts that I run on a mix of systems. I > >>have updated them all to run on python 3 but many will also run quite > >>hap

Re: How to manage python shebang on mixed systems?

2022-11-06 Thread Chris Green
rbowman wrote: > On Sun, 6 Nov 2022 10:03:50 +0000, Chris Green wrote: > > > > Is there a neat way of handling this? I could write a sort of wrapper > > script to run via the shebang but that seems overkill to me. > > Can you symlink? Not really, since the system

Re: What might suddenly provoke this poplib error?

2022-10-13 Thread Chris Green
Peter J. Holzer wrote: > [-- text/plain, encoding quoted-printable, charset: us-ascii, 28 lines --] > > On 2022-10-13 13:47:07 +0100, Chris Green wrote: > > I have a short python3 program that collects E-Mails from a 'catchall' > > mailbox, sends the few that might

Re: What might suddenly provoke this poplib error?

2022-10-13 Thread Chris Green
e a few years so I'm not sure if I;ll bother! :-) The program is only run half-hourly by cron. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

What might suddenly provoke this poplib error?

2022-10-13 Thread Chris Green
break It seems to be saying that the POP3 server has a problem, if so there's not much I can do about it as it's my hosting provider's mail server. Is it really saying the server has a problem? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: What might suddenly provoke this poplib error?

2022-10-13 Thread Chris Green
A further little bit of information, I tried running getCatchall.py from the command prompt and there was a long wait before it output the same error message. I.e. it looks rather as if the server is not responding to requests. (A 'long wait' is a minute or two) -- Chris Green ·

Re: Find the path of a shell command

2022-10-12 Thread Chris Green
Michael F. Stemper wrote: > On 12/10/2022 07.20, Chris Green wrote: > > jak wrote: > >> Il 12/10/2022 09:40, jkn ha scritto: > >>> On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote: > > >>>> I'm afraid you will have to look fo

Re: Find the path of a shell command

2022-10-12 Thread Chris Green
y comments/responses. > >>> Paulo > >>> > >> I'm afraid you will have to look for the command in every path listed in > >> the PATH environment variable. > > > > erm, or try 'which rm' ? > > You might but if you don&#

Re: Best way to check if there is internet?

2022-02-22 Thread Chris Green
seful to have something that doesn't always give the > right answer, even if it usually does? Is there any value whatsoever > in a lie? > That's sort of in the same area as a stopped clock being right more often than one that runs just a bit slow (or fast). :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to test for maildir 'folder' in Python?

2022-01-23 Thread Chris Green
Barry Scott wrote: > > > > On 22 Jan 2022, at 21:26, Chris Green wrote: > > > > I have a script that walks a quite deep tree of mail messages to find > > and archive old messages. I'm trying to convert it from mbox to > > maildir (as I now store my ma

Re: How to test for maildir 'folder' in Python?

2022-01-23 Thread Chris Green
Cameron Simpson wrote: > On 22Jan2022 21:26, Chris Green wrote: > >So I need to test whether a point I have reached in the hierarchy is a > >maildir mailbox or not. Using mbox format it's easy because 'folders' > >are directories and mailboxes are files.

How to test for maildir 'folder' in Python?

2022-01-22 Thread Chris Green
27;, 'new' and 'tmp'. Is there any 'ready made' way in python to tell whether a directory is a maildir mailbox? If not I suppose I'll simply have to check if there are 'cur', 'new' and 'tmp' directories within the directory which may or may not be a maildir. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there any way to make sense of these E-Mail subjects?

2021-12-24 Thread Chris Green
Python wrote: > Chris Green wrote: > >Subject: [SPAM] =?UTF-8?B?8J+TtyBKb2huIEJheHRlci1C?= > > =?UTF-8?B?cm93biByZWNlbnRseSBw?= > > =?UTF-8?B?b3N0ZWQgYSBuZXcgcGhv?= > > =?UTF-8?B?dG8=?= > > > > It looks like some sort of mi

Is there any way to make sense of these E-Mail subjects?

2021-12-24 Thread Chris Green
an't see an easy way to actually inspect the message as it's disappeared off somewhere else. I guess I could add some code to the script to send it to myself as well but if there's something obvious in the above it would avoid having to do this. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd locale error that has disappeared on reboot.

2021-12-09 Thread Chris Green
Inada Naoki wrote: > On Wed, Dec 8, 2021 at 2:52 AM Chris Green wrote: > > > > > > At 03:40 last night it suddenly started throwing the following error every > > time it ran:- > > > > Fatal Python error: initfsencoding: Unable to get the locale encodin

Re: Odd locale error that has disappeared on reboot.

2021-12-09 Thread Chris Green
Julio Di Egidio wrote: > On 08/12/2021 10:50, Chris Green wrote: > > Julio Di Egidio wrote: > >> On 07/12/2021 16:28, Chris Green wrote: > >>> What could have caused this? I certainly wasn't around at 03:40! :-) > >>> There aren't a

Re: Odd locale error that has disappeared on reboot.

2021-12-08 Thread Chris Green
Julio Di Egidio wrote: > On 07/12/2021 16:28, Chris Green wrote: > > I have a very short Python program that runs on one of my Raspberry > > Pis to collect temperatures from a 1-wire sensor and write them to a > > database:- > > > > #!/usr/bin/python3 >

Odd locale error that has disappeared on reboot.

2021-12-07 Thread Chris Green
also my 'NAS' with a big USB drive connected to it. The backups have been running without problems for more than a year. Looking at the system logs shows that a backup was started at 03:35 so I suppose that *could* have provoked something but I fail to understand how. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Why is there no get_body() in mailbox.Maildir?

2021-11-28 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >I thought MaildirMessage inherited from email.message, > > It inherits from mailbox.Message which inherits from > email.message.Message which has no "get_body" method. > So the documentation at:- ht

Re: How to decode ISO8859-1 in Python 3?

2021-11-28 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >I have some text files which are ISO8859-1 encoded and I want to output > >them to screen using Python. > > Well, the first attempt would be: > > import pathlib > name = r"C:\example.txt" > encoding

How to decode ISO8859-1 in Python 3?

2021-11-28 Thread Chris Green
This sounds as if it should be trivial but searching only seems to produce ways ofd doing it in Python 2. I have some text files which are ISO8859-1 encoded and I want to output them to screen using Python. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Why is there no get_body() in mailbox.Maildir?

2021-11-28 Thread Chris Green
s inherited the get() method so why not the get_body() method? I'm running Python 3.9.7 on xubuntu Linux 21.10. Is there another way of doing this or do I have to sort through the message parts and stuff? It sounded like get_body() would make things easier. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Where to keep local Python modules?

2021-07-24 Thread Chris Green
as uncluttered as possible though so maybe I'll keep the lib directory under ~/.config or ~/.local. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Where to keep local Python modules?

2021-07-23 Thread Chris Green
Roland Mueller wrote: > Hello, > > pe 23. heinäk. 2021 klo 21.44 Chris Green (c...@isbd.net) kirjoitti: > > > This isn't a question about how to set PYTHONPATH so that Python code > > can find imported modules, it's about what is a sensible layout for > &

  1   2   3   >