wizardofzos / pyracf

RACF parsing for the rest of us...
Apache License 2.0
6 stars 8 forks source link

NameError: name 'DSACC_RECORDTYPE' is not defined #8

Closed lnlyssg closed 1 year ago

lnlyssg commented 1 year ago

Using this code:

import time
from pyracf import IRRDBU
mysys = IRRDBU('/x/IRRDBU00.txt')
mysys.parse()
while mysys.status['status'] != 'Ready':
    time.sleep(5)
mysys.xls('/x/y/my.xlsx')

I'm getting the below error:

Traceback (most recent call last):
  File "/x/x/test.py", line 7, in <module>
    mysys.xls('/x/y/my.xlsx')
  File "/x/y/opt/miniconda3/lib/python3.9/site-packages/pyracf/__init__.py", line 548, in xls
    if self._records[DSACC_RECORDTYPE]['parsed'] + self._records[GRACC_RECORDTYPE]['parsed'] == 0:
NameError: name 'DSACC_RECORDTYPE' is not defined
wizardofzos commented 1 year ago

I think 0.6.1 solves that (and more)

Can you try if that version fixes it?

also: you're actually running pyracf on USS in z/OS? Or do you use miniconda on the Linux box too?

lnlyssg commented 1 year ago

Hmmm, I get a different error after the update (I'm running this on my Mac):

Traceback (most recent call last):
  File "/x/x/test2.py", line 7, in <module>
    mysys.xls('/x/x/my.xlsx')
  File "/x/x/opt/miniconda3/lib/python3.9/site-packages/pyracf/__init__.py", line 663, in xls
    writer.save()
AttributeError: 'XlsxWriter' object has no attribute 'save'
wizardofzos commented 1 year ago
>>> r = RACF(irrdbu00='IRRDBU-MACDEV')
>>> r.parse()
True
>>> r.status
{'status': 'Ready', 'input-lines': 4987, 'lines-read': 4987, 'lines-parsed': 4269, 'lines-per-second': 21536, 'parse-time': 0.231557}
>>> r.xls()
/home/henri/pyracf/lib/python3.8/site-packages/pyracf/__init__.py:663: FutureWarning: save is not part of the public API, usage can give unexpected results and will be removed in a future version
  writer.save()

I see! Looks like I'm having an older version of xlsxWriter?

henri@themachine:~/pyracf$ pip freeze | grep Xls
XlsxWriter==3.0.3

Investigating!

wizardofzos commented 1 year ago

If only all errors/bug were this easily fixed :)

--> https://stackoverflow.com/questions/74948525/futurewarning-save-is-not-part-of-the-public-api-in-python

crafting a 0.6.2 to amend that...

wizardofzos commented 1 year ago

https://github.com/wizardofzos/pyracf/commit/4ebcd18d603cad553ca4f8a467a732881ac1b657

Should fix that.... available via pip install at PyPi now too (0.6.2)

let me know, then I'll close this issue :)

THANKS

lnlyssg commented 1 year ago

All working now!

wizardofzos commented 1 year ago

Cool. Leaving closed then :)

(also merged you README example fixes....thanks!)