× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yep. Thanks for the note.

I discovered ArgumentParser a few months back and have been slowly re-working into my examples.

Great for parameter validations.

Regards,
Richard Schoen
________________________________
From: Niels Liisberg <nli@xxxxxxxxxxxxxxxxx>
Sent: Thursday, February 16, 2023 3:32:40 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>; Richard Schoen <richard@xxxxxxxxxxxxxxxxx>
Subject: Re: sFTP

@Richard Schoen<mailto:richard@xxxxxxxxxxxxxxxxx>

Nice example - Just a little note - perhaps you will find parser=argparse.ArgumentParser() useful when you take parameters from the command line in python - i do it like this


parser=argparse.ArgumentParser()

parser.add_argument('--cmd', help='command to run')

parser.add_argument('--stmf', help='stream file')

....

args=parser.parse_args()



... then use it like ....

cmd = args.cmd

stmf = args.stmf





On Thu, Feb 16, 2023 at 9:59 AM Sean Courtney <scourtney@xxxxxxxxxxx<mailto:scourtney@xxxxxxxxxxx>> wrote:
Thank you for the examples ...

Mit freundlichen Grüßen / Kind regards / Bien à vous,

Seán Courtney


-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx>] Im Auftrag
von Richard Schoen
Gesendet: Thursday, 16 February 2023 01:37
An: midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>
Betreff: RE: sFTP

Here's an upload and download script sample for pysftp

https://github.com/richardschoen/PythonSamples/blob/master/ibmi/pysftpupload
.py

https://github.com/richardschoen/PythonSamples/blob/master/ibmi/pysftpdownlo
ad.py

It can be called from a CL/RPG job by using the QSHEXEC command I created to
run PASE jobs from classic IBM i jobs:
https://github.com/richardschoen/qshoni

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx<mailto:richard@xxxxxxxxxxxxxxxxx>

------------------------------

message: 5
date: Wed, 15 Feb 2023 17:16:07 +0100
from: "Sean Courtney" <scourtney@xxxxxxxxxxx<mailto:scourtney@xxxxxxxxxxx>>
subject: sFTP

Hello all,



I have been following up on the posts regarding sFTP and the following was
quoted by John Yeoug :

?You could also switch to using API-style programming with, say, Python and
pysftp. That tends to be much more flexible and less brittle.?



My question.. do you have a python example using pysftp ?



How are you invoking the call to your python script? are you calling it
directly via CLLE or are you running it as a service somewhere.



If you are invoking with CLLE or RPGLE then please post an example if
available.



Many thanks

Mit freundlichen Gr??en / Kind regards / Bien ? vous,

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx> To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related
questions.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.