Thanks Pete, I will take a look at these.
I'm trying to take baby steps and not get overwhelmed

Also thanks to everyone else who has been responding and helping. I really do appreciate it.

Yesterday out of the 10 or so responses, I only received 3 of them in my inbox.

I guess eventually I will have to add git to the list to learn as well, if I get to the point of actually using Python for production.


-----Original Message-----
From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Pete Helgren
Sent: Thursday, January 9, 2020 3:46 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: Re: [IBMiOSS] [EXTERNAL] Re: beginning python

Mike,

FWIW I have a Github repo that has all the examples from the book I wrote a few years ago about Open Source on IBM i. If you are still poking around python in general, there might be something there that could be helpful. Nothing specific to your current foray but available if you want to check it out....

https://github.com/phelgren/OSSGarden/tree/master/python


Pete Helgren
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.petesworkshop.com&c=E,1,bBA05dmEO7j5NfWk68PEi2RIcPo6syxSU8XdYdbrnoGoLz3hd9ETP43CjAdreJ99jOPOROkuW7p2GWk_UhIOYsMyeQSqz8piMn7HY4Oi1nw,&typo=1
GIAC Secure Software Programmer-Java
Twitter - Sys_i_Geek IBM_i_Geek

On 1/9/2020 9:13 AM, Smith, Mike wrote:
Well, I'm back at it. I have successfully created a python script to create a spreadsheet. I took an existing RPG pgm and created a python script to duplicate the results.

Now I'm on to step 2, which I have been working on for a few days, and can't find the solution.
I'm trying to use parameter markers passing in parms to the script.

So my call is like this
python3
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2factchgdt.py&c=E,1,
7J0tW8lbgCpMuMy1R8_i0YmcdjB_YqsLfXYSUKRVnUbdrkZ1LdbH_oCl0tR0J3hEph9aVZ
Juxbn_4Pj5Wv87GiZSRl8D2lRkqFMwXNTXcsSRRrcy&typo=1 49490 20190101
20190131

this basics of my code are

cursor = conn.cursor()
acct = sys.argv[1]
begdate = sys.argv[2]
enddate = sys.argv[3]
query = (conn,"select bhuact, bhubld, bhuutl, rvdes, bhuuse, bhuamt,
bhutax " \ "from ublhu inner join urvc on bhurvc = rvrvc" \ "and
bhuact = ? and bhubld between ? and ? " \ "and bhurvc <> ' ' " \
"order by bhubld, bhuact, bhurvc ",(acct, begdate, enddate))
cursor.execute(query)

when I execute I get errors.

Traceback (most recent call last):
File "https://linkprotect.cudasvc.com/url?a=https%3a%2f%2factchgdt.py&c=E,1,6HTe9chWb7p6_XPT_92tFr_RTM_9GtRkNVUMGiy6dl8CVRJjcGVVuvSt8gJiDTBrSy60KPT04k-dojc3fg9tYAStWeZVNmjf4X03i0gtiEA9gqflzQlQYkk-aA,,&typo=1";, line 21, in <module>
cursor.execute(query)
File "/QOpenSys/pkgs/lib/python3.6/site-packages/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fibm_db_dbi.py&c=E,1,6_PqRllHndAKfEy0Yv_NTiJzFaLzw5R7JeIMJQNBVzLjKq6m4uiD6gQijc_GDwRzerfu-89gwBTJsqJczq0F0dbFBBjPU65az4WR558iLAG_EzFc&typo=1";, line 1386, in execute
self.messages.append(InterfaceError("execute expects the first
argument [%s] to be of type String or Unicode." % operation ))
TypeError: not all arguments converted during string formatting

These are all numeric fields in my database.

I've tried different methods for using the parms, but this is the latest iteration.

Thanks

Mike
-----Original Message-----
From: Smith, Mike
Sent: Friday, December 13, 2019 2:42 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: RE: [IBMiOSS] [EXTERNAL] Re: beginning python

Thanks Kevin
I now see the same version for both users.
I installed pip3. After installing, I tried to install a package. It suggested I upgrade from pip 9.0.1 to 19.3.1 I have successfully done this.
So that's a couple of positive steps forward.

Then I tried to install xlsxwriter.
After realizing I typed it is xlxswriter, I now have that successfully installed.
Another step forward.

One more quick question specific to python syntax.
If I have this query.
query = "select cusnum, lstnam, init, cdtlmt from qiws.qcustcdt where cdtlmt > 100"
setup a connection, cursor and then execute the cursor.
Then I have the below code to write to a .csv file.

with open('qcustcdt.csv', 'w', newline='') as file:
csvf = writer(file, quoting=QUOTE_NONNUMERIC)
for row in cur:
csvf.writerow([trim_col(col) for col in row])

how would I reference a specific field.
For example if I only wanted to write a row if lstnam = 'SMITH'
I tried if lstname = 'SMITH'
I tried if ['lstname'] = 'SMITH'

Thanks again for helping get me straightened out on the versions and pip. I really appreciate it.

Mike

-----Original Message-----
From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Kevin Bucknum
Sent: Friday, December 13, 2019 2:11 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: Re: [IBMiOSS] [EXTERNAL] Re: beginning python

Ok - so 2 things. Supermike is getting his path set so the YUM packages are first. Mike isn't. Short term you can fix mike when you log in, but you should run through the steps on the page I sent earlier to make it permanent. Run the path statement on mike, and you should get the same python3 --version output.

PATH=/QOpenSys/pkgs/bin:$PATH

As for pip3 - go into the open source package management in ACS and see if you have python3-pip installed. If not, install it. Then try again.

-----Original Message-----
From: OpenSource [mailto:opensource-bounces@xxxxxxxxxxxxxxxxxx] On
Behalf Of Smith, Mike
Sent: Friday, December 13, 2019 12:56 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: Re: [IBMiOSS] [EXTERNAL] Re: beginning python



-----Original Message-----
From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Kevin Bucknum
Sent: Friday, December 13, 2019 1:49 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: Re: [IBMiOSS] [EXTERNAL] Re: beginning python

Yea - I forgot I was in /QOpensys/pkgs/bin when I ran the commands. There has to be a path difference between supermike and mike. Lets try this.
To make sure the YUM packages are setup correctly, on either user
(only have to do this once)

ls -l /QOpenSys/pkgs/bin/python*
lrwxrwxrwx 1 qsys 0 18 Oct 4 2018 /QOpenSys/pkgs/bin/python2 -> python2.7
lrwxrwxrwx 1 qsys 0 32 Oct 4 2018 /QOpenSys/pkgs/bin/python2-config -> python2.7-config
-rwxr-xr-x 1 qsys 0 178632 Jul 10 2018 /QOpenSys/pkgs/bin/python2.7
-rwxr-xr-x 1 qsys 0 1691 Jul 10 2018 /QOpenSys/pkgs/bin/python2.7-config
lrwxrwxrwx 1 qsys 0 18 Dec 5 16:04 /QOpenSys/pkgs/bin/python3 -> python3.6
lrwxrwxrwx 1 qsys 0 32 Dec 5 16:04 /QOpenSys/pkgs/bin/python3-config -> python3.6-config
-rwxr-xr-x 2 qsys 0 235122 Oct 31 12:32 /QOpenSys/pkgs/bin/python3.6
lrwxrwxrwx 1 qsys 0 34 Dec 5 16:04 /QOpenSys/pkgs/bin/python3.6-config -> python3.6m-config
-rwxr-xr-x 2 qsys 0 235122 Oct 31 12:32 /QOpenSys/pkgs/bin/python3.6m
-rwxr-xr-x 1 qsys 0 3068 Oct 31 12:34 /QOpenSys/pkgs/bin/python3.6m-config

ls -l /QOpenSys/pkgs/bin/pip*
/QOpenSys/pkgs/bin/pip* not found

on both supermike and mike
echo $PATH
supermike
/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X1
1:/usr/sbin:.:/usr/bin

Mike

/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/
bin

I ran the 2 statements you provided under supermike, then ran a echo $PATH for both users after signing off and back on.

Thanks

MIke

-----Original Message-----
From: OpenSource [mailto:opensource-bounces@xxxxxxxxxxxxxxxxxx] On
Behalf Of Jack Woehr
Sent: Friday, December 13, 2019 12:29 PM
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxxxxxxxx>
Subject: Re: [IBMiOSS] [EXTERNAL] Re: beginning python

On Fri, Dec 13, 2019 at 11:24 AM Smith, Mike
<Mike_Smith@xxxxxxxxxxxxxxxx>
wrote:

Supermike user
Python3 --version python 3.6.9

ls -l python*
python* not found

ls -l pip*
pip* not found


This isn't correct shell syntax or ls syntax.

ls doesn't go look around your environment; it just looks in the current directory or directory provided in the argument list (unless you use arguments to make it recurse, but again, that only happens descending from the current directory or one you name in the argument list).
--
Jack Woehr
Absolute Performance, Inc.
12303 Airport Way, Suite 100
Broomfield, CO 80021

NON-DISCLOSURE NOTICE: This communication including any and all attachments is for the intended recipient(s) only and may contain confidential and privileged information. If you are not the intended recipient of this communication, any disclosure, copying further distribution or use of this communication is prohibited. If you received this communication in error, please contact the sender and delete/destroy all copies of this communication immediately.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com
%2fmailman%2flistinfo%2fopensource&c=E,1,-lBdCumUbcjE5JXcugOtj88Dwm3-W
Vc8-vBqHO87H4jIXjHeuhMB0cWjz91o0tavduoVI618N9ly9q0N3B_CqUtCRiqfDPXSLcL
jqY4l&typo=1 or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.c
om%2fopensource.&c=E,1,tZGepx6dDyUDqtarR4WRkquviy07rMPbKX7wI2y2VEezfkr
J2Um1feptpOR7LFQHNNeL6KxnXDsvwNEwgmy5PFPglCEdHyvnmH6EcmzPGpn6RUnCqyM3P
w,,&typo=1

Help support
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1
,UWqlmSiHAwGznpI3iSh-ksRr5LzgSvwmMd33C9ZOnQql1ROPQ9J11LmqFTVKCmfzm0Qgy
hbqHuB7gt_64m_NxM25D4LT1FNx5pWeGDRFpp0b&typo=1 by shopping at
amazon.com with our affiliate
link:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.co
m&c=E,1,NF5lGKX8ZYNqAo-6NUMI7x6tMMZbkZrdLnDek0sni8C5wl-hCc16Zf7hBm4yo4
nf31_OChmq3-j7bBxn-MFzJR-EoL8QTu9nL-kFu3sSlI_KXg,,&typo=1


[https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.medtronsoftware.com%2fimg%2fMedtronMinilogo.bmp&c=E,1,jM38twdUS-I2MKpGJ1NEX2YhNiUkCWonnFhDo7AFN_x2-BHnaFI-my4f203RLgP2-w-Wx0s89n2-9vZ-IO2Y-nwaRJ9ejPen7ftEspBUvgteZ2c,&typo=1] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550

https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.medtronsoftwar
e.com&c=E,1,AmunYd3yYJfAu76UrHVD0Z3-36pl5ZQASBJ1-45rHq1YwYTRqH6BSzd2n1
_afcStiZidi_xBU7QGlOXyEkl1WWkof9i9ijub-tGyzlDP&typo=1



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com
%2fmailman%2flistinfo%2fopensource&c=E,1,U6JEyQsXsxQDnJzrsArZUhKCtlAxp
MHoPQ2lLYIw4WBKBAsmK8leDUhnVvhlfcH2eGzP4R_7I_pTc29KQxt-6jrHg_ljHEOXyvY
v98WUiujXxxot&typo=1 or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.c
om%2fopensource.&c=E,1,A_nEikVzIEoNWScmS3oqzhc-rE-PXcQM-F7G9vpC1G4EU5J
Oqt7dD9mrE2haTwbmutR7y41qrzSBQ2WBtV3JN4t_T6UvDVHpo0j0QR2yvwYfb5pTUW0hL
r9Dx-w,&typo=1

Help support
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1
,iPRN-71mna7hulk-72NaYjr4r_udeQFNK6h_iedx-JSPxB6yqmoPL2twCm-jdzSWE3-ir
k2ULrOzI_s6grQILTyzgLuqo7AuY70TQO6cVHWiF5PVH24i&typo=1 by shopping at
amazon.com with our affiliate
link:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.co
m&c=E,1,mqiwz2unmxUdhfYkXVZWKOQlL1VD-D6sLIzxOaMmjfqK7j6XZLAWTw5qbMOIbx
GkFT1AP3ppHq_EDtzabhi2GGx3KnHKSEUu_EGaGbk6JBKjEjaWXv7LDvWW9w,,&typo=1
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com
%2fmailman%2flistinfo%2fopensource&c=E,1,mCqTo8rT0geL8efCUFXMBhxmlX3Yq
iIiz4bdQOVWUgJ0w8MUMeoYQ_sHofmx6YMtUz4JEymXo27Oazb0uSxxGz6PhbcdrPJ7-0z
6XnkST5sFKAmLPJvoi-Mv&typo=1 or email:
OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.c
om%2fopensource.&c=E,1,1dip6EPoGIX_7Dp4uMWvbjBV0e-PxHXQABk9eigOSxxvzQM
jwl9tuZstK99Jg2U0A6DQL9hVWvS_KMJNK4LBsiK-uZI9lCkZjvvud59n3skYBCDzLL4f&
typo=1

Help support
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1
,6I_8k2aGxtTJvdtHIYPlj-4XWzyb8Q5coyVcYTqpuTkPLr1h4qOw7-LgdI0qU6dYd6FP9
qgrxynvei8QmnKgT6urqldW0b0udXfncrx3jITVig,,&typo=1 by shopping at
amazon.com with our affiliate
link:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.co
m&c=E,1,hobfgx2EXdU_BXIIj7nhEcatW9q-EUUJmfsH1Zhrm9_DI0UYRjEPBRQ_fDCrGA
AD63LEjBzItck0KTLeJSTCZq9Z_NfYj2wY-7wgYRz9YzuXYzdwmHH8N578Iuw,&typo=1


[https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.medtronsoftware.com%2fimg%2fMedtronMinilogo.bmp&c=E,1,daK1Kwp6P08TtlTdxGrasNxEM6iJFN5N3gUxWV2IEY1UZiAUpa34LH-D3RVaHMB5szuCbOOu69QrkAqaZy-jmla624akZLeKe-NYpK07sxj9bzY5dP72kfS5fA,,&typo=1] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550

https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fwww.medtronsoftwar
e.com&c=E,1,euK3OtYrYjnf8uo7Q0ZXUg0YaIjKA4UAEO0MEpV65LLaqObeLCS-QJn-fb
YEXJgf2BFlkDkYJNU1RcICPlHqOLl-voKfY5z7JD8PI_Z0Gj1fcLCSLA4,&typo=1



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To
post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com
%2fmailman%2flistinfo%2fopensource&c=E,1,1lHHjKjZtm8ift10jX8_6cAm1jMBF
tnKvei9-jGpDtutZuXKU13-toQOyDJ4ezgNQkZOgi7-28HV6ssgl4B_RCyWNfs72g6oBAU
pBoXDfByqDng1a3g,&typo=1 or email:
OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.c
om%2fopensource.&c=E,1,UnyJfJybArsB6bzPD21_VvdK5482zHNjB7mvz3kXNjhC8zu
l6CFeD5u99urggB_XCawbsR3yvTeaH6GnF9vXU4xAMYrGtGsjXcSrzM4Ronq7X686kbQS9
x3PDD6x&typo=1

Help support
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1
,H8fdlAsR0D9Hr6CIU2d1R_1hv7wPye7VOivlMtSB4wDBBV7LPQ7X17eGfzi4q6dCFRaHh
rEhcAlNbxr7OWSVk8XLgfvW1Kx30i1oXPQ3oUCsH5-nHqQTnHU3kIkT&typo=1 by
shopping at amazon.com with our affiliate
link:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.co
m&c=E,1,LbbTnmBpoIY6R-3REoYp78WgazVFJMNvjI4E628aS0ESuzaIRnl8JaCIB3xlJg
psrgaz3t8GLR_bFX16rUn-_N-SFmvWPqmlC0ayKnivBjtHhVBP5rKywx_DLw,,&typo=1
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com%2fmailman%2flistinfo%2fopensource&c=E,1,ypuEkMYyNNIL_T4q5l2BECI3l9Rg3u9i-IwGHzT4_Y4qwRlcwipiBP2ENmLSiI6KWJhMUhp5eZjbmZbkdqKR8l4GuBzasj3G0OZ4iScQGb78VTXKQoA,&typo=1
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.com%2fopensource.&c=E,1,v6WcIVCl39W9VO7r0O5gvfKvJlNxmvEJ0AsaHvB6sMqRmt9OImVq2_VHMqjJrWyfTH-uYNrv8ELo8ERUNH42iYT2SpsR3G9h5Bg2zGZ7xFvX&typo=1

Help support https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1,siuPDfZiOK2lzd0k30_y7zsmB7T_l2sW6YqVidYFM_uI3bd_FHePDSKMSzX1v7TEbelNxV_tf6i8vSVS1-E_GmPOFv_C4zrN28yW-wvjho8hmKuL&typo=1 by shopping at amazon.com with our affiliate
link: https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.com&c=E,1,zeL7qrPn7BHPcZ2ulPO1hi-xUP1v2wXmUv84koZijaf8zgv3MnkCWweXgK8zzWvDfEuEvbnrsaksUrnN-GJkF7I1rW2NgL5bYpzg_War5dl5fBL6nNI5XqhthaWc&typo=1
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2020 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].