Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Marvelous! The super-user's going to boot me! What a finely tuned response to the situation!


devel / comp.lang.python / RE: RE: How to read file content and send email on Debian Bullseye

SubjectAuthor
* How to read file content and send email on Debian Bullseye^Bart
+* RE: How to read file content and send email on Debian Bullseye<avi.e.gross
|`* Re: RE: How to read file content and send email on Debian Bullseye^Bart
| +- Re: How to read file content and send email on Debian BullseyeJim Jackson
| `- RE: RE: How to read file content and send email on Debian Bullseye<avi.e.gross
+* Re: How to read file content and send email on Debian BullseyeThomas Passin
|`- Re: How to read file content and send email on Debian Bullseye^Bart
+* Re: How to read file content and send email on Debian Bullseye2QdxY4RzWzUUiLuE
|`* Re: How to read file content and send email on Debian Bullseye^Bart
| `- Re: How to read file content and send email on Debian BullseyeJim Jackson
+* Re: How to read file content and send email on Debian BullseyeThomas Passin
|`- Re: How to read file content and send email on Debian Bullseye^Bart
`- Re: How to read file content and send email on Debian BullseyePeter J. Holzer

1
How to read file content and send email on Debian Bullseye

<trls7e$21467$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: gabriele...@hotmail.com (^Bart)
Newsgroups: comp.lang.python
Subject: How to read file content and send email on Debian Bullseye
Date: Sat, 4 Feb 2023 16:05:18 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <trls7e$21467$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 4 Feb 2023 15:05:19 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7b6e79a9b3e801db875d01d0b43b22e4";
logging-data="2134215"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BW5mIfPl76pqfVVY3mH+mYOSR13fVu3I="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.1
Cancel-Lock: sha1:QlNtx9tdet27jm9KRX52G0sBlQI=
Content-Language: en-US
 by: ^Bart - Sat, 4 Feb 2023 15:05 UTC

Hi guys,

On a Debian Bullseye server I have a lftp upload and after it I should
send an email.

I thought to read the lftp log file where I have these lines:

2023-01-30 18:30:02
/home/my_user/local_folder/upload/my_file_30-01-2023_18-30.txt ->
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_30-01-2023_18-30.txt
0-1660576 4.92 MiB/s

2023-02-02 18:30:02
/home/my_user/local_folder/upload/my_file_02-02-2023_18-30.txt ->
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_02-02-2023_18-30.txt
0-603093 3.39 MiB/s

I'd like to use Python to check, from monday to friday (the lftp script
runs in crontab from monday to friday) when the upload works is finished
and I should send an email.

I could read by Python lftp.log and after it if there's a line with the
same day of the machine I could send an email with ok otherwise the
email will send a message with "no upload".

How could I do by Python?

Regards.
^Bart

RE: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From:
Newsgroups: comp.lang.python
Subject: RE: How to read file content and send email on Debian Bullseye
Date: Sat, 4 Feb 2023 17:10:19 -0500
Lines: 58
Message-ID: <mailman.1764.1675548624.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de E3G2sH87h+DlPEK7A35GIwFBmywPywVYTt5enKYjsEEg==
Return-Path: <avi.e.gross@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=mccSj6Xe;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.031
X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'python?': 0.03; '2023':
0.07; 'matches': 0.07; 'check,': 0.09; 'cron': 0.09; 'debian':
0.09; 'fails': 0.09; 'guys,': 0.09; 'parse': 0.09; 'received:108':
0.09; 'received:209.85.219': 0.09; 'log': 0.12; 'url:mailman':
0.15; 'python': 0.16; 'message-id:@gmail.com': 0.18; 'to:addr
:python-list': 0.20; 'machine': 0.22; 'subject:file': 0.22;
'lines': 0.23; 'subject:How': 0.23; "i'd": 0.24; 'idea': 0.24;
'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'stuff': 0.25; 'url:listinfo': 0.25;
'url-ip:188.166/16': 0.25; 'seems': 0.26; 'done': 0.28;
'example,': 0.28; 'url-ip:188/8': 0.31; 'friday': 0.32; 'python-
list': 0.32; 'script': 0.33; 'server': 0.33; 'same': 0.34; 'header
:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'runs': 0.35;
'from:addr:gmail.com': 0.35; 'request': 0.35; 'really': 0.37;
'received:209.85': 0.37; 'file': 0.38; 'way': 0.38; 'could': 0.38;
'read': 0.38; 'received:209': 0.39; 'quite': 0.39; 'otherwise':
0.39; 'use': 0.39; 'something': 0.40; 'want': 0.40; 'try': 0.40;
'should': 0.40; 'email.': 0.61; "there's": 0.61; 'from:': 0.62;
'to:': 0.62; 'email': 0.63; 'send': 0.63; 'down': 0.64;
'finished': 0.64; 'your': 0.64; 'parts': 0.65; 'look': 0.65;
'day': 0.66; 'regards.': 0.67; 'skip:/ 60': 0.69; 'subject:read':
0.69; 'url-ip:lookup error': 0.70; 'content.': 0.70; 'content':
0.72; 'relevant': 0.73; 'sent:': 0.78; 'narrow': 0.84;
'saturday,': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=FuTAMesm7RbOG6rRoDOG26b4Te66PKdX+kHA8JXeEAg=;
b=mccSj6XeRB0xZP6jguCZglOCcFPx/AN6tSOj1Wy1vRE0AbX+TMIpEyKbuEbqfTsU10
TMGG1VyEKfbqNXrA/Ru7QoC4Ll1Xzs/i2T53CELpOR6ERkXfg5rVro5RerdQo/d5aUCF
l2JD62jXc3pyyMlJBMaYs6Imd5TxcRK/jl5mXdVocB4x483JD+kc8quhkuR8p9TynRpu
OdSzmuLOOjMLeBV6kgXccAyQV2W2KBR/5+vzSOYGg/BqPOQmT6ar+P/C+2DddPDCgrhd
GWbMkFSdaP9bJTO3zbHoiXwMtvKz3umMLh6dixuWqYB7WESLBE/HWCtFwLRycq9B7eA7
dMLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=FuTAMesm7RbOG6rRoDOG26b4Te66PKdX+kHA8JXeEAg=;
b=yDq/7CjRjjlrYW0rzINAhDZUeqK5r4z0jFD8zta9u4XNibhfOPC37JmvPJ0VLdRmep
Ybz5arkRllTqQJeanyv6/OhhpAPDAg8DpCkoH+90Lnh4roZZHzqoL5WlEh/LHxjeJjID
NGe+GmNs/7d/AY5BcU0sdJa01Yn+v7YiFDmWKYyChe/Tk1JRPS3stsGHtcRLHcXE9WbM
KWtl4vKmSEV/JKrRe4jJYfyVSQzMtik1IvFRCpEk1hTWgPxng4G4mdfwk/Vvr4tfXXKy
G7feInhfaBBgyIb2Ezl5wosfI5oLP9pI6kXmsdVC+Yo6d46rh7cPpxXpFREkG/DI5qKN
+BUQ==
X-Gm-Message-State: AO0yUKUh36u3tXaxp9sPQULE+bkEWeDZqNI97CxkojM7rDwTW//fFKes
fnsOrJK2yn+1YUs6Pt/COj9bCFMkheU=
X-Google-Smtp-Source: AK7set/fS+EqzZFW+ThrXHxVIu43srpRFKJiR6G6XOV7hplCcC+TZtTIG1fSeBFx2Z8tHFXmP7Su0Q==
X-Received: by 2002:a05:6214:5292:b0:568:ff6b:f5bd with SMTP id
kj18-20020a056214529200b00568ff6bf5bdmr11027561qvb.45.1675548621248;
Sat, 04 Feb 2023 14:10:21 -0800 (PST)
In-Reply-To: <trls7e$21467$1@dont-email.me>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQLOhY5t0Qwozq1W9Iy2ZH01k1Nv06zUvhMg
Content-Language: en-us
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
 by: - Sat, 4 Feb 2023 22:10 UTC

Bart, you may want to narrow down your request to something quite specific.
For example, try to do whatever parts you know how to do and when some part
fails or is missing, ask.

I might have replied to you directly if your email email address did not
look like you want no SPAM, LOL!

The cron stuff is not really relevant and it seems your idea is to read a
part or all of a log file, parse the lines in some way and find a line that
either matches what you need or fail to find it. Either way you want to send
an email out with an appropriate content.

Which part of that do you not know how to do in python? Have you done some
reading or looking?

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of ^Bart
Sent: Saturday, February 4, 2023 10:05 AM
To: python-list@python.org
Subject: How to read file content and send email on Debian Bullseye

Hi guys,

On a Debian Bullseye server I have a lftp upload and after it I should send
an email.

I thought to read the lftp log file where I have these lines:

2023-01-30 18:30:02
/home/my_user/local_folder/upload/my_file_30-01-2023_18-30.txt ->
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_30-01-2023_18-30
..txt
0-1660576 4.92 MiB/s

2023-02-02 18:30:02
/home/my_user/local_folder/upload/my_file_02-02-2023_18-30.txt ->
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_02-02-2023_18-30
..txt
0-603093 3.39 MiB/s

I'd like to use Python to check, from monday to friday (the lftp script runs
in crontab from monday to friday) when the upload works is finished and I
should send an email.

I could read by Python lftp.log and after it if there's a line with the same
day of the machine I could send an email with ok otherwise the email will
send a message with "no upload".

How could I do by Python?

Regards.
^Bart
--
https://mail.python.org/mailman/listinfo/python-list

Re: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sat, 4 Feb 2023 17:59:11 -0500
Lines: 39
Message-ID: <mailman.1765.1675551557.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de g1w8nrOBliLQpAEIFx48pA0q2lYq7OZ3jD15tF55H3zg==
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=xSjmxMBa;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python?': 0.03; 'file?':
0.05; 'python.': 0.08; 'check,': 0.09; 'debian': 0.09; 'guys,':
0.09; 'messages.': 0.09; 'log': 0.12; 'received:10.0.0': 0.16;
'received:64.90': 0.16; 'received:64.90.62': 0.16;
'received:64.90.62.162': 0.16; 'received:dreamhost.com': 0.16;
'wrote:': 0.16; 'python': 0.16; 'probably': 0.17; 'uses': 0.19;
'to:addr:python-list': 0.20; 'machine': 0.22; 'subject:file':
0.22; 'code': 0.23; 'subject:How': 0.23; 'run': 0.23; "i'd": 0.24;
'python,': 0.25; 'header:User-Agent:1': 0.30; 'am,': 0.31;
'friday': 0.32; 'received:10.0': 0.32;
'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; 'but': 0.32; 'script':
0.33; 'server': 0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'runs': 0.35; 'using': 0.37; "it's": 0.37; 'file': 0.38; 'could':
0.38; 'read': 0.38; 'two': 0.39; 'otherwise': 0.39; 'sending':
0.39; 'use': 0.39; 'should': 0.40; 'email.': 0.61; "there's":
0.61; 'email': 0.63; 'send': 0.63; 'finished': 0.64; 'day': 0.66;
'header:Received:6': 0.67; 'received:64': 0.67; 'skip:/ 60': 0.69;
'subject:read': 0.69; 'url-ip:lookup error': 0.70; 'depending':
0.70; 'covered': 0.75
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1675551552; a=rsa-sha256;
cv=none;
b=ZWl6JphJBuaD0siMxOsdoOcg3p0jxvEAavYViolgXQ3hv2dBb00deuCSAjs4dgWRlNSFo0
7q/Jq/HvhL5UTLeAooB/SOJtCqH1vI82T3hG/r0yI2DAVNxC15DgSjMVIQ8qKYDt+baeWN
TQsweLPH/r+6pVihp+MGXf6SkAt/7q4ze6m8S8bG2K5d7NCKD4sA+n6pzJjv6K6GFdObJC
O4JbskoDKX/Rggxifn/zFjgkC0+fRDHg/mPpmN6GdywKUIWJeq+kxyxwXM63cfNcF8XYAo
SHkA7QQArhGlt28w3HtVBE7yVnE6VcTYGCYYfOGV6gkI9ZCL7q+DOuNTI0Klsw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1675551552;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=9Ep5iNnzi6tjpmdWt5jvR/KTk8uHrJSJTjCoKUA+xo8=;
b=riOMAm5N2PFc2EckAivF8uvyGwfTmewIq2C5YX2HnPZCxscvYfO8N7zKKuAeRJ3N9nDrwQ
36VqfGgqYRoPrsQOUN+8+R1eRkAgQL7I5DXC9/3t9hjOGvJzkrM8lBtqbo03Trzr9l2iku
MFO8vptAqD1qecX1J2IAXoX5JVMx9JCASUu3ShB3h8bYbXy+ZlRKbGa25H9KR+VNgyT7vT
714sO/vRbQFPt+Ymrhug/SAhAKO05fDrWrmHMontnp667l3s0k5XyTY/4PYqLdr9b3GIia
cZBdGs67sKgOvhrqa94f82fS3sqU0xN/A+WNHyzZ+JLMg+dPOhsRdp0m06XRlg==
ARC-Authentication-Results: i=1; rspamd-5fb8f68d88-444rr;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Belong-Grain: 0a5d0e1564b83578_1675551552839_2692959480
X-MC-Loop-Signature: 1675551552839:1846132200
X-MC-Ingress-Time: 1675551552839
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1675551552;
bh=9Ep5iNnzi6tjpmdWt5jvR/KTk8uHrJSJTjCoKUA+xo8=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=xSjmxMBaDg94zF4JBYeY0VZKtP7/TUzvwtcWqyELCYtnD0xoz7681Ejbssj5mhAsa
fW9CNiM3nUdeGs5oSttzsOLkvfMBd3KLuhRpDcj5916xYq42UC7f1jHkQesHzp6SvH
wJ2+w4RWCDm1+N9mMJAp08S/Qfrse2QwpBRZyoaCZa5WI0FUfCXyKr9FyPpogAWNZZ
4GpLmLVuqD4Z0rECC0QQDhBA1mV+Wgv9peujkNADDf/axBUAPvon8xcyTUwfgrwe37
AWAQ6KROb3RMX5WbIKBGtE0stauCM/kJVy+awzJdNUmmp0KkDooyqdxalKzHdAsg/7
tv47iqNa6aRxA==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Content-Language: en-US
In-Reply-To: <trls7e$21467$1@dont-email.me>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
 by: Thomas Passin - Sat, 4 Feb 2023 22:59 UTC

On 2/4/2023 10:05 AM, ^Bart wrote:
> Hi guys,
>
> On a Debian Bullseye server I have a lftp upload and after it I should
> send an email.
>
> I thought to read the lftp log file where I have these lines:
>
> 2023-01-30 18:30:02
> /home/my_user/local_folder/upload/my_file_30-01-2023_18-30.txt ->
> sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_30-01-2023_18-30.txt 0-1660576 4.92 MiB/s
>
> 2023-02-02 18:30:02
> /home/my_user/local_folder/upload/my_file_02-02-2023_18-30.txt ->
> sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_02-02-2023_18-30.txt 0-603093 3.39 MiB/s
>
> I'd like to use Python to check, from monday to friday (the lftp script
> runs in crontab from monday to friday) when the upload works is finished
> and I should send an email.
>
> I could read by Python lftp.log and after it if there's a line with the
> same day of the machine I could send an email with ok otherwise the
> email will send a message with "no upload".
>
> How could I do by Python?

Not Python, but you could run a shell script that sends the file with
lftp, and depending on the return code uses xdg-email to send one of the
two messages. This would probably be simpler than using Python.

Otherwise you haven't said what part of the process you need help with.
Reading the log file? Checking the date? Triggering the Python script?
Sending the email message with Python?

For the latter, it's covered in the Python docs -

https://docs.python.org/3.10/library/email.examples.html

Re: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: 2QdxY4Rz...@potatochowder.com
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sat, 4 Feb 2023 22:13:38 -0500
Lines: 21
Message-ID: <mailman.1767.1675566828.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de XJPSUeFmrcQqh/PyP0NlCQsdnn6W0VDnYd4qKu6d1liQ==
Return-Path: <2QdxY4RzWzUUiLuE@potatochowder.com>
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.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.08; 'debian':
0.09; 'guys,': 0.09; 'messages.': 0.09; 'received:78': 0.09;
'(it': 0.16; 'from:addr:2qdxy4rzwzuuilue': 0.16;
'from:addr:potatochowder.com': 0.16; 'received:136.243': 0.16;
'received:172.58': 0.16; 'received:www458.your-server.de': 0.16;
'received:your-server.de': 0.16; 'script.': 0.16; 'wrapper': 0.16;
'wrote:': 0.16; 'probably': 0.17; 'uses': 0.19; 'to:addr:python-
list': 0.20; 'subject:file': 0.22; 'code': 0.23; 'subject:How':
0.23; 'run': 0.23; 'received:de': 0.23; 'am,': 0.31; 'think':
0.32; 'received:136': 0.32; 'script': 0.33; 'server': 0.33;
'same': 0.34; 'header:In-Reply-To:1': 0.34; 'using': 0.37; 'file':
0.38; 'could': 0.38; 'two': 0.39; 'use': 0.39; 'appears': 0.40;
'otherwise,': 0.40; 'should': 0.40; 'email.': 0.61; 'initial':
0.61; 'email': 0.63; 'send': 0.63; 'subject:read': 0.69;
'depending': 0.70
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
X-Authenticated-Sender: 2QdxY4RzWzUUiLuE@potatochowder.com
X-Virus-Scanned: Clear (ClamAV 0.103.7/26802/Sat Feb 4 09:50:11 2023)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <Y98e4oXIv1A6euCk@anomaly>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
 by: 2QdxY4Rz...@potatochowder.com - Sun, 5 Feb 2023 03:13 UTC

On 2023-02-04 at 17:59:11 -0500,
Thomas Passin <list1@tompassin.net> wrote:

> On 2/4/2023 10:05 AM, ^Bart wrote:
> > Hi guys,
> >
> > On a Debian Bullseye server I have a lftp upload and after it I should
> > send an email.

[...]

> [...] you could run a shell script that sends the file with lftp, and
> depending on the return code uses xdg-email to send one of the two
> messages. This would probably be simpler than using Python.

xdg-email appears to be for interactive use (it opens the user's
"preferred email composer"); I think sendmail would work much better
from a script.

Otherwise, I had the same initial thought, to add to and/or build a
wrapper around the existing lftp script.

Re: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sat, 4 Feb 2023 23:49:19 -0500
Lines: 28
Message-ID: <mailman.1768.1675572573.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
<b0fe549d-2ddf-aa2e-80b5-6844045d2909@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de C9G9VnWoemjIcu2NcrH4EQsHOLDGuu8/ID2j3ISSfkDQ==
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=XOGCLTlY;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.013
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'gui': 0.05; 'python.':
0.08; 'debian': 0.09; 'guys,': 0.09; 'messages.': 0.09; '(it':
0.16; 'received:10.0.0': 0.16; 'received:64.90': 0.16;
'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
'received:dreamhost.com': 0.16; 'script.': 0.16; 'subject,': 0.16;
'wrapper': 0.16; 'wrote:': 0.16; 'probably': 0.17; 'uses': 0.19;
'pm,': 0.19; 'to:addr:python-list': 0.20; 'subject:file': 0.22;
'code': 0.23; 'command': 0.23; 'subject:How': 0.23; 'run': 0.23;
'>>>': 0.28; 'etc': 0.28; 'it,': 0.29; 'header:User-Agent:1':
0.30; 'am,': 0.31; 'putting': 0.31; 'think': 0.32; 'from,': 0.32;
'received:10.0': 0.32; 'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; 'but': 0.32; 'script':
0.33; 'server': 0.33; 'able': 0.34; 'same': 0.34; 'header:In-
Reply-To:1': 0.34; 'page,': 0.35; 'using': 0.37; 'file': 0.38;
'could': 0.38; 'two': 0.39; 'use': 0.39; 'appears': 0.40;
'otherwise,': 0.40; 'should': 0.40; 'email.': 0.61; 'initial':
0.61; 'email': 0.63; 'send': 0.63; 'header:Received:6': 0.67;
'received:64': 0.67; 'showed': 0.69; 'subject:read': 0.69;
'depending': 0.70; 'man': 0.74; 'client': 0.82; 'sure.': 0.84
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1675572561; a=rsa-sha256;
cv=none;
b=yl8lOQzziRvtcturhXZQCi6M7T4NoPjlKuqyST1qn7YXS6s8Hj/z6GG6Hyp1V4wxwEGtlP
azJ8LtoGV/FyTlT9AE5vRogAuT3Xgun0F8akBo+YxVFRy057p7mc4oOAoXrgkloosMrBfm
NG//L40rOsfQUXuO+mKFNrRvrwUy2wYhooBBReG9xFha9j0qzDJCGlAGwC73h5qVF9qJmn
oGMj4tkhaIIRFfPYKXecN/Cv2h0y4++3zRTsJfBoDQB37fok2SN//5uP81tYX1mMryJIo3
CYM9gm1cBFzB8BTGq82ujIAI5w6lgG+3h0r48NbUfzl6tOpTZUCSiN3eSFjcqQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1675572561;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=trEVN2XAvYkeLqFrqBy4o14PAwVyFtBeAxmGXgAnBFc=;
b=NyZJq9wN5RJrKKroSF2gvnaHQ7T6LJV87cd2aHQbkk113bjm0MVlh5cZ6tTcerCPtBok0n
UEWba6TTMUczxis5oOVlbe5KLP5FJ5zJstbm7v5zAdTxUDedrOpSarsX8GYj3pHSAyiJS0
e+831187dg2NNy6Qn6Q8d/c2I0YdmTxdHpFActDJzOjQZARLrODIUeba7FyBRnxE66TRT/
uOhtaLxj+ZzUqmf4vuJbuCCYG+2qVgPuMpdDwWl31Rhw1TLGZdwAoU8gDjKdQs1EewmMvT
yqbbZKIi0t3PqZ7Eu1aZpsVC+zoZfFUw9v2tDVrfFePuD5kwvA3BiFlpHhFiIw==
ARC-Authentication-Results: i=1; rspamd-5fb8f68d88-zgmxp;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Madly-Army: 385d376410129111_1675572561622_367423242
X-MC-Loop-Signature: 1675572561622:3331342685
X-MC-Ingress-Time: 1675572561621
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1675572560;
bh=trEVN2XAvYkeLqFrqBy4o14PAwVyFtBeAxmGXgAnBFc=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=XOGCLTlY3VUePDAU1pBdKFkgnGgiWouCoZxfhAg6OHKBQ81s/KB+L8XdsfSul0vbJ
hmwVJhL8P28drUrxX+cq6Lio8mCFEFQEd9tXTWZedlFgB/NyBK4LCvXkgj+OtiuzBF
MT2iYt0iYQAJHwAzAH1L7Q0rr1elKqGxqhGcfjj8Tw6DYuIzK8t+tyDvNcrM21PJ0C
FU5kgvwU+6ToEBK50NxxNHS6lFOylcm/DSKfs//OlpSI4Ldx4o41OxSXfW23IiyM3V
obnipgKlq1TmLTihRtrpSwfwm0ZAHva0w8Aa4xiU56CSiTYHZ5feIIBCVaKvuC6Ee9
7+XxG9zUdO3LQ==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Content-Language: en-US
In-Reply-To: <Y98e4oXIv1A6euCk@anomaly>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <b0fe549d-2ddf-aa2e-80b5-6844045d2909@tompassin.net>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
 by: Thomas Passin - Sun, 5 Feb 2023 04:49 UTC

On 2/4/2023 10:13 PM, 2QdxY4RzWzUUiLuE@potatochowder.com wrote:
> On 2023-02-04 at 17:59:11 -0500,
> Thomas Passin <list1@tompassin.net> wrote:
>
>> On 2/4/2023 10:05 AM, ^Bart wrote:
>>> Hi guys,
>>>
>>> On a Debian Bullseye server I have a lftp upload and after it I should
>>> send an email.
>
> [...]
>
>> [...] you could run a shell script that sends the file with lftp, and
>> depending on the return code uses xdg-email to send one of the two
>> messages. This would probably be simpler than using Python.
>
> xdg-email appears to be for interactive use (it opens the user's
> "preferred email composer"); I think sendmail would work much better
> from a script.
>
> Otherwise, I had the same initial thought, to add to and/or build a
> wrapper around the existing lftp script.

I have never used it, and I did see that wording in the man page, but it
also showed putting all the info on the command line - from, to,
subject, etc - so I thought it might be able to use a command line
client without needed any GUI interaction. But I don't know for sure.

Re: How to read file content and send email on Debian Bullseye

<tro1bs$2f94t$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: gabriele...@hotmail.com (^Bart)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 11:46:00 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <tro1bs$2f94t$1@dont-email.me>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<mailman.1765.1675551557.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 5 Feb 2023 10:45:16 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a8f03f854734b9f97533dbc08d299c5d";
logging-data="2598045"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/B0VFLkMA4CI74bDQNDQgBjQ1PWrI9W4I="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:YO7mpYCdjJSiEHimfsL6TQT+2TE=
In-Reply-To: <mailman.1765.1675551557.20444.python-list@python.org>
Content-Language: en-US
 by: ^Bart - Sun, 5 Feb 2023 10:46 UTC

> Not Python, but you could run a shell script that sends the file with
> lftp, and depending on the return code uses xdg-email to send one of the
> two messages. This would probably be simpler than using Python.

This machine is a server without DE, just command line and I didn't
configure mail client so maybe I should use something like ssmtp.

> Otherwise you haven't said what part of the process you need help with.
> Reading the log file?  Checking the date?  Triggering the Python script?
>  Sending the email message with Python?

I need to understand "just" if the upload job is finished and, I think,
the best way is to read the log file so I should write a code like:

"if there's a line with the same date of the machine than send email
with ok else send an email with failed"

I do just an upload every day, from monday to friday so I don't have in
the same day other lines.

> For the latter, it's covered in the Python docs -
>
> https://docs.python.org/3.10/library/email.examples.html

I'm reading it! :)

Regards.
^Bart

Re: How to read file content and send email on Debian Bullseye

<tro2o1$2fkp4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: gabriele...@hotmail.com (^Bart)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 12:09:33 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <tro2o1$2fkp4$1@dont-email.me>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
<mailman.1767.1675566828.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 5 Feb 2023 11:08:49 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a8f03f854734b9f97533dbc08d299c5d";
logging-data="2609956"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KCwF7KrdXGwQ0wIdvrOwrG6tx+TlHXCQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:iQRRxYpR5ClTeTsCxkYItUWHC10=
In-Reply-To: <mailman.1767.1675566828.20444.python-list@python.org>
Content-Language: en-US
 by: ^Bart - Sun, 5 Feb 2023 11:09 UTC

> xdg-email appears to be for interactive use (it opens the user's
> "preferred email composer"); I think sendmail would work much better
> from a script.

Like what I said in another post I think I could use ssmtp than
xdg-email or sendmail...

> Otherwise, I had the same initial thought, to add to and/or build a
> wrapper around the existing lftp script.

I'd like to know if there's a code made from lftp to understand when an
upload file is finished but certainly I can read it from the log file
and I think it couldn't be hard to find a value in a *.txt file and if
this value is inside of it to send an email like "ok" otherwise a
message with "k.o.".

Regards.
^Bart

Re: How to read file content and send email on Debian Bullseye

<tro2uv$2fkp4$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: gabriele...@hotmail.com (^Bart)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 12:13:15 +0100
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <tro2uv$2fkp4$2@dont-email.me>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
<b0fe549d-2ddf-aa2e-80b5-6844045d2909@tompassin.net>
<mailman.1768.1675572573.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 5 Feb 2023 11:12:31 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a8f03f854734b9f97533dbc08d299c5d";
logging-data="2609956"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3Eel78yi31MBIzrtHPI+NQzT7JQUuHSw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:6hthd/P9dImwzZERa6Q1a6w3Fwk=
Content-Language: en-US
In-Reply-To: <mailman.1768.1675572573.20444.python-list@python.org>
 by: ^Bart - Sun, 5 Feb 2023 11:13 UTC

> I have never used it, and I did see that wording in the man page, but it
> also showed putting all the info on the command line - from, to,
> subject, etc - so I thought it might be able to use a command line
> client without needed any GUI interaction.  But I don't know for sure.

This machine is a server without GUI so I must do everything by cli but
it's not a problem! :)

So mainly I should write a code to find a match between the date found
on the lftp's log file and the date of the pc, if there's a match I need
to send an email with "ok" otherwise an email with "ko".

I think it shouldn't be so hard to compare a value inside of a file with
the date of the machine but now I should understand which is the best
way! :)

Regards.
Gabriele

Re: RE: How to read file content and send email on Debian Bullseye

<trocl2$2hbfm$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: gabriele...@hotmail.com (^Bart)
Newsgroups: comp.lang.python
Subject: Re: RE: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 14:57:54 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <trocl2$2hbfm$1@dont-email.me>
References: <trls7e$21467$1@dont-email.me>
<00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
<mailman.1764.1675548624.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 5 Feb 2023 13:57:55 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a8f03f854734b9f97533dbc08d299c5d";
logging-data="2665974"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VYho8MGTb11M+6xowFKHTpCer29yYS+A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.6.0
Cancel-Lock: sha1:Z2LnumKEilJz5Oc55/ilSzMlUhI=
Content-Language: en-US
In-Reply-To: <mailman.1764.1675548624.20444.python-list@python.org>
 by: ^Bart - Sun, 5 Feb 2023 13:57 UTC

> For example, try to do whatever parts you know how to do and when some part
> fails or is missing, ask.

You're right but first of all I wrote what I'd like to do and if Python
could be the best choice about it! :)

> I might have replied to you directly if your email email address did not
> look like you want no SPAM, LOL!

Ahaha! I think you know what is spam and what is a reply\answer to a
post request so you can feel free to use also my email! :)

> The cron stuff is not really relevant and it seems your idea is to read a
> part or all of a log file, parse the lines in some way and find a line that
> either matches what you need or fail to find it. Either way you want to send
> an email out with an appropriate content.

You got the point!

> Which part of that do you not know how to do in python? Have you done some
> reading or looking?

Like what I wrote above I didn't know if Python can does what I need and
if to use Python is a good way I'll start to study how to do it! :)

In my past I used Python for Arduino programming or to do easy things,
what I should do now is little more complex but I understood from years
and years by the Python's powers you can do everything! LOL! :)

Regards.
^Bart

Re: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  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-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 15:13:49 +0100
Lines: 81
Message-ID: <mailman.1769.1675606437.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<20230205141349.5lf4ainamwm3utl5@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="nckyysgebsov7ria"
X-Trace: news.uni-berlin.de PybhXyhRlhIZRsaoyLVzGgh8QDYikIarNd37rrtkWfAw==
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; 'python?': 0.03; '(e.g.':
0.05; 'content-type:multipart/signed': 0.05; 'kernel': 0.05;
'python.': 0.08; 'check,': 0.09; 'choice.': 0.09; 'content-
type:application/pgp-signature': 0.09; 'debian': 0.09;
'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'messages.': 0.09; 'log': 0.12; '"creative': 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; 'invoke': 0.16; 'linux/unix':
0.16; 'program"': 0.16; 'reality.': 0.16; 'script.': 0.16;
'stross,': 0.16; 'tradeoffs,': 0.16; 'uploads': 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; 'problem': 0.16; 'python': 0.16; 'probably': 0.17; 'uses':
0.19; 'figure': 0.19; 'to:addr:python-list': 0.20; 'machine':
0.22; 'subject:file': 0.22; 'code': 0.23; 'subject:How': 0.23;
'run': 0.23; "i'd": 0.24; '(and': 0.25; 'anything': 0.25;
'python,': 0.25; 'bit': 0.27; 'sense': 0.28; 'takes': 0.31; 'am,':
0.31; 'friday': 0.32; 'structure': 0.32; 'but': 0.32; 'script':
0.33; 'server': 0.33; 'same': 0.34; "didn't": 0.34; 'header:In-
Reply-To:1': 0.34; '"the': 0.35; 'runs': 0.35; 'using': 0.37;
'file': 0.38; 'could': 0.38; 'read': 0.38; 'two': 0.39; 'least':
0.39; 'otherwise': 0.39; 'use': 0.39; 'table': 0.39; 'still':
0.40; "couldn't": 0.40; 'done.': 0.40; 'something': 0.40;
'should': 0.40; 'email.': 0.61; 'best': 0.61; "there's": 0.61;
'gives': 0.62; 'received:212': 0.62; 'simply': 0.63; 'email':
0.63; 'send': 0.63; 'finished': 0.64; 'received:userid': 0.66;
'day': 0.66; 'generally': 0.67; 'right': 0.68; 'mail.': 0.68;
'skip:/ 10': 0.69; 'subject:read': 0.69; 'url-ip:212/8': 0.69;
'depending': 0.70; 'reply': 0.77; 'control.': 0.84; 'examines':
0.84; 'received:at': 0.84; 'was.': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <20230205141349.5lf4ainamwm3utl5@hjp.at>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
 by: Peter J. Holzer - Sun, 5 Feb 2023 14:13 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-02-04 17:59:11 -0500, Thomas Passin wrote:
> On 2/4/2023 10:05 AM, ^Bart wrote:
> > On a Debian Bullseye server I have a lftp upload and after it I should
> > send an email.
> >
> > I thought to read the lftp log file where I have these lines:
[...]
> > I'd like to use Python to check, from monday to friday (the lftp script
> > runs in crontab from monday to friday) when the upload works is finished
> > and I should send an email.
> >
> > I could read by Python lftp.log and after it if there's a line with the
> > same day of the machine I could send an email with ok otherwise the
> > email will send a message with "no upload".
> >
> > How could I do by Python?
>
> Not Python, but you could run a shell script

If you can run a shell script you can also run a python script.
Linux/Unix is almost completely agnostic about interpreters. You
generally just invoke "the program" and then the kernel examines the
first few bytes to determine what to do with it.

> that sends the file with lftp, and depending on the return code uses
> xdg-email to send one of the two messages. This would probably be
> simpler than using Python.

Probably. But Python gives you more control. Tradeoffs, tradeoffs ...

For something like this I'd say go with what you're most familiar with
and what takes the least effort to get the job done.
For a simple one line notification I'd write a shell script invoking
/usr/sbin/sendmail. If I wanted it to be a bit fancier (e.g. a table
with the uploads over the last few days) I'd probably write a Python
script to get the MIME/HTML structure right (and still use sendmail to
actually send the mail).

xdg-mail can be anything or not be configured at all - so it might not
be the best choice.

> Otherwise you haven't said what part of the process you need help with.

Yeah, that was the reason I didn't reply to the original mail. I simply
couldn't figure out where the problem was.

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)
Re: How to read file content and send email on Debian Bullseye

<slrnttvrm6.4ki.jj@iridium.wf32df>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jj...@franjam.org.uk (Jim Jackson)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 18:00:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <slrnttvrm6.4ki.jj@iridium.wf32df>
References: <trls7e$21467$1@dont-email.me>
<00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
<mailman.1764.1675548624.20444.python-list@python.org>
<trocl2$2hbfm$1@dont-email.me>
Injection-Date: Sun, 5 Feb 2023 18:00:39 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f15c7c2cdc242f163f1e4e8bd99ee274";
logging-data="2753514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HFSbKYvn6duE21JJq5k7VU+xrSjN1BBA="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:mvgZ1RQdE51vMSPD61jl+fspXkc=
 by: Jim Jackson - Sun, 5 Feb 2023 18:00 UTC

On 2023-02-05, ^Bart <gabriele1NOSPAM@hotmail.com> wrote:
>> For example, try to do whatever parts you know how to do and when some part
>> fails or is missing, ask.
>
> You're right but first of all I wrote what I'd like to do and if Python
> could be the best choice about it! :)

I'd say you want a simple shell script wrapped around your job, and a
program to send email (bsdmail/sendmail or similar or mstmp on linux for
instance).

>
>> I might have replied to you directly if your email email address did not
>> look like you want no SPAM, LOL!
>
> Ahaha! I think you know what is spam and what is a reply\answer to a
> post request so you can feel free to use also my email! :)
>
>> The cron stuff is not really relevant and it seems your idea is to read a
>> part or all of a log file, parse the lines in some way and find a line that
>> either matches what you need or fail to find it. Either way you want to send
>> an email out with an appropriate content.
>
> You got the point!
>
>> Which part of that do you not know how to do in python? Have you done some
>> reading or looking?
>
> Like what I wrote above I didn't know if Python can does what I need and
> if to use Python is a good way I'll start to study how to do it! :)
>
> In my past I used Python for Arduino programming or to do easy things,
> what I should do now is little more complex but I understood from years
> and years by the Python's powers you can do everything! LOL! :)
>
> Regards.
> ^Bart

Re: How to read file content and send email on Debian Bullseye

<slrnttvs1j.4ki.jj@iridium.wf32df>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: jj...@franjam.org.uk (Jim Jackson)
Newsgroups: comp.lang.python
Subject: Re: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 18:06:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <slrnttvs1j.4ki.jj@iridium.wf32df>
References: <trls7e$21467$1@dont-email.me>
<1f5988f4-064a-af78-3a63-8c7b11d583ac@tompassin.net>
<Y98e4oXIv1A6euCk@anomaly>
<mailman.1767.1675566828.20444.python-list@python.org>
<tro2o1$2fkp4$1@dont-email.me>
Injection-Date: Sun, 5 Feb 2023 18:06:43 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f15c7c2cdc242f163f1e4e8bd99ee274";
logging-data="2753514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cWGAux3QWdHrQZOH+I7qCjfBVmnR1lZk="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:NHl7JGKoDWFLgcEyqLgGwW8E9bg=
 by: Jim Jackson - Sun, 5 Feb 2023 18:06 UTC

On 2023-02-05, ^Bart <gabriele1NOSPAM@hotmail.com> wrote:
>> xdg-email appears to be for interactive use (it opens the user's
>> "preferred email composer"); I think sendmail would work much better
>> from a script.
>
> Like what I said in another post I think I could use ssmtp than
> xdg-email or sendmail...
>
>> Otherwise, I had the same initial thought, to add to and/or build a
>> wrapper around the existing lftp script.
>
> I'd like to know if there's a code made from lftp to understand when an
> upload file is finished

You make an lftp "script" to upload the file and write a log somewhere -
write a script to run lftp with the lftp script, when the lftp has
finished email the log. The log will show what happenned.

In cron run the script.

> but certainly I can read it from the log file
> and I think it couldn't be hard to find a value in a *.txt file and if
> this value is inside of it to send an email like "ok" otherwise a
> message with "k.o.".
>
> Regards.
> ^Bart

RE: RE: How to read file content and send email on Debian Bullseye

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From:
Newsgroups: comp.lang.python
Subject: RE: RE: How to read file content and send email on Debian Bullseye
Date: Sun, 5 Feb 2023 22:40:32 -0500
Lines: 158
Message-ID: <mailman.1773.1675654836.20444.python-list@python.org>
References: <trls7e$21467$1@dont-email.me>
<00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
<mailman.1764.1675548624.20444.python-list@python.org>
<trocl2$2hbfm$1@dont-email.me>
<00c801d939dc$c475e7b0$4d61b710$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de jkkUJkG5dDj/ntCy2fVUBga83wtIxWtxcgtvV3db/E9Q==
Return-Path: <avi.e.gross@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=JA1CKll9;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python?': 0.03; 'chances':
0.05; 'fairly': 0.05; "python's": 0.05; 'random': 0.05; '2023':
0.07; 'exit': 0.07; 'interacting': 0.07; 'loop': 0.07; 'matches':
0.07; 'modules': 0.07; 'string': 0.07; 'wrong.': 0.07; 'c++.':
0.09; 'cron': 0.09; 'debian': 0.09; 'environments': 0.09;
'expression': 0.09; 'fails': 0.09; 'grep': 0.09; 'parse': 0.09;
'received:108': 0.09; 'log': 0.12; 'url:mailman': 0.15;
'(include': 0.16; 'answer.': 0.16; 'arduino': 0.16; 'compiled':
0.16; 'date,': 0.16; 'examine': 0.16; 'expressions': 0.16; 'for.':
0.16; 'part.': 0.16; 'patterns.': 0.16; 'pipe': 0.16; 'powers':
0.16; 'pythonic': 0.16; 'received:209.85.160.171': 0.16; 'received
:mail-qt1-f171.google.com': 0.16; 'region,': 0.16; 'relatively':
0.16; 'similar,': 0.16; 'things,': 0.16; 'vague': 0.16; 'want,':
0.16; 'problem': 0.16; 'python': 0.16; 'instead': 0.17; 'message-
id:@gmail.com': 0.18; 'solve': 0.19; 'calls': 0.19; 'to:addr
:python-list': 0.20; 'language': 0.21; 'input': 0.21; 'machine':
0.22; 'written': 0.22; 'languages': 0.22; 'maybe': 0.22;
'returns': 0.22; 'subject:file': 0.22; 'command': 0.23; 'lines':
0.23; 'subject:How': 0.23; "i'd": 0.24; 'idea': 0.24; 'anything':
0.25; 'past': 0.25; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32':
0.25; 'url-ip:188.166.95/24': 0.25; 'examples': 0.25; 'saying':
0.25; 'stuff': 0.25; 'url:listinfo': 0.25; 'cannot': 0.25;
'programming': 0.25; 'url-ip:188.166/16': 0.25; 'seems': 0.26;
'object': 0.26; 'pattern': 0.26; 'bit': 0.27; 'done': 0.28;
'request.': 0.28; 'series': 0.28; 'example,': 0.28;
'received:209.85.160': 0.31; 'url-ip:188/8': 0.31; 'wondering':
0.31; 'program': 0.31; 'think': 0.32; 'question': 0.32; 'checks':
0.32; 'keyword': 0.32; 'nature': 0.32; 'python-list': 0.32; 'but':
0.32; "i'll": 0.33; 'there': 0.33; 'particular': 0.33; 'script':
0.33; 'able': 0.34; "didn't": 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'complex': 0.35; 'understood': 0.35;
'yes,': 0.35; 'from:addr:gmail.com': 0.35; 'request': 0.35;
'mainly': 0.64; 're:': 0.64; 'your': 0.64; 'parts': 0.65; 'spam':
0.65; 'look': 0.65; 'years': 0.65; 'improve': 0.66; 'generally':
0.67; 'regards.': 0.67; 'time,': 0.67; 'right': 0.68; 'exactly':
0.68; 'interested': 0.68; 'compare': 0.69; 'responding': 0.69;
'subject:read': 0.69; 'within': 0.69; 'content.': 0.70; 'too.':
0.70; 'speed': 0.71; 'content': 0.72; 'free': 0.72; 'little':
0.73; 'relevant': 0.73; 'charset:iso-8859-1': 0.73; 'easy': 0.74;
'choice': 0.76; 'languages,': 0.76; 'sent:': 0.78; 'major': 0.78;
'study': 0.82; 'characters': 0.84; 'debate': 0.84; 'decent': 0.84;
'dozen': 0.84; 'lines,': 0.84; 'to:addr:hotmail.com': 0.84;
'want.': 0.84; 'line,': 0.93; 'seemingly': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=HlPtb7j1P4xa3q7prdY+6+Huov4CQ8vnNF14KcI0gds=;
b=JA1CKll9WAV0ZziSFdL36RLxYIfwPbRhCAJs+vkeNkiy4fySR8qB05otQxMO2vZWiD
CH2HFJlj4txlKjE/+BBwRuvrCgjAOLu5YhcWtYdNfm3N3/KIl2wHmbonwFVWHZAzlIpf
7XggbhQ/2pgUtHotysQDCGHfZUM8skZLKQ3PtXRLxKp2OvbsVxciHSHAJnUyKQNIKL3x
4BDl1AX0loqh9AgOUTm3ttlEcJlPl+mU8k8B0EUWO9Z4OwetygM574TwV9KOmSXZNdyK
sS0AR66SD4Lf9rr3K0+JBHeIGUJW4Y3hATXIdHt814IBq9o7GmSqIbLq1euanmguL+aW
7Q7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=HlPtb7j1P4xa3q7prdY+6+Huov4CQ8vnNF14KcI0gds=;
b=RWELnkYwayObNrOE4zuiMIROijSoMyrlKJa3/fzQVdAqiasEBIB2jTcbfCFFcUA9qX
zFj1yWhhadSLZMSmCoW+qfP01lAIh/LLRenFlGxO/e41747Ug1EnCpH7UTaqGx4Rs44O
OtiPmhE814vpO/CmcU9bO3ozhCaGJTIxmVQdAE2A8+E9h+itdjPWX85T8N30AQ1n3mzY
pwUiktc35W6O4Ky/81LL2dIpBAt0KJOz+dI80noAt3EaG5bYO2Ww8KwxKXPfvRELJFOo
shKBsy6puRZi6+wmFKTjdb32q9KJOEN+/YgtIBVQ6ry9kkXakdqoRklmZQNfsALrJ38o
2h2g==
X-Gm-Message-State: AO0yUKWDHF9GYZAUJR32a6+Xt9TSm1jqH+xYQafipnm9kowieZTXSfzS
AKR3qvMtshrahK5ZnjF3iW6mZHvVN/k=
X-Google-Smtp-Source: AK7set/DvWw73yS1oRa/QxRr3F4D4LNwBa9NsP4CqRhYe/zpsbTfK48px+jm2lQRkagSfadx/lN9zQ==
X-Received: by 2002:a05:622a:1006:b0:3ba:1360:ec0a with SMTP id
d6-20020a05622a100600b003ba1360ec0amr11078196qte.41.1675654834439;
Sun, 05 Feb 2023 19:40:34 -0800 (PST)
In-Reply-To: <trocl2$2hbfm$1@dont-email.me>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQLOhY5t0Qwozq1W9Iy2ZH01k1Nv0wJj3Vv1AiVXYwoBmGNuOqyllfrg
Content-Language: en-us
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <00c801d939dc$c475e7b0$4d61b710$@gmail.com>
X-Mailman-Original-References: <trls7e$21467$1@dont-email.me>
<00ad01d938e5$7836e4f0$68a4aed0$@gmail.com>
<mailman.1764.1675548624.20444.python-list@python.org>
<trocl2$2hbfm$1@dont-email.me>
 by: - Mon, 6 Feb 2023 03:40 UTC

Bart,

Some really decent cron jobs can be written without using anything complex.

I get it now that perhaps your motivation is more about finding an excuse
to learn python better. The reality is there is not much that python cannot
do if other programming languages and environments can do them so asking if
it can do it feels a tad naïve. Like many languages, python is very
extendable with all kinds of modules so often instead of doing something
totally on your own, you can find something that does much of the hard work
for you, too.

Yes, python can nicely read in lines from a log and compare them to a fixed
string or pattern and either find or not find what you ask for.

But a shell script can be written in a few minutes that simply gets the
string for the current date in the format you want, interpolates it in a
regular expression, calls grep or a dozen other programs that handle a
command line argument, and if it returns a single line, you send one email
and if none you send another and if more than one, you may have done it
wrong. Some such programs, like AWK are designed mainly to do exactly
something like you ask and examine each input line against a series of
patterns. Sending an email though is not always something easy to do from
within a program like that but a shell script that checks how it ends may do
that part.

If you are on a specific machine and only need to solve the problem on that
machine or something similar, this seems straightforward.

My impression is you want to match a line in the log file that may look like
it should match "anything", then some keyword or so that specifies all
lines about this particular upload on every day, then matches another
"anything" up to something that exactly matches the date for today, and
maybe match another "anything" to the end of the line. It can be a fairly
straightforward regular expression if the data has a regular component in
the formatting. Grep, sed, awk, perl and others can do this and others.

Could you do this faster in python? Maybe. Arguably if speed is a major
issue, write it in some compiled language like C++.

But if your data is very regular such as the entry will have some key phrase
between the 12th and 19th characters and the date will be exactly in another
exact region, then you certainly can skip regular expressions and read each
line and examine the substrings for equality. You may also speed it a bit if
you exit any such loop as soon as you find what you are looking for.

I note if your log file is big but not very busy, and you are pretty sure
the entry will be in the last few (maybe hundred) lines, some may use the
tail command and pipe the text it returns to whatever is processing the
data. There are many ways to do what you want.

But you improve your chances of getting an answer if you ask it more
clearly. There have been people (maybe just one) who have been posing
questions of a rather vague nature and then not responding as others debate
it in seemingly random directions. You are interacting nicely but some of us
have become hesitant to jump in until they see if the request is
well-intended. You do sound like you know quite a bit and your question
could have been closer to saying that you know several ways to do it
(include examples or at least outlines) and wonder if some ways are better
or more pythonic or ...

So if people keep wondering what you want, it is because the people here are
not generally interested in doing homework or complete programs for people.
If you ask us how to generate a string with the current date, and cannot
just find it on your own, we might answer. If you want to know how to store
a date as an object including the current time, and also convert the text on
a line in the log file to make another such date object and then be able to
compare them and be able to include in your email how LONG AGO the upload
was done, that would be another more specific request. If you are not sure
how python does regular expressions, ...

Otherwise, what you are asking for may not be BASIC for some but seems
relatively straightforward to some of us and we sort of may be wondering
if we are missing anything?

Good Luck,

^Avi

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of ^Bart
Sent: Sunday, February 5, 2023 8:58 AM
To: python-list@python.org
Subject: Re: RE: How to read file content and send email on Debian Bullseye

> For example, try to do whatever parts you know how to do and when some
> part fails or is missing, ask.

You're right but first of all I wrote what I'd like to do and if Python
could be the best choice about it! :)

> I might have replied to you directly if your email email address did
> not look like you want no SPAM, LOL!

Ahaha! I think you know what is spam and what is a reply\answer to a post
request so you can feel free to use also my email! :)

> The cron stuff is not really relevant and it seems your idea is to
> read a part or all of a log file, parse the lines in some way and find
> a line that either matches what you need or fail to find it. Either
> way you want to send an email out with an appropriate content.

You got the point!

> Which part of that do you not know how to do in python? Have you done
> some reading or looking?

Like what I wrote above I didn't know if Python can does what I need and if
to use Python is a good way I'll start to study how to do it! :)

In my past I used Python for Arduino programming or to do easy things, what
I should do now is little more complex but I understood from years and years
by the Python's powers you can do everything! LOL! :)

Regards.
^Bart
--
https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor