- edited description
xlsxwriter
I installed the xlsxwriter via pip3, however at runtime I am getting an error: ModuleNotFoundError: No module named 'xlsxwriter'
Is their a path issue? if so , suggestions are welcome :) Just a rookie trying to get things going in the python world in my shop.
from xlsxwriter import Workbook
import ibm_db_dbi as db2
conn = db2.connect()
cur = conn.cursor()
cur.execute("select * from dtalib.customer")
headers = [descr[0] for descr in cur.description]
with Workbook('customer.xlsx') as workbook:
worksheet = workbook.add_worksheet()
worksheet.write_row('A1', headers)
for rownum, row in enumerate(cur, start=1):
worksheet.write_row(rownum, 0, row)
Comments (7)
-
-
- edited description
-
Yeah, probably a PATH issue. Make sure you have
/QOpenSys/pkgs/bin
at the front of$PATH
:PATH=/QOpenSys/pkgs/bin:$PATH export PATH
If you just installed Python 3 via yum, you might also need to run
hash -r
to clear bash's lookup cache.Also, make sure to start Python with the
python3
command, notpython
. -
reporter I am using eclipse , and do not seem to be having luck with changing the path. Also when tried from the green screen I get a different error. I will upload all items.
-
reporter I did just find this from IBM: https://www-01.ibm.com/support/docview.wss?uid=swg1IV70835
I wonder if another IBM snag has surfaced?
-
^M
is a carriage return. You'll need to change the file to*LF
endings in order for it to work in PASE.The Eclipse problem is that it is trying to execute on your Windows system. if that's what you want, you'll need to install xlsxwriter there instead of on the IBM i. I also noticed that you're using the 32-bit version of Python on Windows. I'd recommend using 64-bit Python instead.
-
- changed status to resolved
I believe this has been resolved as an issue with newline characters. Please reopen or open a new issue if there is a remaining issue. Thanks!
- Log in to comment