Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Matter cannot be created or destroyed, nor can it be returned without a receipt.


devel / comp.lang.python / Re: Odd locale error that has disappeared on reboot.

SubjectAuthor
* Odd locale error that has disappeared on reboot.Chris Green
+* Re: Odd locale error that has disappeared on reboot.Julio Di Egidio
|`* Re: Odd locale error that has disappeared on reboot.Chris Green
| `* Re: Odd locale error that has disappeared on reboot.Julio Di Egidio
|  `* Re: Odd locale error that has disappeared on reboot.Chris Green
|   +- Re: Odd locale error that has disappeared on reboot.Julio Di Egidio
|   `- Re: Odd locale error that has disappeared on reboot.Peter J. Holzer
+- Re: Odd locale error that has disappeared on reboot.Dieter Maurer
`* Re: Odd locale error that has disappeared on reboot.Inada Naoki
 `- Re: Odd locale error that has disappeared on reboot.Chris Green

1
Odd locale error that has disappeared on reboot.

<p5b48i-o59f1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20736&group=comp.lang.python#20736

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Odd locale error that has disappeared on reboot.
Date: Tue, 7 Dec 2021 15:28:25 +0000
Lines: 53
Message-ID: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fk780h2psWIogQGTqjfpPAiwQPrceUTmqBcjhMt9n0sW28S8s=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:XhuAB/GajHaKGRAOj2Mwb5ROGaM=
User-Agent: tin/2.4.6-20210226 ("Glen Albyn") (Linux/5.13.0-21-generic (x86_64))
 by: Chris Green - Tue, 7 Dec 2021 15:28 UTC

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
#
#
# read temperature from 1-wire sensor and store in database with date and time
#
import sqlite3
import time

ftxt = str(open("/sys/bus/w1/devices/28-01204e1e64c3/w1_slave").read(100))
temp = (float(ftxt[ftxt.find("t=") +2:]))/1000
#
#
# insert date, time and temperature into the database
#
tdb = sqlite3.connect("/home/chris/.cfg/share/temperature/temperature.db")
cr = tdb.cursor()
dt = time.strftime("%Y-%m-%d %H:%M")
cr.execute("Insert INTO temperatures (DateTime, Temperature) VALUES(?, round(?, 2))", (dt, temp)
)
tdb.commit()
tdb.close()

It's run by cron every 10 minutes.

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 encoding
LookupError: unknown encoding: UTF-8

Current thread 0xb6f8db40 (most recent call first):
Aborted

Running the program from the command line produced the same error.
Restarting the Pi system has fixed the problem.

What could have caused this? I certainly wasn't around at 03:40! :-)
There aren't any automatic updates enabled on the system, the only
thing that might have been going on was a backup as that Pi is 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
·

Re: Odd locale error that has disappeared on reboot.

<soo3ip$u1v$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20737&group=comp.lang.python#20737

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: julio@diegidio.name (Julio Di Egidio)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Tue, 7 Dec 2021 17:53:45 +0100
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <soo3ip$u1v$1@dont-email.me>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 7 Dec 2021 16:53:45 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8ee18148047bd292422a66f5509ce09b";
logging-data="30783"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+f5dzfsGD9f79aoAHCSzUORon50bGMVkU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:+xMXzCbiRg2qaK6WDanfLVu+B1Y=
In-Reply-To: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
Content-Language: en-GB
 by: Julio Di Egidio - Tue, 7 Dec 2021 16:53 UTC

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
> #
> #
> # read temperature from 1-wire sensor and store in database with date and time
> #
> import sqlite3
> import time
>
> ftxt = str(open("/sys/bus/w1/devices/28-01204e1e64c3/w1_slave").read(100))
> temp = (float(ftxt[ftxt.find("t=") +2:]))/1000
> #
> #
> # insert date, time and temperature into the database
> #
> tdb = sqlite3.connect("/home/chris/.cfg/share/temperature/temperature.db")
> cr = tdb.cursor()
> dt = time.strftime("%Y-%m-%d %H:%M")
> cr.execute("Insert INTO temperatures (DateTime, Temperature) VALUES(?, round(?, 2))", (dt, temp)
> )
> tdb.commit()
> tdb.close()
>
> It's run by cron every 10 minutes.
>
>
> 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 encoding
> LookupError: unknown encoding: UTF-8
>
> Current thread 0xb6f8db40 (most recent call first):
> Aborted
>
> Running the program from the command line produced the same error.
> Restarting the Pi system has fixed the problem.
>
>
> What could have caused this? I certainly wasn't around at 03:40! :-)
> There aren't any automatic updates enabled on the system, the only
> thing that might have been going on was a backup as that Pi is 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.

Since it's a one-off, doesn't sound like a system problem. The easiest
might be that you try-catch that call and retry when needed, and I'd
also check that 'ftxt' is what it should be: "external devices" may
fail, including when they do produce output...

Julio

Re: Odd locale error that has disappeared on reboot.

<8ob68i-v6dj1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20754&group=comp.lang.python#20754

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Wed, 8 Dec 2021 09:50:32 +0000
Lines: 65
Message-ID: <8ob68i-v6dj1.ln1@esprimo.zbmc.eu>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <soo3ip$u1v$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net O9ftmaBBjkCer9VEObmQTg1PJzewB3PcJ7UBvXKquBEtSNcKs=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:uGyWRcsEmhPxKvXpi46azNmcIus=
User-Agent: tin/2.4.6-20210226 ("Glen Albyn") (Linux/5.13.0-21-generic (x86_64))
 by: Chris Green - Wed, 8 Dec 2021 09:50 UTC

Julio Di Egidio <julio@diegidio.name> 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
> > #
> > #
> > # read temperature from 1-wire sensor and store in database with date and time
> > #
> > import sqlite3
> > import time
> >
> > ftxt = str(open("/sys/bus/w1/devices/28-01204e1e64c3/w1_slave").read(100))
> > temp = (float(ftxt[ftxt.find("t=") +2:]))/1000
> > #
> > #
> > # insert date, time and temperature into the database
> > #
> > tdb = sqlite3.connect("/home/chris/.cfg/share/temperature/temperature.db")
> > cr = tdb.cursor()
> > dt = time.strftime("%Y-%m-%d %H:%M")
> > cr.execute("Insert INTO temperatures (DateTime, Temperature) VALUES(?,
> round(?, 2))", (dt, temp)
> > )
> > tdb.commit()
> > tdb.close()
> >
> > It's run by cron every 10 minutes.
> >
> >
> > 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 encoding
> > LookupError: unknown encoding: UTF-8
> >
> > Current thread 0xb6f8db40 (most recent call first):
> > Aborted
> >
> > Running the program from the command line produced the same error.
> > Restarting the Pi system has fixed the problem.
> >
> >
> > What could have caused this? I certainly wasn't around at 03:40! :-)
> > There aren't any automatic updates enabled on the system, the only
> > thing that might have been going on was a backup as that Pi is 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.
>
> Since it's a one-off, doesn't sound like a system problem. The easiest
> might be that you try-catch that call and retry when needed, and I'd
> also check that 'ftxt' is what it should be: "external devices" may
> fail, including when they do produce output...
>
Well it repeated every ten minutes through the night until I rebooted
the system, so it wasn't really a "one off". I hasn't repeated since
though.

--
Chris Green
·

Re: Odd locale error that has disappeared on reboot.

<soqrj3$57n$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20762&group=comp.lang.python#20762

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: julio@diegidio.name (Julio Di Egidio)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Wed, 8 Dec 2021 18:55:46 +0100
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <soqrj3$57n$1@dont-email.me>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <soo3ip$u1v$1@dont-email.me>
<8ob68i-v6dj1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 8 Dec 2021 17:55:47 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5d937f58728870b3499b1fd0c1ec941a";
logging-data="5367"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jtrqkiDVPzXYJ1smS5a8YZr/D8HwoVPM="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:A51mHL58pIn2UCLjWO3cU0F0SHE=
In-Reply-To: <8ob68i-v6dj1.ln1@esprimo.zbmc.eu>
Content-Language: en-GB
 by: Julio Di Egidio - Wed, 8 Dec 2021 17:55 UTC

On 08/12/2021 10:50, Chris Green wrote:
> Julio Di Egidio <julio@diegidio.name> 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
>>> #
>>> #
>>> # read temperature from 1-wire sensor and store in database with date and time
>>> #
>>> import sqlite3
>>> import time
>>>
>>> ftxt = str(open("/sys/bus/w1/devices/28-01204e1e64c3/w1_slave").read(100))
>>> temp = (float(ftxt[ftxt.find("t=") +2:]))/1000
>>> #
>>> #
>>> # insert date, time and temperature into the database
>>> #
>>> tdb = sqlite3.connect("/home/chris/.cfg/share/temperature/temperature.db")
>>> cr = tdb.cursor()
>>> dt = time.strftime("%Y-%m-%d %H:%M")
>>> cr.execute("Insert INTO temperatures (DateTime, Temperature) VALUES(?,
>> round(?, 2))", (dt, temp)
>>> )
>>> tdb.commit()
>>> tdb.close()
>>>
>>> It's run by cron every 10 minutes.
>>>
>>>
>>> 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 encoding
>>> LookupError: unknown encoding: UTF-8
>>>
>>> Current thread 0xb6f8db40 (most recent call first):
>>> Aborted
>>>
>>> Running the program from the command line produced the same error.
>>> Restarting the Pi system has fixed the problem.
>>>
>>>
>>> What could have caused this? I certainly wasn't around at 03:40! :-)
>>> There aren't any automatic updates enabled on the system, the only
>>> thing that might have been going on was a backup as that Pi is 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.
>>
>> Since it's a one-off, doesn't sound like a system problem. The easiest
>> might be that you try-catch that call and retry when needed, and I'd
>> also check that 'ftxt' is what it should be: "external devices" may
>> fail, including when they do produce output...
>>
> Well it repeated every ten minutes through the night until I rebooted
> the system, so it wasn't really a "one off". I hasn't repeated since
> though.

Still your code wouldn't pass review: you do need some exception
handling there, that it's not failing right now is no excuse. Moreover,
next time it fails, you won't be any wiser since you keep not handling
it... Unless this is all just for fun, in which case of course never mind.

HTH,

Julio

Re: Odd locale error that has disappeared on reboot.

<mailman.44.1638986523.15287.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20763&group=comp.lang.python#20763

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: dieter@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Wed, 8 Dec 2021 19:02:01 +0100
Lines: 20
Message-ID: <mailman.44.1638986523.15287.python-list@python.org>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
<25008.62233.919289.573481@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de OAefDel8me6He5P64kEQMQTtw1/R+HMutwyxu7J/deoA==
Return-Path: <dieter@handshake.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(most': 0.05; 'error:':
0.05; 'thread': 0.05; 'sensor': 0.07; 'subject:error': 0.07;
'utf-8': 0.07; 'view,': 0.07; 'apparently': 0.09; 'cc:addr:python-
list': 0.09; 'raspberry': 0.09; 'restart': 0.09; 'cc:no real
name:2**0': 0.14; 'problem.': 0.15; 'encoding': 0.16; 'encoding:':
0.16; 'python': 0.16; 'uses': 0.19; 'cc:addr:python.org': 0.20;
'unable': 0.21; 'command': 0.23; 'received:de': 0.23; 'cc:2**0':
0.25; 'seems': 0.26; 'chris': 0.28; 'error': 0.29; 'program':
0.31; 'unknown': 0.32; 'but': 0.32; 'same': 0.34; 'header:In-
Reply-To:1': 0.34; 'runs': 0.35; 'subject:that': 0.35;
'following': 0.35; 'wrote': 0.39; 'header:Received:6': 0.67;
'collect': 0.69; 'database': 0.80; 'ensured': 0.84; 'received:88':
0.84; 'temperatures': 0.84; 'green': 0.96
In-Reply-To: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <25008.62233.919289.573481@ixdm.fritz.box>
X-Mailman-Original-References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
 by: Dieter Maurer - Wed, 8 Dec 2021 18:02 UTC

Chris Green wrote at 2021-12-7 15:28 +0000:
>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:-
> ...
>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 encoding
> LookupError: unknown encoding: UTF-8
>
> Current thread 0xb6f8db40 (most recent call first):
> Aborted
>
>Running the program from the command line produced the same error.
>Restarting the Pi system has fixed the problem.

Python has not its own locale database but uses that of the operating
system. From my point of view, the operating system state seems
to have got corrupted. A restart apparently has ensured a clean state again.

Re: Odd locale error that has disappeared on reboot.

<mailman.56.1639018592.15287.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20781&group=comp.lang.python#20781

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: songofacandy@gmail.com (Inada Naoki)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Thu, 9 Dec 2021 11:56:04 +0900
Lines: 30
Message-ID: <mailman.56.1639018592.15287.python-list@python.org>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
<CAEfz+TyNJmS4LZgNLuXsbcdwtAz739gXLqp-jFzT85Qg1Ey2yw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de jo6uhrDbwu6OATBUEitXjQoM6SmIt8yKJ1+P+TAN1B5w==
Return-Path: <songofacandy@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=mc5eIshW;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(most': 0.05; 'error:':
0.05; 'thread': 0.05; 'libraries.': 0.07; 'subject:error': 0.07;
'utf-8': 0.07; 'cc:addr:python-list': 0.09; 'rarely': 0.09;
"shouldn't": 0.09; 'problem.': 0.15; 'cc:name:python': 0.16;
'encoding': 0.16; 'encoding:': 0.16; 'inada': 0.16; 'naoki': 0.16;
'useful.': 0.16; 'wrote:': 0.16; 'python': 0.16; 'solve': 0.19;
'cc:addr:python.org': 0.20; 'unable': 0.21; 'install': 0.23;
'command': 0.23; 'cc:2**0': 0.25; 'chris': 0.28; 'wrong': 0.28;
'error': 0.29; 'dec': 0.31; 'received:209.85.160': 0.31;
'program': 0.31; 'deleted': 0.32; 'unknown': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'there': 0.33; 'same': 0.34; 'header
:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'running':
0.34; 'subject:that': 0.35; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'files': 0.36; 'received:209.85':
0.37; 'means': 0.38; 'received:209': 0.39; 'wed,': 0.39; 'your':
0.64; '2021': 0.71; 'green': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=AcsE8h28gRPHi6g4utv3H6YAerjpAqbNw7+tipQWBik=;
b=mc5eIshWLZOyyY8nuwZhYYZVeF/NwJHCGhEjShMG6MONgEjVZJRd3VRKoWHPA3tiG8
7lBt8pxlupwVJ2GX3eIRJu1rAc/IV5DUe9/QPLQ15FCFa8QJUtOy2wgtay0b65F1hEtH
Stolgt0JqzICKL3jq2EvkWTfeKUmdjRYPAHCFqKP6u23DsxvioTv94TSbl92qAzA/X8j
XNeHa01LRXBpGOP65ZU7iZX+M9IwzdfarQwY8dhWdNGiTaVVrSBjaKkGXxBJs9Nzgee3
4gwEH4I5TIcK/V0MTGjsGiaQKMWoBIp29cItSblxWwfhw3RbPdV4RpGqBZVimnWY6yte
gubQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=AcsE8h28gRPHi6g4utv3H6YAerjpAqbNw7+tipQWBik=;
b=lPUD9yF62DYOZ69cxBPzWVTFzBzyvCK0ub03mdK/AEzPoNMTiZMp6dnRa7G/Kf5YrP
d6CNXEwgyFPxnMsjvCTGvQsSHcOEdGX/QGtSyqXB7arEfndG3PS07ySoO5IijgNieo8z
pkUqfzYXc/uiXgflzq3ktvKmt8KSv0C6cQROObW+h1lO+HQGr7Uz0AGvHcjRNibUgxWA
xhuhy9QXRz31ROWDHuMGXhrz/DMLXibc5yJt5vJm8+u6+yWPDOULg7Y4xbGDNBobhODz
VRngWSYruaRcYa7WBez4cOi8ssEgogJR67+0G8/kNQEWc5ST+YtY4VYX0gRXQ1iXX1iz
a+ng==
X-Gm-Message-State: AOAM530AUTYfgSpCPu7NM4xWAfeIu+tKAbr2JsZdlpBMQG5pW7+fXdfH
FwyKbzT+RtVmBKAYpUlun4dVNzFHXURcnQcNH8wZ0v3V+a0=
X-Google-Smtp-Source: ABdhPJwhTDEN2fgkgC+Dn0qfpyWlU8Sucqr3NzM0PWzJ2DRhfBb8fqEh5gQ/UDFwbg7XMUEsS2FboUsGb84z3dCQoig=
X-Received: by 2002:a05:622a:d1:: with SMTP id
p17mr13135895qtw.207.1639018590542;
Wed, 08 Dec 2021 18:56:30 -0800 (PST)
In-Reply-To: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAEfz+TyNJmS4LZgNLuXsbcdwtAz739gXLqp-jFzT85Qg1Ey2yw@mail.gmail.com>
X-Mailman-Original-References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
 by: Inada Naoki - Thu, 9 Dec 2021 02:56 UTC

On Wed, Dec 8, 2021 at 2:52 AM Chris Green <cl@isbd.net> 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 encoding
> LookupError: unknown encoding: UTF-8
>
> Current thread 0xb6f8db40 (most recent call first):
> Aborted
>
> Running the program from the command line produced the same error.
> Restarting the Pi system has fixed the problem.
>

This error means Python can not find its standard libraries. There are
some possibilities.

* You set the wrong PYTHONHOME
PYTHONHOME is very rarely useful. It shouldn't be used if you can
not solve this kind of problem.

* Your Python installation is broken.
Some files are deleted or overwritten. You need to *clean* install
Python again.

Bets,
--
Inada Naoki <songofacandy@gmail.com>

Re: Odd locale error that has disappeared on reboot.

<2v298i-jtko1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20784&group=comp.lang.python#20784

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Thu, 9 Dec 2021 10:38:58 +0000
Lines: 37
Message-ID: <2v298i-jtko1.ln1@esprimo.zbmc.eu>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <soo3ip$u1v$1@dont-email.me> <8ob68i-v6dj1.ln1@esprimo.zbmc.eu> <soqrj3$57n$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net bqdcdkBr18/7RglGvV5NKAHu9IG+1qBYFpzEEPg8lv3ITZIIc=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:zWGiVjJ8bUXPnQfaBl45vsmb8nA=
User-Agent: tin/2.4.6-20210226 ("Glen Albyn") (Linux/5.13.0-21-generic (x86_64))
 by: Chris Green - Thu, 9 Dec 2021 10:38 UTC

Julio Di Egidio <julio@diegidio.name> wrote:
> On 08/12/2021 10:50, Chris Green wrote:
> > Julio Di Egidio <julio@diegidio.name> 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 any automatic updates enabled on the system, the only
> >>> thing that might have been going on was a backup as that Pi is 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.
> >>
> >> Since it's a one-off, doesn't sound like a system problem. The easiest
> >> might be that you try-catch that call and retry when needed, and I'd
> >> also check that 'ftxt' is what it should be: "external devices" may
> >> fail, including when they do produce output...
> >>
> > Well it repeated every ten minutes through the night until I rebooted
> > the system, so it wasn't really a "one off". I hasn't repeated since
> > though.
>
> Still your code wouldn't pass review: you do need some exception
> handling there, that it's not failing right now is no excuse. Moreover,
> next time it fails, you won't be any wiser since you keep not handling
> it... Unless this is all just for fun, in which case of course never mind.
>
It is basically 'just for fun' we wanted to see how warm/cold the
cats' home above our garage was now that winter has arrived.

However catching and re-trying isn't going to help at all. It happily
produced the same arror every 10 minutes throughout the night until I
rebooted the system. I suppose I *could* reboot after (say) three
failures but it seems a bit drastic! :-)

--
Chris Green
·

Re: Odd locale error that has disappeared on reboot.

<86398i-jtko1.ln1@esprimo.zbmc.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20785&group=comp.lang.python#20785

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: cl@isbd.net (Chris Green)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Thu, 9 Dec 2021 10:42:48 +0000
Lines: 39
Message-ID: <86398i-jtko1.ln1@esprimo.zbmc.eu>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <CAEfz+TyNJmS4LZgNLuXsbcdwtAz739gXLqp-jFzT85Qg1Ey2yw@mail.gmail.com> <mailman.56.1639018592.15287.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net JbGZ2kdn8AtFhF3V1617VgGUV2HXDxLzawYdLWsfsr1fiNRQo=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:VPOavUrZjo+DI1O6zvbsXqVgYgA=
User-Agent: tin/2.4.6-20210226 ("Glen Albyn") (Linux/5.13.0-21-generic (x86_64))
 by: Chris Green - Thu, 9 Dec 2021 10:42 UTC

Inada Naoki <songofacandy@gmail.com> wrote:
> On Wed, Dec 8, 2021 at 2:52 AM Chris Green <cl@isbd.net> 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 encoding
> > LookupError: unknown encoding: UTF-8
> >
> > Current thread 0xb6f8db40 (most recent call first):
> > Aborted
> >
> > Running the program from the command line produced the same error.
> > Restarting the Pi system has fixed the problem.
> >
>
> This error means Python can not find its standard libraries. There are
> some possibilities.
>
> * You set the wrong PYTHONHOME
> PYTHONHOME is very rarely useful. It shouldn't be used if you can
> not solve this kind of problem.
>
> * Your Python installation is broken.
> Some files are deleted or overwritten. You need to *clean* install
> Python again.
>
So how was it that rebooting the system fixed the error? It has been
working perfectly OK now for a few days since the above failure and
I've changed nothing.

I think it was probably a bit of power supply noise or something that
corrupted a memory read or write, or something of that sort anyway.

--
Chris Green
·

Re: Odd locale error that has disappeared on reboot.

<sost8l$3sn$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20787&group=comp.lang.python#20787

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: julio@diegidio.name (Julio Di Egidio)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Thu, 9 Dec 2021 13:36:36 +0100
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <sost8l$3sn$1@dont-email.me>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <soo3ip$u1v$1@dont-email.me>
<8ob68i-v6dj1.ln1@esprimo.zbmc.eu> <soqrj3$57n$1@dont-email.me>
<2v298i-jtko1.ln1@esprimo.zbmc.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Dec 2021 12:36:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="9f6f6b9569ce5b95b3e278bd85e30630";
logging-data="3991"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ek/rMnElM4htlsiEfcfk+nSMcyNOFVRU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Cancel-Lock: sha1:ejv3sLQB+jc+ydtgAh0XA6qhi80=
In-Reply-To: <2v298i-jtko1.ln1@esprimo.zbmc.eu>
Content-Language: en-GB
 by: Julio Di Egidio - Thu, 9 Dec 2021 12:36 UTC

On 09/12/2021 11:38, Chris Green wrote:
> Julio Di Egidio <julio@diegidio.name> wrote:
>> On 08/12/2021 10:50, Chris Green wrote:
>>> Julio Di Egidio <julio@diegidio.name> 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 any automatic updates enabled on the system, the only
>>>>> thing that might have been going on was a backup as that Pi is 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.
>>>>
>>>> Since it's a one-off, doesn't sound like a system problem. The easiest
>>>> might be that you try-catch that call and retry when needed, and I'd
>>>> also check that 'ftxt' is what it should be: "external devices" may
>>>> fail, including when they do produce output...
>>>>
>>> Well it repeated every ten minutes through the night until I rebooted
>>> the system, so it wasn't really a "one off". I hasn't repeated since
>>> though.
>>
>> Still your code wouldn't pass review: you do need some exception
>> handling there, that it's not failing right now is no excuse. Moreover,
>> next time it fails, you won't be any wiser since you keep not handling
>> it... Unless this is all just for fun, in which case of course never mind.
>>
> It is basically 'just for fun' we wanted to see how warm/cold the
> cats' home above our garage was now that winter has arrived.
>
> However catching and re-trying isn't going to help at all. It happily
> produced the same arror every 10 minutes throughout the night until I
> rebooted the system.

OK, I see.

> I suppose I *could* reboot after (say) three
> failures but it seems a bit drastic! :-)

If all else fails, it'd still be better than waking up at night... :)

To me it seems to hint at a problem with Pi's file system itself, not
being able to access files, since it only happens when backups start
running: but then I wouldn't know (and I have zero experience with Pi),
maybe a driver needs updating, or an incompatibility of drivers, maybe
with the backup app, maybe someone/noone else is having the same
problem?, etc.

So, good luck and, should you find the root cause of the problem, it
would be interesting to know what it was.

Cheers,

Julio

Re: Odd locale error that has disappeared on reboot.

<mailman.65.1639080439.15287.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=20796&group=comp.lang.python#20796

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-python@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Odd locale error that has disappeared on reboot.
Date: Thu, 9 Dec 2021 21:07:17 +0100
Lines: 59
Message-ID: <mailman.65.1639080439.15287.python-list@python.org>
References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu> <soo3ip$u1v$1@dont-email.me>
<8ob68i-v6dj1.ln1@esprimo.zbmc.eu> <soqrj3$57n$1@dont-email.me>
<2v298i-jtko1.ln1@esprimo.zbmc.eu>
<20211209200717.eapmcfznvnjybthz@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="nmxiha55zf6bhw6p"
X-Trace: news.uni-berlin.de 5Sb3jUE1VaW99lx+6USrKQkUib16G08BSGjQU8ZEBg7g==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(which': 0.04; 'content-
type:multipart/signed': 0.05; 'failures': 0.07; 'happened': 0.07;
'subject:error': 0.07; ':-)': 0.09; 'content-type:application/pgp-
signature': 0.09; 'filename:fname piece:asc': 0.09;
'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'itself,': 0.09;
'"creative': 0.16; '*could*': 0.16; '__/': 0.16; 'challenge!"':
0.16; 'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16;
'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16; 'holzer':
0.16; 'option.': 0.16; 'reality.': 0.16; 'reboot': 0.16;
'stross,': 0.16; 'them)': 0.16; 'url-ip:212.17.106.137/32': 0.16;
'url-ip:212.17.106/24': 0.16; 'url-ip:212.17/16': 0.16; 'url:hjp':
0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'python': 0.16; 'probably':
0.17; "can't": 0.17; 'to:addr:python-list': 0.20; "i've": 0.22;
'exception': 0.22; 'code': 0.23; 'run': 0.23; "i'd": 0.24; '(and':
0.25; 'past': 0.25; 'seems': 0.26; "isn't": 0.27; 'bit': 0.27;
'chris': 0.28; 'sense': 0.28; 'program': 0.31; "wouldn't": 0.32;
'but': 0.32; 'there': 0.33; 'same': 0.34; 'header:In-Reply-To:1':
0.34; 'handling': 0.35; 'subject:that': 0.35; 'those': 0.36;
'handle': 0.39; 'still': 0.40; 'gone': 0.40; 'happen': 0.40;
'best': 0.61; 'received:212': 0.62; 'pass': 0.64; 'your': 0.64;
'process.': 0.65; 'received:userid': 0.66; 'url-ip:212/8': 0.69;
'monitor': 0.81; 'catch': 0.84; 'catching': 0.84; 'exceptions':
0.84; 'julio': 0.84; 'received:at': 0.84; 'green': 0.96
Content-Disposition: inline
In-Reply-To: <2v298i-jtko1.ln1@esprimo.zbmc.eu>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20211209200717.eapmcfznvnjybthz@hjp.at>
X-Mailman-Original-References: <p5b48i-o59f1.ln1@esprimo.zbmc.eu>
<soo3ip$u1v$1@dont-email.me>
<8ob68i-v6dj1.ln1@esprimo.zbmc.eu>
<soqrj3$57n$1@dont-email.me>
<2v298i-jtko1.ln1@esprimo.zbmc.eu>
 by: Peter J. Holzer - Thu, 9 Dec 2021 20:07 UTC
Attachments: signature.asc (application/pgp-signature)

On 2021-12-09 10:38:58 +0000, Chris Green wrote:
> Julio Di Egidio <julio@diegidio.name> wrote:
> > Still your code wouldn't pass review: you do need some exception
> > handling there
[...]
> However catching and re-trying isn't going to help at all. It happily
> produced the same arror every 10 minutes throughout the night until I
> rebooted the system.

I agree. Only catch exceptions which you can reasonably handle. For
those which you can't handle (and "some part of my Python installation
has just gone AWOL" is one of them) crashing with a stack trace is
almost certainly your best option.

> I suppose I *could* reboot after (say) three failures

Maybe, but I wouldn't do that in the python program itself, but in a
separate monitor process.

> but it seems a bit drastic! :-)

Yup. I'd do that only if I've run out of other options (which has
happened in the past and probably will happen in the future).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)

devel / comp.lang.python / Re: Odd locale error that has disappeared on reboot.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor